Package org.jboss.resteasy.core
Class AbstractAsynchronousResponse
- java.lang.Object
-
- org.jboss.resteasy.core.AbstractAsynchronousResponse
-
- All Implemented Interfaces:
AsyncResponse,ResourceMethodInvokerAwareResponse,ResteasyAsynchronousResponse
- Direct Known Subclasses:
SynchronousExecutionContext.SynchronousAsynchronousResponse
public abstract class AbstractAsynchronousResponse extends Object implements ResteasyAsynchronousResponse, ResourceMethodInvokerAwareResponse
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
-
Field Summary
Fields Modifier and Type Field Description protected Annotation[]annotationsprotected AsyncWriterInterceptor[]asyncWriterInterceptorsprotected List<CompletionCallback>completionCallbacksprotected Map<Class<?>,Object>contextDataMapprotected SynchronousDispatcherdispatcherprotected ResourceMethodInvokermethodprotected HttpRequestrequestprotected HttpResponseresponseprotected ContainerResponseFilter[]responseFiltersprotected TimeoutHandlertimeoutHandlerprotected WriterInterceptor[]writerInterceptors-
Fields inherited from interface jakarta.ws.rs.container.AsyncResponse
NO_TIMEOUT
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractAsynchronousResponse(SynchronousDispatcher dispatcher, HttpRequest request, HttpResponse response)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidcompletionCallbacks(Throwable throwable)Annotation[]getAnnotations()AsyncWriterInterceptor[]getAsyncWriterInterceptors()ResourceMethodInvokergetMethod()ContainerResponseFilter[]getResponseFilters()WriterInterceptor[]getWriterInterceptors()protected booleaninternalResume(Object entity)Deprecated.protected booleaninternalResume(Object entity, Consumer<Throwable> onComplete)protected booleaninternalResume(Throwable exc)Deprecated.protected booleaninternalResume(Throwable exc, Consumer<Throwable> onComplete)Collection<Class<?>>register(Class<?> callback)Register an asynchronous processing lifecycle callback class to receive lifecycle events for the asynchronous response based on the implemented callback interfaces.Map<Class<?>,Collection<Class<?>>>register(Class<?> callback, Class<?>... callbacks)Register asynchronous processing lifecycle callback classes to receive lifecycle events for the asynchronous response based on the implemented callback interfaces.Collection<Class<?>>register(Object callback)Register an asynchronous processing lifecycle callback instance to receive lifecycle events for the asynchronous response based on the implemented callback interfaces.Map<Class<?>,Collection<Class<?>>>register(Object callback, Object... callbacks)Register an asynchronous processing lifecycle callback instances to receive lifecycle events for the asynchronous response based on the implemented callback interfaces.voidsetAnnotations(Annotation[] annotations)voidsetMethod(ResourceMethodInvoker method)voidsetResponseFilters(ContainerResponseFilter[] responseFilters)voidsetTimeoutHandler(TimeoutHandler handler)Set/replace a time-out handler for the suspended asynchronous response.voidsetWriterInterceptors(WriterInterceptor[] writerInterceptors)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jakarta.ws.rs.container.AsyncResponse
cancel, cancel, cancel, isCancelled, isDone, isSuspended, resume, resume, setTimeout
-
Methods inherited from interface org.jboss.resteasy.spi.ResteasyAsynchronousResponse
complete, initialRequestThreadFinished
-
-
-
-
Field Detail
-
dispatcher
protected SynchronousDispatcher dispatcher
-
method
protected ResourceMethodInvoker method
-
request
protected HttpRequest request
-
response
protected HttpResponse response
-
responseFilters
protected ContainerResponseFilter[] responseFilters
-
writerInterceptors
protected WriterInterceptor[] writerInterceptors
-
asyncWriterInterceptors
protected AsyncWriterInterceptor[] asyncWriterInterceptors
-
annotations
protected Annotation[] annotations
-
timeoutHandler
protected TimeoutHandler timeoutHandler
-
completionCallbacks
protected List<CompletionCallback> completionCallbacks
-
-
Constructor Detail
-
AbstractAsynchronousResponse
protected AbstractAsynchronousResponse(SynchronousDispatcher dispatcher, HttpRequest request, HttpResponse response)
-
-
Method Detail
-
register
public Collection<Class<?>> register(Class<?> callback) throws NullPointerException
Description copied from interface:AsyncResponseRegister an asynchronous processing lifecycle callback class to receive lifecycle events for the asynchronous response based on the implemented callback interfaces.- Specified by:
registerin interfaceAsyncResponse- Parameters:
callback- callback class.- Returns:
- collection of registered callback interfaces. If the callback class does not implement any recognized callback interfaces, the returned collection will be empty.
- Throws:
NullPointerException- in case the callback class isnull.
-
register
public Collection<Class<?>> register(Object callback) throws NullPointerException
Description copied from interface:AsyncResponseRegister an asynchronous processing lifecycle callback instance to receive lifecycle events for the asynchronous response based on the implemented callback interfaces.- Specified by:
registerin interfaceAsyncResponse- Parameters:
callback- callback instance implementing one or more of the recognized callback interfaces.- Returns:
- collection of registered callback interfaces. If the callback class does not implement any recognized callback interfaces, the returned collection will be empty.
- Throws:
NullPointerException- in case the callback instance isnull.
-
register
public Map<Class<?>,Collection<Class<?>>> register(Class<?> callback, Class<?>... callbacks) throws NullPointerException
Description copied from interface:AsyncResponseRegister asynchronous processing lifecycle callback classes to receive lifecycle events for the asynchronous response based on the implemented callback interfaces.- Specified by:
registerin interfaceAsyncResponse- Parameters:
callback- callback class.callbacks- additional callback classes.- Returns:
- map of registered classes and the callback interfaces registered for each class. If a callback class does not implement any recognized callback interfaces, the associated collection of registered interfaces for the class will be empty.
- Throws:
NullPointerException- in case any of the callback classes isnull.
-
register
public Map<Class<?>,Collection<Class<?>>> register(Object callback, Object... callbacks) throws NullPointerException
Description copied from interface:AsyncResponseRegister an asynchronous processing lifecycle callback instances to receive lifecycle events for the asynchronous response based on the implemented callback interfaces.- Specified by:
registerin interfaceAsyncResponse- Parameters:
callback- callback instance.callbacks- additional callback instances.- Returns:
- map of registered classes and the callback interfaces registered for each class. If a callback class does not implement any recognized callback interfaces, the associated collection of registered interfaces for the class will be empty.
- Throws:
NullPointerException- in case any of the callback instances isnull.
-
setTimeoutHandler
public void setTimeoutHandler(TimeoutHandler handler)
Description copied from interface:AsyncResponseSet/replace a time-out handler for the suspended asynchronous response.The time-out handler will be invoked when the suspend period of this asynchronous response times out. The job of the time-out handler is to resolve the time-out situation by either
- resuming the suspended response
- cancelling the suspended response
- extending the suspend period by setting a new suspend time-out
Note that in case the response is suspended
indefinitely, the time-out handler may never be invoked.- Specified by:
setTimeoutHandlerin interfaceAsyncResponse- Parameters:
handler- response time-out handler.
-
getMethod
public ResourceMethodInvoker getMethod()
- Specified by:
getMethodin interfaceResourceMethodInvokerAwareResponse
-
setMethod
public void setMethod(ResourceMethodInvoker method)
- Specified by:
setMethodin interfaceResourceMethodInvokerAwareResponse
-
getResponseFilters
public ContainerResponseFilter[] getResponseFilters()
- Specified by:
getResponseFiltersin interfaceResteasyAsynchronousResponse
-
setResponseFilters
public void setResponseFilters(ContainerResponseFilter[] responseFilters)
- Specified by:
setResponseFiltersin interfaceResteasyAsynchronousResponse
-
getWriterInterceptors
public WriterInterceptor[] getWriterInterceptors()
- Specified by:
getWriterInterceptorsin interfaceResteasyAsynchronousResponse
-
setWriterInterceptors
public void setWriterInterceptors(WriterInterceptor[] writerInterceptors)
- Specified by:
setWriterInterceptorsin interfaceResteasyAsynchronousResponse
-
getAsyncWriterInterceptors
public AsyncWriterInterceptor[] getAsyncWriterInterceptors()
- Specified by:
getAsyncWriterInterceptorsin interfaceResteasyAsynchronousResponse
-
getAnnotations
public Annotation[] getAnnotations()
- Specified by:
getAnnotationsin interfaceResteasyAsynchronousResponse
-
setAnnotations
public void setAnnotations(Annotation[] annotations)
- Specified by:
setAnnotationsin interfaceResteasyAsynchronousResponse
-
completionCallbacks
public void completionCallbacks(Throwable throwable)
- Specified by:
completionCallbacksin interfaceResteasyAsynchronousResponse
-
internalResume
@Deprecated protected boolean internalResume(Object entity)
Deprecated.
-
internalResume
@Deprecated protected boolean internalResume(Throwable exc)
Deprecated.
-
-