I want the URL for my API to have following format for users resource:
http://hostname/webappname/something/something/serviceName/orgs/{id}/users
However, I get a 404 error as the URL mapping fails. But if I have following format, I get the response.
http://hostname/webappname/{id}/something/something/serviceName/orgs/{id}/users
This is my @Path annotation:
@Path("/orgs/{oid: [0-9]+}/users")
But if I have the following @Path annotation:
@Path("/orgs")
With URL’s
http://hostname/webappname/{id}/something/something/serviceName/orgs
http://hostname/webappname/something/something/serviceName/orgs
I always get a response back. Can someone tell how should I provide @Path annotation for my resource. Or where am I going wrong?
Users Resource class looks like this:
@Path("/orgs/{oid: [0-9]+}/users")
@Component
public class UserResource extends Resource {
}
Orgs Resource class looks like this:
@Path("/orgs")
@Component
public class OrgResource extends Resource {
}
I figured out the problem. It had nothing to do with the my @Path annotation. While creating this project I added some old code dependencies. One of then was unsharding filter whose job was to strip of shard present in the URL before passing it to the next filter. It was removing the {oid} from the requested path and hence there was a URL mapping error. I faced this issue only when I changed the URL format for my project.