Residual Path Solution

I get something like this

import javax.ws.rs.GET;
import javax.ws.rs.Path;

public class xxx
{

  @GET
  @Path(value = "path1")
  public Response m1(@QueryParam(value = "a") String a)
  {
    ...
  }



  @GET
  @Path(value = "path2")
  public Response m2(@QueryParam(value = "b") String b)
  {
    ...
  }

}

With restEasy, I get an HTTP status of 404 - I can’t find a resource for relative every time I try to get path1 or path2 For ex http: // someip: 8080 / myserv / services / path1? A = asd

Here http://docs.jboss.org/resteasy/docs/1.2.GA/userguide/html_single/#Using_Path I read

The @ javax.ws.rs.Path annotations must exist either in the class or in the resource method. If it exists for both the class and the method, the relative path to the resource method is the concatenation of the class and method.

+3
source share
2 answers

Delete servicesif it is not part of your servlet mapping or path.

( /- )

EDIT:

, myapp + + , . + - /* so/myapp/services/path.

resteasy, , . , PathHelper.replaceEnclosedCurlyBraces

EDIT2:

, @Provider

Resteasy v1.2.1

@Provider
@Path("/")
public class xxx
{

  @GET
  @Path(value = "path1")
  public Response m1(@QueryParam(value = "a") String a)
  {
    ...
  }



  @GET
  @Path(value = "path2")
  public Response m2(@QueryParam(value = "b") String b)
  {
    ...
  }

}
+1

value = ? 100% , value =, JAX-RS, , , :

@GET  
@Path("path1")  
public Response m1(@QueryParam(value = "a") String a)  
{  
  ...  
}  
0

Source: https://habr.com/ru/post/1788466/


All Articles