Invocation - the type of PortletInvocation this InvocationHandler handlesRequest - the type of WSRP request this InvocationHandler can translate to from a portlet container requestResponse - the type of WSRP response this InvocationHandler can translate back to portlet container responsespublic abstract class InvocationHandler<Invocation extends org.gatein.pc.api.invocation.PortletInvocation,Request,Response> extends Object
| Modifier and Type | Class and Description |
|---|---|
protected static class |
InvocationHandler.RequestPrecursor<Invocation extends org.gatein.pc.api.invocation.PortletInvocation>
Extracts basic required elements for all invocation requests.
|
| Modifier and Type | Field and Description |
|---|---|
protected WSRPConsumerSPI |
consumer
The consumer owning this handler
|
protected static boolean |
debug |
protected static org.slf4j.Logger |
log |
protected static boolean |
trace |
| Modifier | Constructor and Description |
|---|---|
protected |
InvocationHandler(WSRPConsumerSPI consumer) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract List<Extension> |
getExtensionsFrom(Response response)
Extracts extensions from the response.
|
protected abstract RuntimeContext |
getRuntimeContextFrom(Request request)
Extracts the RuntimeContext from the specific WSRP request.
|
org.gatein.pc.api.invocation.response.PortletInvocationResponse |
handle(Invocation invocation)
Translates a portlet container request into a WSRP request, calls the appropriate WSRP operation and translates the received response back into something the portlet
container can deal with, taking care of any exception, dealing with the ones we can or transforming them into portlet container exceptions when we can't deal with them
ourselves.
|
protected abstract Response |
performRequest(Request request)
Performs the actual specific WSRP call for the specified request.
|
protected Response |
performRequest(Request request,
org.gatein.pc.api.invocation.PortletInvocation invocation)
Attempts to perform the specified request, taking care of setting and updating cookies if required, at most
MAXIMUM_RETRY_NUMBER times to give the consumer the
opportunity to react to specific errors (such as need to invoke initCookie or modifyRegistration) that can sometimes be recovered from. |
protected abstract Request |
prepareRequest(InvocationHandler.RequestPrecursor<Invocation> requestPrecursor,
Invocation invocation)
Created and further prepares the specific requests based on common extracted information from the specified RequestPrecursor and the originating portlet invocation.
|
protected void |
processExtensions(Response response)
Processes extensions, making them available if needed to the
ConsumerExtensionAccessor. |
protected abstract org.gatein.pc.api.invocation.response.PortletInvocationResponse |
processResponse(Response response,
Invocation invocation,
InvocationHandler.RequestPrecursor<Invocation> requestPrecursor)
Converts the WSRP response into a portlet container
PortletInvocationResponse based on its type and on whether other WSRP components need to be informed of potential
changes from the producer. |
protected org.gatein.pc.api.invocation.response.ErrorResponse |
unwrapWSRPError(org.gatein.pc.api.invocation.response.ErrorResponse errorResponse)
Attempts to unwrap nested errors to make them more palatable to users.
|
protected final WSRPConsumerSPI consumer
protected static org.slf4j.Logger log
protected static boolean debug
protected static boolean trace
protected InvocationHandler(WSRPConsumerSPI consumer)
public org.gatein.pc.api.invocation.response.PortletInvocationResponse handle(Invocation invocation) throws org.gatein.pc.api.PortletInvokerException
invocation - the initiating portlet container request that will be transformed into a WSRP requestorg.gatein.pc.api.PortletInvokerExceptionprotected Response performRequest(Request request, org.gatein.pc.api.invocation.PortletInvocation invocation) throws Exception
MAXIMUM_RETRY_NUMBER times to give the consumer the
opportunity to react to specific errors (such as need to invoke initCookie or modifyRegistration) that can sometimes be recovered from.request - the request to performinvocation - the PortletInvocation that initiated the current WSRP requestExceptionprotected org.gatein.pc.api.invocation.response.ErrorResponse unwrapWSRPError(org.gatein.pc.api.invocation.response.ErrorResponse errorResponse)
errorResponse - the error response we're trying to make simplerprotected abstract RuntimeContext getRuntimeContextFrom(Request request)
request - the request to extract a RuntimeContext fromprotected abstract Response performRequest(Request request) throws Exception
request - the WSRP request to performExceptionprotected abstract Request prepareRequest(InvocationHandler.RequestPrecursor<Invocation> requestPrecursor, Invocation invocation)
requestPrecursor - the common extracted information for this requestinvocation - the portlet invocation from which we're trying to perform a WSRP callprotected abstract org.gatein.pc.api.invocation.response.PortletInvocationResponse processResponse(Response response, Invocation invocation, InvocationHandler.RequestPrecursor<Invocation> requestPrecursor) throws org.gatein.pc.api.PortletInvokerException
PortletInvocationResponse based on its type and on whether other WSRP components need to be informed of potential
changes from the producer.response - the original WSRP responseinvocation - the PortletInvocation that triggered the WSRP callrequestPrecursor - the request precursor information we extracted before performing the requestorg.gatein.pc.api.PortletInvokerExceptionprotected abstract List<Extension> getExtensionsFrom(Response response)
response - the WSRP response to extract extensions fromprotected void processExtensions(Response response)
ConsumerExtensionAccessor. Used by subclasses.Copyright © 2006-2014 GateIn. All Rights Reserved.