The un-annotated parameter types that can be passed in through REST Java methods has been significantly expanded.
For reference, the previous supported types were:
- {@link oajr.RestRequest} - The request object.
javax.servlet.http.HttpServletRequest - The superclass of RestRequest.
- {@link oajr.RestResponse} - The response object.
javax.servlet.http.HttpServletResponse - The superclass of RestResponse.
The new supported types are:
Accept
AcceptCharset
AcceptEncoding
AcceptLanguage
Authorization
CacheControl
Connection
ContentLength
ContentType
Date
Expect
From
Host
IfMatch
IfModifiedSince
IfNoneMatch
IfRange
IfUnmodifiedSince
MaxForwards
Pragma
ProxyAuthorization
Range
Referer
TE
UserAgent
Upgrade
Via
Warning
- {@link java.util.TimeZone}
- {@link java.io.InputStream}
javax.servlet.ServletInputStream
- {@link java.io.Reader}
- {@link java.io.OutputStream}
javax.servlet.ServletOutputStream
- {@link java.io.Writer}
- {@link java.util.ResourceBundle} - Client-localized resource bundle.
MessageBundle - A resource bundle with additional features.
- {@link java.util.Locale} - Client locale.
RequestHeaders - API for accessing request headers.
RequestQuery - API for accessing request query parameters.
RequestFormData - API for accessing request form data.
RequestPath - API for accessing path variables.
RequestBody - API for accessing request body.
- {@link oaj.http.HttpMethod} - The method name matched (when using @RestMethod(name="*"))
- {@link java.util.logging.Logger} - The logger to use for logging.
JuneauLogger - Logger with additional features.
- {@link oajr.RestContext} - The resource read-only context.
- {@link oaj.parser.Parser} - The parser matching the request content type.
- {@link oaj.dto.swagger.Swagger} - The auto-generated Swagger doc.
ConfigFile- The external config file for the resource.
So, for example...
/** Old way */
@RestMethod(name="*", path="/example1/{a1}/{a2}/{a3}/*")
public String example1(
@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,
@Header("Accept-Language") String lang,
@Header("Accept") String accept
)
/** New way */
@RestMethod(name="*", path="/example2/{a1}/{a2}/{a3}/*")
public String example2(
HttpMethod httpMethod,
RequestPathParams pathParams,
RequestQuery query,
AcceptLanguage acceptLanguage,
Accept accept
)