javajax-rs

What can I use for @Path("/*")?


I have an applicationPath called: /web, and after the /web, I want to use a single class, every put, delete, post, update method in code looks like:

@ApplicationPath("/web")
public class If3WebApplication extends Application {

}

And in this class I would like to handle the all http method:

@Path("/*") //this is not working...
public class OAuthToken{
private HashMap<String, String> endpointMap = new LinkedHashMap<>();
@PostConstruct
public void init(){
    endpointMap.put("token", "/token"); // here will be all urls
}

@POST
@Consumes("application/x-www-form-urlencoded")
@Produces("text/plain")
public void get(){
  .....
}

So I want to the OAuthToken to handle all post methods which comes to /web/url and post method... but the @Path("/*") not working... What is the best way to do the magic? Thanks for the help!


Solution

  • You can try using the expression for Jersey as below

    @Path("{any: .*}")