Hi, sorry, I've made a little mistake. You don't need a new class to do content negotiation by extension. Just enabled the tunnel filter on the JaxRsApplication and ensure, that also bson is a known extension.
best regards Stephan -----Ursprüngliche Nachricht----- Von: Stephan Koops <[email protected]> Gesendet: 25.08.2010 21:20:10 An: discuss <[email protected]> Betreff: Re: Resource paths with Restlet and Jax Rs >Hi how ever your name is, > >the best way is to remove the extension, and set the accept-header of >HTTP in the request, and the methods return an object, which will be >serialized by two JAX-RS MessageBodyWriters, annotated with @Produces. >For JSON it is already included. >If you can't or don't want to use a MessageBodyWriter, you could put >@Produces also on the resource methods. Than you have a resource method >for bson and one for json. >If it is not possible, to use the HTTP accept-header, you could create a >filter which matches the extension to the accept header. I think I can >send you code for it tomorrow. > >best regards > Stephan > >[email protected] schrieb: >> Hello, >> >> I set up a small standalone server as JaxRsApplication like in the "JAX-RS >> extension" example on the website. >> >> My resources are annotated with Jax-Rs Annotations. Every Resource should >> have the same entry point. So I was thinking to put @Path("") on each >> resource class and the specified resource path to the dedicated methods. >> When I add these resources to the application class I get a warning that >> more than one resource uses the same root path. The main problem is that I >> want to add a type extention to the URI. My URIs should look like this: >> >> www.sample.com/blogs.json >> www.sample.com/blogs/3.json >> www.sample.com/notes.json >> www.sample.com/notes/3.json >> >> So my class definition looks like >> >> @Path("") >> public class Blog{ >> @GET >> @Path("/blogs.{extension: [bj]son}") >> public String getBlogs(...){ >> ... >> } >> >> @GET >> @Path("/blogs/{blogId}.{extension: [bj]son}") >> public String getBlog(...){ >> ... >> } >> } >> >> @Path("") >> public class Note{ >> @GET >> @Path("/notes.{extension: [bj]son}") >> public String getNotes(...){ >> ... >> } >> >> @GET >> @Path("/notes/{noteId}.{extension: [bj]son}") >> public String getNote(...){ >> ... >> } >> } >> >> Is there a way to get around this? >> >> Thanks a lot in advance. >> > ___________________________________________________________ WEB.DE DSL SOMMER-SPECIAL: Surf & Phone Flat 16.000 für nur 19,99 ¿/mtl.!* http://web.de/DSL-Doppel-Flatrate/ ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2651534

