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

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

- Parameters based on class types:
  - Request objects:
    - {@code AsyncContext}
    - {@link oajr.arg.CookieList}
    - {@code DispatcherType}
    - {@link oaj.httppart.HttpPartParserSession}
    - {@link oaj.httppart.HttpPartSerializerSession}
    - {@code HttpServletRequest}
    - {@link java.io.InputStream}
    - {@link oaj.parser.InputStreamParser}
    - {@link java.util.Locale}
    - {@link oaj.cp.Messages}
    - {@link oaj.parser.Parser}
    - {@link java.security.Principal}
    - {@link java.io.Reader}
    - {@link oaj.parser.ReaderParser}
    - {@link oajr.httppart.RequestAttributes}
    - {@link oajr.httppart.RequestContent}
    - {@link oajr.httppart.RequestFormParams}
    - {@link oajr.httppart.RequestHeaders}
    - {@link oajr.httppart.RequestPathParams}
    - {@link oajr.httppart.RequestQueryParams}
    - {@link java.util.ResourceBundle}
    - {@link oajr.RestRequest}
    - {@code ServletInputStream}
    - {@link oaj.dto.swagger.Swagger}
    - {@link java.util.TimeZone}
    - {@link oaj.UriContext}
    - {@link oaj.UriResolver}
    - {@link oaj.svl.VarResolverSession}
  - Response objects:
    - {@code HttpServletResponse}
    - {@link java.io.OutputStream}
    - {@link oajr.RestResponse}
    - {@code ServletOutputStream}
    - {@link java.io.Writer}
  - Session objects:
    - {@code HttpSession}
    - {@link oajr.RestSession}
    - {@link oajr.util.UrlPath}
    - {@link oajr.util.UrlPathMatch}
    - {@link oaj.cp.BeanStore}
    - {@link oajr.RestOpSession}
  - Parsed request header values:
    - {@link oaj.http.header.Accept}
    - {@link oaj.http.header.AcceptCharset}
    - {@link oaj.http.header.AcceptEncoding}
    - {@link oaj.http.header.AcceptLanguage}
    - {@link oaj.http.header.AcceptRanges}
    - {@link oaj.http.header.Authorization}
    - {@link oaj.http.header.CacheControl}
    - {@link oaj.http.header.ClientVersion}
    - {@link oaj.http.header.Connection}
    - {@link oaj.http.header.ContentDisposition}
    - {@link oaj.http.header.ContentEncoding}
    - {@link oaj.http.header.ContentLength}
    - {@link oaj.http.header.ContentType}
    - {@link oaj.http.header.Date}
    - {@link oaj.http.header.Debug}
    - {@link oaj.http.header.Expect}
    - {@link oaj.http.header.Forwarded}
    - {@link oaj.http.header.From}
    - {@link oaj.http.header.Host}
    - {@link oaj.http.header.IfMatch}
    - {@link oaj.http.header.IfModifiedSince}
    - {@link oaj.http.header.IfNoneMatch}
    - {@link oaj.http.header.IfRange}
    - {@link oaj.http.header.IfUnmodifiedSince}
    - {@link oaj.http.header.MaxForwards}
    - {@link oaj.http.header.NoTrace}
    - {@link oaj.http.header.Origin}
    - {@link oaj.http.header.Pragma}
    - {@link oaj.http.header.ProxyAuthorization}
    - {@link oaj.http.header.Range}
    - {@link oaj.http.header.Referer}
    - {@link oaj.http.header.TE}
    - {@link oaj.http.header.Thrown}
    - {@link oaj.http.header.Upgrade}
    - {@link oaj.http.header.UserAgent}
    - {@link oaj.http.header.Warning}
  - Context values:
    - {@link oaj.BeanContext}
    - {@link oajr.logger.CallLogger}
    - {@link oaj.config.Config}
    - {@link oajr.debug.DebugEnablement}
    - {@link oaj.encoders.EncoderSet}
    - {@link oaj.cp.FileFinder}
    - {@link oaj.jsonschema.JsonSchemaGenerator}
    - {@link java.util.logging.Logger}
    - {@link oajr.stats.MethodExecStore}
    - {@link oaj.parser.ParserSet}
    - {@link oajr.RestChildren}
    - {@link oajr.RestContext}
    - {@link oajr.stats.RestContextStats}
    - {@link oajr.RestOpContext}
    - {@link oajr.RestOperations}
    - {@link oaj.serializer.SerializerSet}
    - {@link oajr.staticfile.StaticFiles}
    - {@link oajr.stats.ThrownStore}
- Annotated parameters (either on the parameter or parameter type):
  - {@link oajr.annotation.Attr}
  - {@link oaj.http.annotation.Content}
  - {@link oaj.http.annotation.Path}
  - {@link oaj.http.annotation.FormData}
  - {@link oaj.http.annotation.HasFormData}
  - {@link oaj.http.annotation.Query}
  - {@link oaj.http.annotation.HasQuery}
  - {@link oaj.http.annotation.Header}
  - {@link oaj.http.annotation.StatusCode}
  - {@link oajr.annotation.Method}
  - {@link oaj.http.annotation.Request}
  - {@link oaj.http.annotation.Response}

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); | } | }