Package org.apache.juneau.rest
Class RestOpContext
java.lang.Object
org.apache.juneau.Context
org.apache.juneau.rest.RestOpContext
- All Implemented Interfaces:
Comparable<RestOpContext>
- Direct Known Subclasses:
RrpcRestOpContext
Represents a single Java servlet/resource method annotated with
@RestOp.
Notes:
- This class is thread safe and reusable.
See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final BeanContextprotected final CallLoggerprotected final RestContextprotected final RestConverter[]protected final DebugEnablementprotected final Charsetprotected final NamedAttributeMapprotected final PartListprotected final HeaderListprotected final PartListprotected final HeaderListprotected final booleanprotected final EncoderSetprotected final RestGuard[]protected final Map<Class<?>,ResponsePartMeta> protected final intprotected final Stringprotected final JsonSchemaGeneratorprotected final longprotected final Methodprotected final RestOpInvokerprotected final MethodInfoprotected final RestMatcher[]protected final ParserSetprotected final HttpPartParserprotected final HttpPartSerializerprotected final UrlPathMatcher[]protected final RestOpInvoker[]protected final RestOpInvoker[]protected final RestMatcher[]protected final Map<Class<?>,ResponseBeanMeta> protected final ResponseBeanMetaprotected final SerializerSetFields inherited from class org.apache.juneau.Context
CONTEXT_APPLY_FILTER -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedRestOpContext(RestOpContext.Builder builder) Context constructor. -
Method Summary
Modifier and TypeMethodDescriptionintcopy()Creates a builder from this context object.static RestOpContext.Buildercreate(Method method, RestContext context) Creates a new builder for this object.createRequest(RestSession session) Creates aRestRequestobject based on the specified incomingHttpServletRequestobject.createResponse(RestSession session, RestRequest req) Creates aRestResponseobject based on the specified incomingHttpServletResponseobject and the request returned bycreateRequest(RestSession).createSession(RestSession session) Creates a new REST operation session.booleanReturns the bean context associated with this context.Returns the default charset.Returns the default request attributes.Returns the default form data parameters.Returns the default request headers.Returns the default request query parameters.Returns the default response headers.Returns the compression encoders to use for this method.Returns the HTTP method name (e.g.Returns the underlying Java method that this context belongs to.Returns the JSON-Schema generator applicable to this Java method.longReturns the max number of bytes to process in the input content.Returns the parsers to use for this method.Bean property getter:partParser .Bean property getter:partSerializer .Returns the path pattern for this method.Returns metadata about the specified response object if it's annotated with@Response.Returns metadata about the specified response object if it's annotated with@Header.Returns the response bean meta if this method returns aResponse-annotated bean.Returns the serializers to use for this method.Returns a list of supported accept types.Returns the list of supported content types.inthashCode()protected intmatch(RestSession session) Identifies if this method can process the specified call.Returns the properties on this bean as a map for debugging.Methods inherited from class org.apache.juneau.Context
createBuilder, createSession, getAnnotationProvider, getSession, init, isDebug, toString
-
Field Details
-
dotAll
-
hierarchyDepth
-
maxInput
-
beanContext
-
callLogger
-
defaultCharset
-
debug
-
encoders
-
defaultRequestHeaders
-
defaultResponseHeaders
-
partParser
-
partSerializer
-
jsonSchemaGenerator
-
supportedAcceptTypes
-
supportedContentTypes
-
responseBeanMetas
-
headerPartMetas
-
method
-
mi
-
defaultRequestAttributes
-
defaultRequestFormData
-
defaultRequestQueryData
-
parsers
-
context
-
converters
-
guards
-
optionalMatchers
-
requiredMatchers
-
methodInvoker
-
postCallMethods
-
preCallMethods
-
responseMeta
-
serializers
-
httpMethod
-
pathMatchers
-
-
Constructor Details
-
RestOpContext
Context constructor.- Parameters:
builder- The builder for this object.- Throws:
jakarta.servlet.ServletException- If context could not be created.
-
-
Method Details
-
create
Creates a new builder for this object.- Parameters:
method- The Java method this context belongs to.context- The Java class context.- Returns:
- A new builder.
-
compareTo
- Specified by:
compareToin interfaceComparable<RestOpContext>
-
copy
Description copied from class:ContextCreates a builder from this context object.Builders are used to define new contexts (e.g. serializers, parsers) based on existing configurations.
-
createRequest
Creates aRestRequestobject based on the specified incomingHttpServletRequestobject.- Parameters:
session- The current REST call.- Returns:
- The wrapped request object.
- Throws:
Exception- If any errors occur trying to interpret the request.
-
createResponse
Creates aRestResponseobject based on the specified incomingHttpServletResponseobject and the request returned bycreateRequest(RestSession).- Parameters:
session- The current REST call.req- The REST request.- Returns:
- The wrapped response object.
- Throws:
Exception- If any errors occur trying to interpret the request or response.
-
createSession
Creates a new REST operation session.- Parameters:
session- The REST session.- Returns:
- A new REST operation session.
- Throws:
Exception- If op session could not be created.
-
equals
-
getBeanContext
Returns the bean context associated with this context.- Returns:
- The bean context associated with this context.
-
getDefaultCharset
Returns the default charset.- Returns:
- The default charset. Never
null .
-
getDefaultRequestAttributes
Returns the default request attributes.- Returns:
- The default request attributes. Never
null .
-
getDefaultRequestFormData
Returns the default form data parameters.- Returns:
- The default form data parameters. Never
null .
-
getDefaultRequestHeaders
Returns the default request headers.- Returns:
- The default request headers. Never
null .
-
getDefaultRequestQueryData
Returns the default request query parameters.- Returns:
- The default request query parameters. Never
null .
-
getDefaultResponseHeaders
Returns the default response headers.- Returns:
- The default response headers. Never
null .
-
getEncoders
Returns the compression encoders to use for this method.- Returns:
- The compression encoders to use for this method.
-
getHttpMethod
Returns the HTTP method name (e.g."GET" ).- Returns:
- The HTTP method name.
-
getJavaMethod
Returns the underlying Java method that this context belongs to.- Returns:
- The underlying Java method that this context belongs to.
-
getJsonSchemaGenerator
Returns the JSON-Schema generator applicable to this Java method.- Returns:
- The JSON-Schema generator applicable to this Java method.
-
getMaxInput
Returns the max number of bytes to process in the input content.- Returns:
- The max number of bytes to process in the input content.
-
getParsers
Returns the parsers to use for this method.- Returns:
- The parsers to use for this method.
-
getPartParser
Bean property getter:partParser .- Returns:
- The value of the
partParser property on this bean, ornull if it is not set.
-
getPartSerializer
Bean property getter:partSerializer .- Returns:
- The value of the
partSerializer property on this bean, ornull if it is not set.
-
getPathPattern
Returns the path pattern for this method.- Returns:
- The path pattern.
-
getResponseBeanMeta
Returns metadata about the specified response object if it's annotated with@Response.- Parameters:
o- The response POJO.- Returns:
- Metadata about the specified response object, or
null if it's not annotated with@Response.
-
getResponseHeaderMeta
Returns metadata about the specified response object if it's annotated with@Header.- Parameters:
o- The response POJO.- Returns:
- Metadata about the specified response object, or
null if it's not annotated with@Header.
-
getResponseMeta
Returns the response bean meta if this method returns aResponse-annotated bean.- Returns:
- The response bean meta or
null if it's not aResponse-annotated bean.
-
getSerializers
Returns the serializers to use for this method.- Returns:
- The serializers to use for this method.
-
getSupportedAcceptTypes
Returns a list of supported accept types.- Returns:
- An unmodifiable list.
-
getSupportedContentTypes
Returns the list of supported content types.- Returns:
- An unmodifiable list.
-
hashCode
-
match
Identifies if this method can process the specified call.To process the call, the following must be true:
- Path pattern must match.
- Matchers (if any) must match.
- Parameters:
session- The call to check.- Returns:
- One of the following values:
0 - Path doesn't match.1 - Path matched but matchers did not.2 - Matches.
-
properties
Description copied from class:ContextReturns the properties on this bean as a map for debugging.- Overrides:
propertiesin classContext- Returns:
- The properties on this bean as a map for debugging.
-