Hi all

I did some further testing:

The URL

http://host/admin/foo/bar/schema/simple

matches the path template

@Path("{project}/{repository}")

In this case the path parameter {project} is assigned "foo/bar/schema" and {repository} is assigned "simple".

This is clearly not what I would expect.

The above URL also matches the template @Path("{project}/{repository}/schema/{schema}"), and in this case the parameters are assigned as expected.

However since two resource methods match the given URL, often the wrong one (repository) is called.

Bug or feature?

Best regards,
Roman


Roman Geus wrote:
Hallo all

I'm using restlet 1.1-m5 and I have a problem with routing http requests to JAX-RS resource methods:

My resource class looks as follows:

@Path("admin")
public class RestAdminServiceResource {

   /**
* Provides both static and dynamic, per-request information, about the
    * components of a request URI.
    */
   @Context
   UriInfo uriInfo;

   @GET
   @Produces("text/html")
   public Response root() {
       ...
   }

   @GET
   @Path("{project}")
   @Produces("text/html")
   public Response project(@PathParam("project") String project) {
       ...
   }

   @GET
   @Path("{project}/{repository}")
   @Produces("text/html")
   public Response repository(@PathParam("project") String project,
           @PathParam("repository") String repository) {
       ...
   }

   @GET
   @Path("{project}/{repository}/schema")
   @Produces("text/html")
   public Response schemaDir(@PathParam("project") String project,
           @PathParam("repository") String repository) {
       ...
   }

   @GET
   @Path("{project}/{repository}/schema/{schema}")
   @Produces("text/html")
   public Response schema(@PathParam("project") String project,
           @PathParam("repository") String repository,
           @PathParam("schema") String schema) {
       ...
   }

}

The following requests are routed as expected:

http://host/admin
http://host/admin/PRJ
http://host/admin/PRJ/REPO

However requests containing the "schema" path segment are all routed to the repository method, instead of the schemaDir and schema method:

http://host/admin/PRJ/REPO/schema
http://host/admin/PRJ/REPO/schema/SCM

Is this working as intended? If yes, how can I implement resources for {project}/{repository}/schema and {project}/{repository}/schema/{schema}.

Thanks,
Roman


Reply via email to