users@jersey.java.net

[Jersey] Two Resource classes with the same path

From: Alex K <wise_guybg_at_yahoo.com>
Date: Sun, 25 Jan 2009 12:23:45 -0800 (PST)

Hi,

I'm new to Jersey and so far I'm happy to what the framework is providing.

Today I experienced a problem and wanted to ask if anyone has seen the same
issue as me.

I have two Ressource classes :
@Path("repository")
public class DownloadResource

that contains the @GET and

@Path("repository")
public class UploadResource

that contains the @POST. The processing methods are a bit long and do
different things so that's why I wanted to separate them.

I was using them for a while (1-2 days) like that but today I was having
problems. When I run the server, I received the requests either in the
DownloadResource or UploadResource. It's really strange and I was not able
to get a pattern of what's happening. Firefox didn't say a thing (blank
page) and IE told me it is 405 Method Not Allowed.

When I debugged the application I noticed a problem with the path templates
and then I came to think that the problem is that I have the same path for
two different classes that are registered with Jersey. I put the code
together and everything works now.

Can someone more experienced confirm that there is a limitation and the
@Path should be unique on a class? Shouldn't there be a warning if two
classes compete for a URI (maybe it is not easy to track)?

Any comments are welcome. Thank you for the attention.

Alex K


-- 
View this message in context: http://n2.nabble.com/-Jersey--Two-Resource-classes-with-the-same-path-tp2214595p2214595.html
Sent from the Jersey mailing list archive at Nabble.com.