Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jersey resource with multiple paths

Tags:

java

jersey

I'm trying to migrate the way my resources are named, from Portuguese (and singular) to English (and plural), and I was wondering if Jersey currently supports multiple @Paths for the same resource, so I could make this transition painless to the 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) {
        ...
    }
}

Would really appreciate if someone could help me with this.

Cheers!

like image 775
Alexandre Martins Avatar asked Sep 15 '25 07:09

Alexandre Martins


1 Answers

Yes, there is a way to work with multiple paths:

@Path("/{parameter: path1|path2}")
like image 91
znurgl Avatar answered Sep 17 '25 20:09

znurgl