开发者

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.

  1. 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.
  2. 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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜