Annotation Interface Request


Request bean annotation.

Identifies an interface to use to interact with HTTP parts of an HTTP request through a bean.

Can be used in the following locations:

  • Arguments and argument-types of server-side @RestOp-annotated methods.
  • Arguments and argument-types of client-side @RemoteResource-annotated interfaces.
Arguments and argument-types of server-side @RestOp-annotated methods

Annotation that can be applied to a parameter of a @RestOp-annotated method to identify it as an interface for retrieving HTTP parts through a bean interface.

Example:

@RestGet("/mypath/{p1}/{p2}/*") public void myMethod(@Request MyRequest requestBean) {...} public interface MyRequest { @Path // Path variable name inferred from getter. String getP1(); @Path("p2") String getX(); @Path("/*") String getRemainder(); @Query String getQ1(); // Schema-based query parameter: Pipe-delimited lists of comma-delimited lists of integers. @Query( collectionFormat="pipes" items=@Items( items=@SubItems( collectionFormat="csv" type="integer" ) ) ) int[][] getQ3(); @Header("*") Map<String,Object> getHeaders();

// Same as above but annotation defined on interface. @RestGet(path="/mypath/{p1}/{p2}/*") public void myMethod(MyRequest requestBean) {...} @Request public interface MyRequest {...}

The return types of the getters must be the supported parameter types for the HTTP-part annotation used.
Schema-based serialization and parsing is allowed just as if used as individual parameter types.

Arguments and argument-types of client-side @RemoteResource-annotated interfaces

Annotation applied to Java method arguments of interface proxies to denote a bean with remote resource annotations.

Example:

@RemoteResource(path="/myproxy") public interface MyProxy { @RemoteGet("/mymethod/{p1}/{p2}") String myProxyMethod(@Request MyRequest requestBean); } public class MyRequest { @Path // Path variable name inferred from getter. public String getP1() {...} @Path("p2") public String getX() {...} @Path("/*") public String getRemainder() {...} @Query public String getQ1() {...} // Schema-based query parameter: Pipe-delimited lists of comma-delimited lists of integers. @Query( schema=@Query( collectionFormat="pipes" items=@Items( items=@SubItems( collectionFormat="csv" type="integer" ) ) ) ) public int[][] getQ3() {...} @Header("*") public Map<String,Object> getHeaders() {...} }

See Also:

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Optional description for the exposed API.
  • Element Details

    • description

      Optional description for the exposed API.
      Returns:
      The annotation value.
      Since:
      9.2.0
      Default:
      {}