org.glassfish.jersey.process.internal
Class ResponseProcessor

java.lang.Object
  extended by com.google.common.util.concurrent.AbstractFuture<javax.ws.rs.core.Response>
      extended by org.glassfish.jersey.process.internal.ResponseProcessor
All Implemented Interfaces:
com.google.common.util.concurrent.ListenableFuture<javax.ws.rs.core.Response>, Runnable, Future<javax.ws.rs.core.Response>, RequestInvoker.Callback

public final class ResponseProcessor
extends com.google.common.util.concurrent.AbstractFuture<javax.ws.rs.core.Response>
implements Runnable, RequestInvoker.Callback

Processes result of the request transformation (successful or not). The response processor also represents the ultimate future request-to-response transformation result.

A response processor is invoked when the request-to-response transformation processing is finished. When invoked, the response processor retrieves the transformation result. If the transformation was successful and a response instance is returned, the response processor runs the response instance through the chain of registered response filters and returns a result once finished. In case the request transformation finished with an exception, the response processor tries to map the exception to a response using the registered exception mappers and, if successful, runs the mapped response instance through the chain of registered response filters and returns a result once finished. In case the exception was not mapped to a response, the exception is presented as the ultimate request-to-response transformation result.

Author:
Marek Potociar (marek.potociar at oracle.com)

Nested Class Summary
static class ResponseProcessor.Builder
          Response processor builder that enables "assisted" injection of response processor.
static interface ResponseProcessor.RespondingContext
          Injectable context that can be used during the data processing for registering Stage instances that will be invoked during the response processing.
 
Method Summary
 void failure(Throwable exception)
          Invoked in case of a transformation failure.
 void result(javax.ws.rs.core.Response response)
          Invoked after a successful request transformation.
 void run()
           
 
Methods inherited from class com.google.common.util.concurrent.AbstractFuture
addListener, cancel, get, get, interruptTask, isCancelled, isDone, set, setException
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

run

public void run()
Specified by:
run in interface Runnable

result

public void result(javax.ws.rs.core.Response response)
Description copied from interface: RequestInvoker.Callback
Invoked after a successful request transformation.

Specified by:
result in interface RequestInvoker.Callback
Parameters:
response - request transformation result.

failure

public void failure(Throwable exception)
Description copied from interface: RequestInvoker.Callback
Invoked in case of a transformation failure.

Specified by:
failure in interface RequestInvoker.Callback
Parameters:
exception - exception describing the failure.


Copyright © 2007-2012 Oracle Corporation. All Rights Reserved. Use is subject to license terms.