Roman Geus | 19 Aug 17:38

Routing in Restlet JAX-RS applications

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


Gmane