problems defining overlapping @Path values for Jersey JAX RS
I have two resource classes
Pc.java - @Path("/pc")
Tag.java - @Path("/{entity:(pc|networks)?}/{id}/tags")
So the second resource handles a branch of '/pc' or '/networks' urls that end with '/tags'.
But the problem is none of my methods in Tag.java are getting called. I think this is because Pc.java is configured to handle /pc, so all calls get redirected to that resource and Tag.java doesn't get called, so i get a 404 error.
- I can handle this by changing /tag to be the parent path and having (pc/networks) under it, but I dont want to do that because it doesnt suit the style of the rest of the urls in our project.
- I can have two sets of methods - one set under Pc.java which handles '/pc' and another set under Network.java which handles '/networks', but this seems like duplicating code开发者_运维问答...
Any ideas?
Perhaps at least part of Tag should be a sub-resource of Pc?
精彩评论