Skip to main content

@Path

The @Path annotation can be applied to arguments of @RemoteOp-annotated methods to denote that they are path parameters on the request.

@Pathname - Path variable name.serializer - Override the part serializer.
Example
@Remote(path="/myproxy")
public interface MyProxy {

// Explicit names specified for path parameters.
// pojo will be converted to UON notation (unless plain-text parts enabled).
@RemoteGet("/mymethod1/{foo}/{bar}")
String myProxyMethod1(@Path("foo") String foo, @Path("bar") MyPojo pojo);

// Multiple values pulled from a PartList object.
// Same as @Path("*").
@RemoteGet("/mymethod2/{foo}/{bar}/{baz}")
String myProxyMethod2(@Path PartList partList);

// Multiple values pulled from a Map.
// Same as @Path("*").
@RemoteGet("/mymethod3/{foo}/{bar}/{baz}")
String myProxyMethod3(@Path Map map);

// Multiple values pulled from a bean.
// Same as @Path("*").
@RemoteGet("/mymethod4/{foo}/{bar}/{baz}")
String myProxyMethod4(@Path MyBean myBean);
}

Path arguments can be any of the following types:

See the link below for information about supported data types in OpenAPI serialization.

Path Remainder

For capturing the path remainder (the part matched by /*), you can use the @PathRemainder annotation as a more intuitive alternative to @Path("/*").

Example
@Remote(path="/myproxy")
public interface MyProxy {

// Using @PathRemainder (preferred)
@RemoteGet("/files/{+remainder}")
String getFile(@PathRemainder String remainder);

// Equivalent using @Path("/*")
@RemotePost("/upload/{+remainder}")
void uploadFile(@Path("/*") String remainder, @Content File file);
}
Discussion

Share feedback or follow-up questions for this page directly through GitHub.