Rest
@Documented @Target(value=TYPE) @Retention(value=RUNTIME) @Inherited @PropertyStoreApply(value=RestResourceConfigApply.class) @Deprecated public @interface RestResource
Usually used on a subclass of RestServlet
, but can be used to annotate any class that you want to expose as
a REST resource.
Modifier and Type | Optional Element and Description |
---|---|
String |
allowBodyParam
Deprecated.
Allow body URL parameter.
|
String |
allowedHeaderParams
Deprecated.
Configuration property: Allowed header URL parameters.
|
String |
allowedMethodHeaders
Deprecated.
Configuration property: Allowed method headers.
|
String |
allowedMethodParams
Deprecated.
Allowed method parameters.
|
String |
allowHeaderParams
Deprecated.
|
String[] |
attrs
Deprecated.
Default request attributes.
|
Class<?>[] |
beanFilters
Deprecated.
|
Class<? extends RestCallHandler> |
callHandler
Deprecated.
REST call handler.
|
Class<? extends RestCallLogger> |
callLogger
Deprecated.
Specifies the logger to use for logging of HTTP requests and responses.
|
Class<?>[] |
children
Deprecated.
REST children.
|
Class<? extends ClasspathResourceFinder> |
classpathResourceFinder
Deprecated.
Classpath resource finder.
|
String |
clientVersionHeader
Deprecated.
Client version header.
|
String |
config
Deprecated.
Optional location of configuration file for this servlet.
|
String[] |
consumes
Deprecated.
Supported content media types.
|
Class<? extends RestConverter>[] |
converters
Deprecated.
Class-level response converters.
|
String |
debug
Deprecated.
Enable debug mode.
|
String |
defaultAccept
Deprecated.
Default
|
String |
defaultCharset
Deprecated.
Default character encoding.
|
String |
defaultContentType
Deprecated.
Default
|
String[] |
defaultRequestHeaders
Deprecated.
Default request headers.
|
String[] |
defaultResponseHeaders
Deprecated.
Default response headers.
|
String[] |
description
Deprecated.
Optional servlet description.
|
Class<? extends Encoder>[] |
encoders
Deprecated.
Compression encoders.
|
String[] |
flags
Deprecated.
Shortcut for setting
properties() of simple boolean types. |
Class<? extends RestGuard>[] |
guards
Deprecated.
Class-level guards.
|
HtmlDoc |
htmldoc
Deprecated.
Use
HtmlDocConfig |
Class<? extends RestInfoProvider> |
infoProvider
Deprecated.
Configuration property: REST info provider.
|
Class<? extends RestLogger> |
logger
Deprecated.
Use
callLogger() |
Logging |
logging
Deprecated.
Specifies rules on how to handle logging of HTTP requests/responses.
|
String |
maxInput
Deprecated.
The maximum allowed input size (in bytes) on HTTP requests.
|
String |
messages
Deprecated.
Messages.
|
String[] |
mimeTypes
Deprecated.
Configuration property: MIME types.
|
Class<? extends RestMethodParam>[] |
paramResolvers
Deprecated.
Java method parameter resolvers.
|
Class<? extends ParserListener> |
parserListener
Deprecated.
|
Class<?>[] |
parsers
Deprecated.
Parsers.
|
Class<? extends HttpPartParser> |
partParser
Deprecated.
HTTP part parser.
|
Class<? extends HttpPartSerializer> |
partSerializer
Deprecated.
HTTP part serializer.
|
String |
path
Deprecated.
Resource path.
|
Class<?>[] |
pojoSwaps
Deprecated.
|
String[] |
produces
Deprecated.
Supported accept media types.
|
Property[] |
properties
Deprecated.
Class-level properties.
|
String |
renderResponseStackTraces
Deprecated.
Render response stack traces in responses.
|
Class<? extends RestResourceResolver> |
resourceResolver
Deprecated.
REST resource resolver.
|
Class<? extends ResponseHandler>[] |
responseHandlers
Deprecated.
Response handlers.
|
String |
roleGuard
Deprecated.
Role guard.
|
String |
rolesDeclared
Deprecated.
Declared roles.
|
Class<? extends SerializerListener> |
serializerListener
Deprecated.
|
Class<?>[] |
serializers
Deprecated.
Serializers.
|
String |
siteName
Deprecated.
Optional site name.
|
String[] |
staticFileResponseHeaders
Deprecated.
Static file response headers.
|
String[] |
staticFiles
Deprecated.
Static file mappings.
|
ResourceSwagger |
swagger
Deprecated.
Provides swagger-specific metadata on this resource.
|
String[] |
title
Deprecated.
Optional servlet title.
|
String |
uriAuthority
Deprecated.
Resource authority path.
|
String |
uriContext
Deprecated.
Resource context path.
|
String |
uriRelativity
Deprecated.
URI-resolution relativity.
|
String |
uriResolution
Deprecated.
URI-resolution.
|
String |
useClasspathResourceCaching
Deprecated.
Configuration property: Use classpath resource caching.
|
String |
useStackTraceHashes
Deprecated.
|
public abstract String allowBodyParam
When enabled, the HTTP body content on PUT and POST requests can be passed in as text using the
For example:
?body=(name='John%20Smith',age=45)
public abstract String allowedHeaderParams
When specified, allows headers such as
For example:
?Accept=text/json&Content-Type=text/json
public abstract String allowedMethodHeaders
A comma-delimited list of HTTP method names that are allowed to be passed as values in an
Allows you to override the actual HTTP method with a simulated method.
For example, if an HTTP Client API doesn't support
public abstract String allowedMethodParams
When specified, the HTTP method can be overridden by passing in a
For example:
?method=OPTIONS
@Deprecated public abstract String allowHeaderParams
allowedHeaderParams()
When enabled, headers such as
For example:
?Accept=text/json&Content-Type=text/json
public abstract String[] attrs
Specifies default values for request attributes if they're not already set on the request.
@Deprecated public abstract Class<?>[] beanFilters
BeanConfig.beanFilters()
Shortcut to add bean filters to the bean contexts of all serializers and parsers on all methods in the class.
public abstract Class<? extends RestCallHandler> callHandler
This class handles the basic lifecycle of an HTTP REST call.
public abstract Class<? extends ClasspathResourceFinder> classpathResourceFinder
Used to retrieve localized files from the classpath.
public abstract String clientVersionHeader
Specifies the name of the header used to denote the client version on HTTP requests.
public abstract String config
The configuration file .
Config.getSystemDefault()
.
public abstract Class<? extends RestConverter>[] converters
Associates one or more converters
with a resource class.
public abstract String defaultAccept
The default value for the
This is a shortcut for using defaultRequestHeaders()
for just this specific header.
public abstract String defaultCharset
The default character encoding for the request and response if not specified on the request.
public abstract String defaultContentType
The default value for the
This is a shortcut for using defaultRequestHeaders()
for just this specific header.
public abstract String[] defaultRequestHeaders
Specifies default values for request headers if they're not passed in through the request.
public abstract String[] defaultResponseHeaders
Specifies default values for response headers if they're not set after the Java REST method is called.
public abstract String[] description
It is used to populate the Swagger description field.
This value can be retrieved programmatically through the RestRequest.getResourceDescription()
method.
public abstract String[] flags
properties()
of simple boolean types.
public abstract Class<? extends RestGuard>[] guards
Associates one or more RestGuards
with all REST methods defined in this class.
@Deprecated public abstract HtmlDoc htmldoc
HtmlDocConfig
Used to customize the output from the HTML Doc serializer.
public abstract Class<? extends RestInfoProvider> infoProvider
Class used to retrieve title/description/swagger information about a resource.
public abstract Class<? extends RestLogger> logger
callLogger()
Specifies the logger to use for logging.
public abstract Class<? extends RestCallLogger> callLogger
public abstract String maxInput
Useful for alleviating DoS attacks by throwing an exception when too much input is received instead of resulting in out-of-memory errors which could affect system stability.
public abstract String messages
public abstract String[] mimeTypes
Defines MIME-type file type mappings.
public abstract Class<? extends RestMethodParam>[] paramResolvers
By default, the Juneau framework will automatically Java method parameters of various types (e.g.
This setting allows you to provide your own resolvers for your own class types that you want resolved.
@Deprecated public abstract Class<? extends ParserListener> parserListener
ParserConfig.listener()
Specifies the parser listener class to use for listening to non-fatal parsing errors.
public abstract Class<?>[] parsers
If no value is specified, the parsers are inherited from parent class.
Otherwise, this value overrides the parsers defined on the parent class.
Use Inherit
to inherit parsers defined on the parent class.
Use None
to suppress inheriting parsers defined on the parent class.
public abstract Class<? extends HttpPartParser> partParser
Specifies the HttpPartParser
to use for parsing headers, query/form parameters, and URI parts.
public abstract Class<? extends HttpPartSerializer> partSerializer
Specifies the HttpPartSerializer
to use for serializing headers, query/form parameters, and URI parts.
public abstract String path
Used in the following situations:
children()
annotation) to identify
the subpath used to access the child resource relative to the parent.
RestServlet
classes deployed as Spring beans when The typical usage is to define a path to a child resource relative to the parent resource.
In the example above, assuming the
Note that in this scenario, the
The path can also be used on top-level resources deployed as Spring beans when used with the
In this case, the servlet will get registered using the path defined on the resource class.
The path can contain variables that get resolved to @Path
parameters
or access through the RestRequest.getPathMatch()
method.
Variables can be used on either top-level or child resources and can be defined on multiple levels.
All variables in the path must be specified or else the target will not resolve and a
When variables are used on a path of a top-level resource deployed as a Spring bean in a Spring Boot application, the first part of the URL must be a literal which will be used as the servlet path of the registered servlet.
@Deprecated public abstract Class<?>[] pojoSwaps
BeanConfig.pojoSwaps()
Shortcut to add POJO swaps to the bean contexts of all serializers and parsers on all methods in the class.
public abstract Property[] properties
Shortcut to add properties to the bean contexts of all serializers and parsers on all methods in the class.
Any of the properties defined on RestContext
or any of the serializers and parsers can be specified.
Property values will be converted to the appropriate type.
public abstract String renderResponseStackTraces
Render stack traces in HTTP response bodies when errors occur.
public abstract Class<? extends RestResourceResolver> resourceResolver
The resolver used for resolving child resources.
public abstract Class<? extends ResponseHandler>[] responseHandlers
Specifies a list of ResponseHandler
classes that know how to convert POJOs returned by REST methods or
set via RestResponse.setOutput(Object)
into appropriate HTTP responses.
public abstract String rolesDeclared
A comma-delimited list of all possible user roles.
Used in conjunction with roleGuard()
is used with patterns.
public abstract String roleGuard
An expression defining if a user with the specified roles are allowed to access methods on this class.
rolesDeclared()
or RestContext.REST_rolesDeclared
.
@Deprecated public abstract Class<? extends SerializerListener> serializerListener
SerializerConfig.listener()
Specifies the serializer listener class to use for listening to non-fatal serialization errors.
public abstract Class<?>[] serializers
If no value is specified, the serializers are inherited from parent class.
Otherwise, this value overrides the serializers defined on the parent class.
Use Inherit
to inherit serializers defined on the parent class.
Use None
to suppress inheriting serializers defined on the parent class.
public abstract String siteName
The site name is intended to be a title that can be applied to the entire site.
This value can be retrieved programmatically through the RestRequest.getSiteName()
method.
One possible use is if you want to add the same title to the top of all pages by defining a header on a common parent class like so:
htmldoc=
public abstract String[] staticFileResponseHeaders
Used to customize the headers on responses returned for statically-served files.
Note that headers can also be specified per path-mapping via the @RestResource(staticFiles)
annotation.
public abstract String[] staticFiles
Used to define paths and locations of statically-served files such as images or HTML documents from the classpath or file system.
The format of the value is one of the following:
An example where this class is used is in the staticFiles()
annotation:
In the example above, given a GET request to the following URL...
/myresource/htdocs/foobar.html
The location is interpreted as an absolute path if it starts with
In the example above, given a GET request to the following URL...
/myresource/htdocs/foobar.html
Response headers can be specified for served files by adding a 3rd section that consists of a Simple JSON object.
The same path can map to multiple locations. Files are searched in the order
public abstract String[] produces
Overrides the media types inferred from the serializers that identify what media types can be produced by the resource.
public abstract String[] consumes
Overrides the media types inferred from the parsers that identify what media types can be consumed by the resource.
public abstract ResourceSwagger swagger
Used to populate the auto-generated OPTIONS swagger documentation.
public abstract String[] title
It is used to populate the Swagger title field.
This value can be retrieved programmatically through the RestRequest.getResourceTitle()
method.
public abstract String uriAuthority
Overrides the authority path value for this resource and any child resources.
public abstract String uriContext
Overrides the context path value for this resource and any child resources.
public abstract String uriRelativity
Specifies how relative URIs should be interpreted by serializers.
See UriResolution
for possible values.
public abstract String uriResolution
Specifies how relative URIs should be interpreted by serializers.
See UriResolution
for possible values.
public abstract String useClasspathResourceCaching
When enabled, resources retrieved via RestRequest.getClasspathReaderResource(String, boolean)
(and related
methods) will be cached in memory to speed subsequent lookups.
@Deprecated public abstract String useStackTraceHashes
Logging.useStackTraceHashing()
When enabled, the number of times an exception has occurred will be determined based on stack trace hashsums,
made available through the RestException.getOccurrence()
method.
public abstract String debug
Enables the following:
Possible values (case insensitive):
Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.