Just a quick question .. I have jaxrs GET method without any @consume annotation .. I can hit this over the browser and get results .. I want this method to consume JSON request at the same time I should be able to hit this over the browser .. I tried annotating @consume for both application Jason and urlencoded but couldn’t get to support both at the same time .. Can some one shed a light with little piece of code pls?
Share
“Hit this over the browser” means
GETrequest. Consume meansPOSTrequest. These are two different types of RESTful methods and they can’t be combines in one Java method. This is how you should do it:get()method will receive requests from your browser, when you “hit” it, whilepost()method will be the one that consumes JSON.