Paul Sturrock wrote:Not sure I understand your question, the content type of the response is defined by the server? What is it you are trying to achieve?
The requirement is that the clients can ask for the JSON or the XML version of a record or a set of records using a GET request. So i was thinking to set the content-type requested by the GET request so that the servlet
can convert the data object into either JSON or XML.
Normally, when from a browser, we do a http://localhost:8080/appName/servletName
, its a GET request but no content-type is set.
However the same can be set through a Java client to make a GET request like
and the same can be obtained in the servlet as
So, i was wondering if there was a way to set this property from the browser(but not a request parameters)