I’m using the latest Jax-RS + Glassfish versions and I’ve been trying to version my API. For some reason, if I include embedded variables in my @Path Root Resource Class it doesn’t even take the variables in consideration.
@Path("/v{versionNum}/tasks")
public class Tasks {
@SuppressWarnings("unused")
@Context
private UriInfo context;
}
My Context Root is /api
My web.xml includes:
<servlet>
<description>JAX-RS Tools Generated - Do not modify</description>
<servlet-name>JAX-RS Servlet</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>JAX-RS Servlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
Now if I try to hit
localhost:8080/api/v1/tasks, I get a 404.
If I hit
localhost:8080/api/tasks, it works!
I just don’t get what I’m doing wrong here. Any help would be appreciated thanks!
sun-web.xml
web.xml
HelloWorldService.java
deploy on GlassFish
http://localhost:8080/api/v1/tasks– works well