Java – Jersey resource with multiple paths

I am trying to migrate my resource naming from Portuguese (and singular) to English (and plural). I want to know whether Jersey currently supports multiple @ paths of the same resource, so I can make this transition painless for users of my system

From:

@Path("/usuario")
public class UsersResource {

    @POST
    public Response create(User user) {
        ...
    }
}

To:

@Path("/users")
public class UsersResource {

    @POST
    public Response create(User user) {
        ...
    }
}

I really appreciate it if someone can help me

Cheers!

Solution

Yes, there is one way to use multiple paths:

@Path("/{parameter: path1|path2}")
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>