Hi John,
Regular expressions are supported when declaring path parameters. So
you will need to do something like this:
@Path("page/{page: .+}") // JAX-RS reuses a subset of the URI
template syntax.
public class MyResource {
@PathParam("page") String page;
}
See:
https://jsr311.dev.java.net/nonav/releases/1.1/javax/ws/rs/
Path.html#value%28%29
You can enable tracing and logging in Jersey and you should see what
the generated regular expressions are in trace headers of the response:
<init-param>
<param-name>com.sun.jersey.config.feature.Trace</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-
name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>
<param-
value>com.sun.jersey.api.container.filter.LoggingFilter</param-value>
</init-param>
<init-param>
<param-
name>com.sun.jersey.spi.container.ContainerResponseFilters</param-name>
<param-
value>com.sun.jersey.api.container.filter.LoggingFilter</param-value>
</init-param>
Paul.
On Jun 16, 2010, at 2:46 PM, John Ament wrote:
> I've run into an issue, and I'm not sure what I missed. I created a
> JAX-RS service that i want to match anything that matches page/(.+)
>
> So I added this to my class level:
>
> @Path("page/(.+)")
> @RequestScoped //CDI enabled
>
> and method level:
>
> @GET
> @Produces("application/json")
> public JSONObject getPage() throws JSONException {
>
> When it deploys, jersey finds no matches. No indication that the
> service was invoked.
>
> Thanks!
>
> John