users@jersey.java.net

_at_Path

From: Hilco Wijbenga <hilco.wijbenga_at_gmail.com>
Date: Fri, 8 Oct 2010 12:19:22 -0700

Hi all,

I'm using Jersey 1.4.

I guess I'm misunderstanding how @Path works.

If I try

@Path("/")
class AccountResource {
  @GET
  @Path("/account/{id}")
  public ... get(...) {...}

  @POST
  @Path("/accounts")
  public ... post(...) {...}
}

@Path("/")
class UserResource {
  @GET
  @Path("/user/{id}")
  public ... get(...) {...}

  @POST
  @Path("/users")
  public ... post(...) {...}
}

I get

8-Oct-2010 10:55:52 AM
com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
INFO: Initiating Jersey application, version 'Jersey: 1.4 09/11/2010 10:30 PM'
8-Oct-2010 10:55:52 AM com.sun.jersey.api.core.PackagesResourceConfig init
INFO: Scanning for root resource and provider classes in the packages:
  com.xyz
  org.codehaus.jackson.jaxrs
8-Oct-2010 10:55:52 AM com.sun.jersey.api.core.ScanningResourceConfig logClasses
INFO: Root resource classes found:
  class com.xyz.UserResource
  class com.xyz.AccountResource
8-Oct-2010 10:55:52 AM com.sun.jersey.api.core.ScanningResourceConfig logClasses
INFO: Provider classes found:
  class org.codehaus.jackson.jaxrs.JacksonJsonProvider
8-Oct-2010 10:55:52 AM
com.sun.jersey.server.impl.application.DeferredResourceConfig$ApplicationHolder
<init>
INFO: Instantiated the Application class com.xyz.RestApplication
8-Oct-2010 10:55:53 AM com.sun.jersey.spi.inject.Errors processErrorMessages
SEVERE: The following errors and warnings have been detected with
resource and/or provider classes:
  SEVERE: Conflicting URI templates. The URI template / for root
resource class com.xyz.AccountResource and the URI template /
transform to the same regular expression (/.*)?

Why? Each of AccountResource.get()/post() and
UserResource.get()/post() have a unique URL, don't they? What's the
problem?

Cheers,
Hilco