Reputation: 11337
I'm having an issue with Jersey, I have two path, let's say
user/comments/{username}
and
user/{username}
The first gives you the comments from an user, the second one shows you the profile of the user.
If someone use an empty parameter in the first url as user/comments/ obviously the second method is called and you get the profile of the user "comments".
There's a way where you can "reserve" to jersey some parameter or it's more a design problem and I should refactor the paths?
Upvotes: 0
Views: 261
Reputation: 6958
I'd use the following paths, which correctly represent the user -> comment hierarchy and also avoid the name collision issue:
user/{username}/comments
and
user/{username}
Upvotes: 2
Reputation: 11078
You can check in the second method if the user is "comments" and call the first one instead of the behavior. I never heard of jersey with an defined procedure to check this.
Of course, everything will work till the user that registered with the appropriate "comments" login sends you a mail complaining about your site not working; so yes, I think the best option would be to refactor it...
Upvotes: 0