{title:'Java Method Parameters', updated:'9.0.0'}

Java methods can contain any of the following parameters in any order:

In Spring Boot environments, any available Spring Beans can also be passed in as parameters.

Example:

| @RestGet("/example1/{a1}/{a2}/{a3}/*") | public String doGetExample1( | RestRequest req, | RestResponse res, | @Method String method, | @Path("a1") String a1, | @Path("a2") int a2, | @Path("a3") UUID a3, | @Query("p1") int p1, | @Query("p2") String p2, | @Query("p3") UUID p3, | @HasQuery("p3") boolean hasP3, | @Path("/*") String remainder, | @Header("Accept-Language") String lang, | @Header("Accept") String accept, | @Header("DNT") int doNotTrack, | RequestAttributes attributes, | ResourceBundle nls | ) { | // Do something with all of those | }

Additional parameter types can be defined via the annotation {@link oajr.annotation.Rest#restOpArgs()} or by calling {@link oajr.RestContext.Builder#restOpArgs(Class...)}.

Example:

| @Rest( | restOpArgs={ MyOpArg.class } // Option #1 - Via annotation | ) | public class MyResource extends BasicRestObject { | | // Option #2 - Programmatically | @RestInit | public void init(RestContext.Builder builder) { | builder.restOpArgs(MyOpArg.class); | } | }