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.
>

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2651374

Reply via email to