Hi,
On 20/11/12 17:13, Javier Delgadillo wrote:
All,

I have the following method in my JAX-RS service implementation:

   @GET
   @Path("/{path:.*}")
   public Response doGet( @PathParam("path") String path, @Context UriInfo info 
)

If someone issues a GET /foo.xml, in path I get the value "foo".  How do I 
figure out if the original request had a .xml suffix (or .json for that matter as it 
exhibits the same behavior)?

Perhaps the simpler option is to basically add

@Produces({"application/xml", "application/json" })

and let the runtime and providers manage the response accordingly.
If you do need to know what the extension was, try injecting HttpHeaders and get the value of Accept from there, if it is application/json then it had a ".json" extension, etc.

Finally, you can get HttpServletContext injected - this will also show the original request URI

HTH, Sergey


--
Javier Delgadillo
Esri / Implementation Services
(909) 793-2853 x1068




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Reply via email to