abstract class InterceptorExecutor<T> extends java.lang.Object implements javax.ws.rs.ext.InterceptorContext, PropertiesDelegate
InterceptorContext
which is common for ReaderInterceptorContext
and WriterInterceptorContext
implementations.Modifier and Type | Class and Description |
---|---|
private static class |
InterceptorExecutor.InterceptorTimestampPair<T>
Holder of interceptor instance and timestamp of the interceptor invocation (in ns).
|
Modifier and Type | Field and Description |
---|---|
private java.lang.annotation.Annotation[] |
annotations |
private java.lang.reflect.Type |
genericType |
private InterceptorExecutor.InterceptorTimestampPair<T> |
lastTracedInterceptor |
private javax.ws.rs.core.MediaType |
mediaType |
private PropertiesDelegate |
propertiesDelegate |
private TracingLogger |
tracingLogger |
private java.lang.Class<?> |
type |
Constructor and Description |
---|
InterceptorExecutor(java.lang.Class<?> rawType,
java.lang.reflect.Type type,
java.lang.annotation.Annotation[] annotations,
javax.ws.rs.core.MediaType mediaType,
PropertiesDelegate propertiesDelegate)
Constructor initializes common properties of this abstract class.
|
Modifier and Type | Method and Description |
---|---|
protected void |
clearLastTracedInterceptor()
Clear last traced interceptor information.
|
java.lang.annotation.Annotation[] |
getAnnotations() |
java.lang.reflect.Type |
getGenericType() |
javax.ws.rs.core.MediaType |
getMediaType() |
java.lang.Object |
getProperty(java.lang.String name)
Returns the property with the given name registered in the current request/response
exchange context, or
null if there is no property by that name. |
java.util.Collection<java.lang.String> |
getPropertyNames()
Returns an immutable
collection containing the property
names available within the context of the current request/response exchange context. |
protected TracingLogger |
getTracingLogger()
Get tracing logger instance configured in via properties.
|
java.lang.Class |
getType() |
void |
removeProperty(java.lang.String name)
Removes a property with the given name from the current request/response
exchange context.
|
void |
setAnnotations(java.lang.annotation.Annotation[] annotations) |
void |
setGenericType(java.lang.reflect.Type genericType) |
void |
setMediaType(javax.ws.rs.core.MediaType mediaType) |
void |
setProperty(java.lang.String name,
java.lang.Object object)
Binds an object to a given property name in the current request/response
exchange context.
|
void |
setType(java.lang.Class type) |
protected void |
traceAfter(T interceptor,
TracingLogger.Event event)
Tracing support - log invocation of interceptor AFTER context.proceed() call.
|
protected void |
traceBefore(T interceptor,
TracingLogger.Event event)
Tracing support - log invocation of interceptor BEFORE context.proceed() call.
|
private final PropertiesDelegate propertiesDelegate
private java.lang.annotation.Annotation[] annotations
private java.lang.Class<?> type
private java.lang.reflect.Type genericType
private javax.ws.rs.core.MediaType mediaType
private final TracingLogger tracingLogger
private InterceptorExecutor.InterceptorTimestampPair<T> lastTracedInterceptor
public InterceptorExecutor(java.lang.Class<?> rawType, java.lang.reflect.Type type, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, PropertiesDelegate propertiesDelegate)
rawType
- raw Java entity type.type
- generic Java entity type.annotations
- Annotations on the formal declaration of the resource
method parameter that is the target of the message body
conversion. See InterceptorContext.getAnnotations()
.mediaType
- MediaType of HTTP entity. See InterceptorContext.getMediaType()
.propertiesDelegate
- request-scoped properties delegate.public java.lang.Object getProperty(java.lang.String name)
PropertiesDelegate
null
if there is no property by that name.
A property allows a JAX-RS filters and interceptors to exchange additional custom information not already provided by this interface.
A list of supported properties can be retrieved using PropertiesDelegate.getPropertyNames()
.
Custom property names should follow the same convention as package names.
getProperty
in interface javax.ws.rs.ext.InterceptorContext
getProperty
in interface PropertiesDelegate
name
- a String
specifying the name of the property.Object
containing the value of the property, or
null
if no property exists matching the given name.PropertiesDelegate.getPropertyNames()
public java.util.Collection<java.lang.String> getPropertyNames()
PropertiesDelegate
collection
containing the property
names available within the context of the current request/response exchange context.
Use the PropertiesDelegate.getProperty(java.lang.String)
method with a property name to get the value of
a property.
getPropertyNames
in interface javax.ws.rs.ext.InterceptorContext
getPropertyNames
in interface PropertiesDelegate
collection
of property names.PropertiesDelegate.getProperty(java.lang.String)
public void setProperty(java.lang.String name, java.lang.Object object)
PropertiesDelegate
A property allows a JAX-RS filters and interceptors to exchange additional custom information not already provided by this interface.
A list of supported properties can be retrieved using PropertiesDelegate.getPropertyNames()
.
Custom property names should follow the same convention as package names.
If a null
value is passed, the effect is the same as calling the
PropertiesDelegate.removeProperty(String)
method.
setProperty
in interface javax.ws.rs.ext.InterceptorContext
setProperty
in interface PropertiesDelegate
name
- a String
specifying the name of the property.object
- an Object
representing the property to be bound.public void removeProperty(java.lang.String name)
PropertiesDelegate
PropertiesDelegate.getProperty(java.lang.String)
to retrieve the property value will return null
.removeProperty
in interface javax.ws.rs.ext.InterceptorContext
removeProperty
in interface PropertiesDelegate
name
- a String
specifying the name of the property to be removed.protected final TracingLogger getTracingLogger()
protected final void traceBefore(T interceptor, TracingLogger.Event event)
interceptor
- invoked interceptorevent
- event type to be testedprotected final void traceAfter(T interceptor, TracingLogger.Event event)
interceptor
- invoked interceptorevent
- event type to be testedprotected final void clearLastTracedInterceptor()
public java.lang.annotation.Annotation[] getAnnotations()
getAnnotations
in interface javax.ws.rs.ext.InterceptorContext
public void setAnnotations(java.lang.annotation.Annotation[] annotations)
setAnnotations
in interface javax.ws.rs.ext.InterceptorContext
public java.lang.Class getType()
getType
in interface javax.ws.rs.ext.InterceptorContext
public void setType(java.lang.Class type)
setType
in interface javax.ws.rs.ext.InterceptorContext
public java.lang.reflect.Type getGenericType()
getGenericType
in interface javax.ws.rs.ext.InterceptorContext
public void setGenericType(java.lang.reflect.Type genericType)
setGenericType
in interface javax.ws.rs.ext.InterceptorContext
public javax.ws.rs.core.MediaType getMediaType()
getMediaType
in interface javax.ws.rs.ext.InterceptorContext
public void setMediaType(javax.ws.rs.core.MediaType mediaType)
setMediaType
in interface javax.ws.rs.ext.InterceptorContext