0

I am working with WebRequest Class in .NET and the url I have built is "workspaces/" + worspace_name + ".xml?quietOnNotFound=" + true"

This works well if the workspace exists but always throws an exception with error code 404 if the workspace does not exist.

0

1 Answer 1

1

Based on Geoserver official documents, if the workspace doesn't exist, it retruns 404 Not Found even if you send quietOnNotFound=true parameters in GET request. The only difference you can see just happens inside the geoserver .bat window.

If you send a GET request for fetching workspace that doesn't exist, you can see a message printed inside .bat window:

/geoserver/rest/workspaces/test.xml
responseCode => 404
responseMessage => No such workspace: 'test' found

log message inside geoserver cmd

Meanwhile, geoserver provides you quietOnNotFound=true parameter that helps you to avoid geoserver prints this log message. However, as geoserver is telling us, you will receive 404 Not Found as a response anyway.

/geoserver/rest/workspaces/test.xml?quietOnNotFound=true
responseCode => 404
responseMessage => ''

no log message

Please notice this is a REST API standard and not an exception when you receive 404 Not Found as response. You can handle this situation and inform the users that the workspace you are looking for, doesn't exist. This can be helpful when a user wants to create a new workspace and the system should check if this name already exists or not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.