Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WARNING: The (sub)resource method contains empty path annotation

I have configured rest path like "/v1/" and the endpoint configured in servlet like '/test/'.

Now I removed the "/v1" from the java class "Test".

org.glassfish.jersey.internal.Errors logErrors WARNING: The following warnings have been detected: WARNING: The (sub)resource method test in com.abc.services.Test contains empty path annotation. 

I got the above warning after make this change. How to handle this warning?

And I want this "/v1" removing changes for across 10 rest paths. So anyone help me to run without warnings?

like image 570
Brisi Avatar asked Nov 04 '15 04:11

Brisi


1 Answers

The warning means you have a resource method annotated with @Path("/") or @Path(""). For instance

@Path("test") public class Test {      @GET     @Path("/")     public String test(){} } 

Not sure why Jersey would give a warning, maybe just to make sure that's what you really want. The reason is that a resource method with @Path("/") is redundant, as it's already implied if you were just to do

@Path("test") public class Test {      @GET     public String test(){} } 

without the @Path("/"). It works the same. So if you have these, remove them, and it should take away the warnings.

like image 157
Paul Samsotha Avatar answered Sep 22 '22 17:09

Paul Samsotha