Package org.apache.cxf.endpoint
Class ClientImpl
- java.lang.Object
- 
- org.apache.cxf.interceptor.AbstractBasicInterceptorProvider
- 
- org.apache.cxf.endpoint.ClientImpl
 
 
- 
- All Implemented Interfaces:
- AutoCloseable,- Client,- ConduitSelectorHolder,- Retryable,- InterceptorProvider,- MessageObserver
 
 public class ClientImpl extends AbstractBasicInterceptorProvider implements Client, Retryable, MessageObserver 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description classClientImpl.EchoContextclassClientImpl.IllegalEmptyResponseException- 
Nested classes/interfaces inherited from interface org.apache.cxf.endpoint.ClientClient.Contexts
 
- 
 - 
Field SummaryFields Modifier and Type Field Description protected Busbusprotected ConduitSelectorconduitSelectorprotected Map<String,Object>currentRequestContextprotected Executorexecutorstatic StringFINISHEDprotected PhaseChainCacheinboundChainCacheprotected ThreadlatestContextThreadprotected PhaseChainCacheoutboundChainCacheprotected ClientOutFaultObserveroutFaultObserverprotected Map<Thread,ClientImpl.EchoContext>requestContextprotected Map<Thread,org.apache.cxf.endpoint.ClientImpl.ResponseContext>responseContextstatic StringSYNC_TIMEOUTWhen a synchronous request/response invoke is done using an asynchronous transport mechanism, this is the timeout used for waiting for the response.protected intsynchronousTimeoutstatic StringTHREAD_LOCAL_REQUEST_CONTEXT- 
Fields inherited from interface org.apache.cxf.endpoint.ClientKEEP_CONDUIT_ALIVE, REQUEST_CONTEXT, RESPONSE_CONTEXT
 
- 
 - 
Constructor SummaryConstructors Constructor Description ClientImpl(Bus b, Endpoint e)ClientImpl(Bus b, Endpoint e, ConduitSelector sc)ClientImpl(Bus b, Endpoint e, Conduit c)ClientImpl(Bus bus, Service svc, QName port, EndpointImplFactory endpointImplFactory)Create a Client that uses a specific EndpointImpl.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voiddestroy()Indicates that the client is no longer needed and that any resources it holds can now be freed.BusgetBus()Retrieves the Bus that was used to create the ClientConduitgetConduit()Get the Conduit that messages for this client will be sent on.ConduitSelectorgetConduitSelector()Get the ConduitSelector responsible for retreiving the Conduit.protected ConduitSelectorgetConduitSelector(ConduitSelector override)Client.ContextsgetContexts()EndpointgetEndpoint()protected ExceptiongetException(Exchange exchange)Map<String,Object>getRequestContext()Gets the request context used for future invocationsMap<String,Object>getResponseContext()Gets the response context from the last invocation on this threadintgetSynchronousTimeout()Object[]invoke(String operationName, Object... params)Invokes an operation synchronouslyObject[]invoke(QName operationName, Object... params)Invokes an operation synchronouslyvoidinvoke(ClientCallback callback, String operationName, Object... params)Invokes an operation asynchronouslyvoidinvoke(ClientCallback callback, QName operationName, Object... params)Invokes an operation asynchronouslyvoidinvoke(ClientCallback callback, BindingOperationInfo oi, Object... params)Invokes an operation asynchronouslyvoidinvoke(ClientCallback callback, BindingOperationInfo oi, Object[] params, Map<String,Object> context)Invokes an operation asynchronouslyvoidinvoke(ClientCallback callback, BindingOperationInfo oi, Object[] params, Map<String,Object> context, Exchange exchange)Invokes an operation asynchronouslyvoidinvoke(ClientCallback callback, BindingOperationInfo oi, Object[] params, Exchange exchange)Invokes an operation asynchronouslyObject[]invoke(BindingOperationInfo oi, Object... params)Invokes an operation synchronouslyObject[]invoke(BindingOperationInfo oi, Object[] params, Map<String,Object> context)Invokes an operation synchronouslyObject[]invoke(BindingOperationInfo oi, Object[] params, Map<String,Object> context, Exchange exchange)Invokes an operation synchronouslyObject[]invoke(BindingOperationInfo oi, Object[] params, Exchange exchange)Object[]invokeWrapped(String operationName, Object... params)Invokes an operation synchronouslyObject[]invokeWrapped(QName operationName, Object... params)Invokes an operation synchronouslyvoidinvokeWrapped(ClientCallback callback, String operationName, Object... params)Invokes an operation asynchronouslyvoidinvokeWrapped(ClientCallback callback, QName operationName, Object... params)Invokes an operation asynchronouslybooleanisThreadLocalRequestContext()Checks if the Request context is thread local or global.protected voidmodifyChain(InterceptorChain chain, Message ctx, boolean in)protected voidmodifyOnewayChain(InterceptorChain chain, Message ctx)protected voidonewayOnly(Exchange exhange)voidonMessage(Message message)Called for an incoming message, i.e.protected voidprepareConduitSelector(Message message)protected Object[]processResult(Message message, Exchange exchange, BindingOperationInfo oi, Map<String,Object> resContext)voidreleaseThreadContexts()voidsetConduitSelector(ConduitSelector selector)Set the ConduitSelector responsible for retreiving the Conduit.protected voidsetContext(Map<String,Object> ctx, Message message)protected voidsetEndpoint(Endpoint e)protected voidsetExchangeProperties(Exchange exchange, Endpoint endpoint, BindingOperationInfo boi)voidsetExecutor(Executor executor)Sets the executor which is used to process Asynchronous responses.protected voidsetOutMessageProperties(Message message, BindingOperationInfo boi)protected voidsetParameters(Object[] params, Message message)protected Map<String,Object>setResponseContext(Map<String,Object> ctx)voidsetSynchronousTimeout(int synchronousTimeout)voidsetThreadLocalRequestContext(boolean b)Sets whether the request context is thread local or global to this client.protected PhaseInterceptorChainsetupInterceptorChain(Endpoint endpoint)protected voidwaitResponse(Exchange exchange)- 
Methods inherited from class org.apache.cxf.interceptor.AbstractBasicInterceptorProvidergetInFaultInterceptors, getInInterceptors, getOutFaultInterceptors, getOutInterceptors, setInFaultInterceptors, setInInterceptors, setOutFaultInterceptors, setOutInterceptors
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.apache.cxf.interceptor.InterceptorProvidergetInFaultInterceptors, getInInterceptors, getOutFaultInterceptors, getOutInterceptors
 
- 
 
- 
- 
- 
Field Detail- 
THREAD_LOCAL_REQUEST_CONTEXTpublic static final String THREAD_LOCAL_REQUEST_CONTEXT - See Also:
- Constant Field Values
 
 - 
SYNC_TIMEOUTpublic static final String SYNC_TIMEOUT When a synchronous request/response invoke is done using an asynchronous transport mechanism, this is the timeout used for waiting for the response. Default is 60 seconds.- See Also:
- Constant Field Values
 
 - 
FINISHEDpublic static final String FINISHED - See Also:
- Constant Field Values
 
 - 
busprotected Bus bus 
 - 
conduitSelectorprotected ConduitSelector conduitSelector 
 - 
outFaultObserverprotected ClientOutFaultObserver outFaultObserver 
 - 
synchronousTimeoutprotected int synchronousTimeout 
 - 
outboundChainCacheprotected PhaseChainCache outboundChainCache 
 - 
inboundChainCacheprotected PhaseChainCache inboundChainCache 
 - 
latestContextThreadprotected Thread latestContextThread 
 - 
requestContextprotected Map<Thread,ClientImpl.EchoContext> requestContext 
 - 
responseContextprotected Map<Thread,org.apache.cxf.endpoint.ClientImpl.ResponseContext> responseContext 
 - 
executorprotected Executor executor 
 
- 
 - 
Constructor Detail- 
ClientImplpublic ClientImpl(Bus b, Endpoint e, ConduitSelector sc) 
 - 
ClientImplpublic ClientImpl(Bus bus, Service svc, QName port, EndpointImplFactory endpointImplFactory) Create a Client that uses a specific EndpointImpl.- Parameters:
- bus-
- svc-
- port-
- endpointImplFactory-
 
 
- 
 - 
Method Detail- 
getBuspublic Bus getBus() Description copied from interface:ClientRetrieves the Bus that was used to create the Client
 - 
destroypublic void destroy() Description copied from interface:ClientIndicates that the client is no longer needed and that any resources it holds can now be freed.
 - 
getEndpointpublic Endpoint getEndpoint() - Specified by:
- getEndpointin interface- Client
 
 - 
releaseThreadContextspublic void releaseThreadContexts() 
 - 
getContextspublic Client.Contexts getContexts() - Specified by:
- getContextsin interface- Client
 
 - 
getRequestContextpublic Map<String,Object> getRequestContext() Description copied from interface:ClientGets the request context used for future invocations- Specified by:
- getRequestContextin interface- Client
- Returns:
- context The context
 
 - 
getResponseContextpublic Map<String,Object> getResponseContext() Description copied from interface:ClientGets the response context from the last invocation on this thread- Specified by:
- getResponseContextin interface- Client
- Returns:
- context The context
 
 - 
isThreadLocalRequestContextpublic boolean isThreadLocalRequestContext() Description copied from interface:ClientChecks if the Request context is thread local or global.- Specified by:
- isThreadLocalRequestContextin interface- Client
- Returns:
- true if the request context is a thread local
 
 - 
setThreadLocalRequestContextpublic void setThreadLocalRequestContext(boolean b) Description copied from interface:ClientSets whether the request context is thread local or global to this client. By default, the request context is "global" in that any values set in the context are seen by all threads using this client. If set to true, the context is changed to be a ThreadLocal and values set are not seen by other threads.- Specified by:
- setThreadLocalRequestContextin interface- Client
 
 - 
invokepublic Object[] invoke(BindingOperationInfo oi, Object... params) throws Exception Description copied from interface:ClientInvokes an operation synchronously
 - 
invokepublic Object[] invoke(String operationName, Object... params) throws Exception Description copied from interface:ClientInvokes an operation synchronously- Specified by:
- invokein interface- Client
- Parameters:
- operationName- The name of the operation to be invoked. The service namespace will be used when looking up the BindingOperationInfo.
- params- The params that matches the parts of the input message of the operation. If the BindingOperationInfo supports unwrapping, it assumes the params are in the "unwrapped" form. If params are in the wrapped form, use invokeWrapped
- Returns:
- The return values that matche the parts of the output message of the operation
- Throws:
- Exception
 
 - 
invokepublic Object[] invoke(QName operationName, Object... params) throws Exception Description copied from interface:ClientInvokes an operation synchronously- Specified by:
- invokein interface- Client
- Parameters:
- operationName- The name of the operation to be invoked
- params- The params that matches the parts of the input message of the operation. If the BindingOperationInfo supports unwrapping, it assumes the params are in the "unwrapped" form. If params are in the wrapped form, use invokeWrapped
- Returns:
- The return values that matche the parts of the output message of the operation
- Throws:
- Exception
 
 - 
invokeWrappedpublic Object[] invokeWrapped(String operationName, Object... params) throws Exception Description copied from interface:ClientInvokes an operation synchronously- Specified by:
- invokeWrappedin interface- Client
- Parameters:
- operationName- The name of the operation to be invoked. The service namespace will be used when looking up the BindingOperationInfo.
- params- The params that matches the parts of the input message of the operation
- Returns:
- The return values that matche the parts of the output message of the operation
- Throws:
- Exception
 
 - 
invokeWrappedpublic Object[] invokeWrapped(QName operationName, Object... params) throws Exception Description copied from interface:ClientInvokes an operation synchronously- Specified by:
- invokeWrappedin interface- Client
- Parameters:
- operationName- The name of the operation to be invoked
- params- The params that matches the parts of the input message of the operation
- Returns:
- The return values that matche the parts of the output message of the operation
- Throws:
- Exception
 
 - 
invokepublic Object[] invoke(BindingOperationInfo oi, Object[] params, Exchange exchange) throws Exception - Throws:
- Exception
 
 - 
invokepublic Object[] invoke(BindingOperationInfo oi, Object[] params, Map<String,Object> context) throws Exception Description copied from interface:ClientInvokes an operation synchronously- Specified by:
- invokein interface- Client
- Parameters:
- oi- The operation to be invoked
- params- The params that matches the parts of the input message of the operation
- context- Optional (can be null) contextual information for the invocation
- Returns:
- The return values that matche the parts of the output message of the operation
- Throws:
- Exception
 
 - 
invokepublic void invoke(ClientCallback callback, String operationName, Object... params) throws Exception Description copied from interface:ClientInvokes an operation asynchronously- Specified by:
- invokein interface- Client
- Parameters:
- callback- The callback that is called when the response is ready
- operationName- The name of the operation to be invoked. The service namespace will be used when looking up the BindingOperationInfo.
- params- The params that matches the parts of the input message of the operation. If the BindingOperationInfo supports unwrapping, it assumes the params are in the "unwrapped" form. If params are in the wrapped form, use invokeWrapped
- Throws:
- Exception
 
 - 
invokepublic void invoke(ClientCallback callback, QName operationName, Object... params) throws Exception Description copied from interface:ClientInvokes an operation asynchronously- Specified by:
- invokein interface- Client
- Parameters:
- callback- The callback that is called when the response is ready
- operationName- The name of the operation to be invoked
- params- The params that matches the parts of the input message of the operation. If the BindingOperationInfo supports unwrapping, it assumes the params are in the "unwrapped" form. If params are in the wrapped form, use invokeWrapped
- Throws:
- Exception
 
 - 
invokeWrappedpublic void invokeWrapped(ClientCallback callback, String operationName, Object... params) throws Exception Description copied from interface:ClientInvokes an operation asynchronously- Specified by:
- invokeWrappedin interface- Client
- Parameters:
- callback- The callback that is called when the response is ready
- operationName- The name of the operation to be invoked. The service namespace will be used when looking up the BindingOperationInfo.
- params- The params that matches the parts of the input message of the operation
- Throws:
- Exception
 
 - 
invokeWrappedpublic void invokeWrapped(ClientCallback callback, QName operationName, Object... params) throws Exception Description copied from interface:ClientInvokes an operation asynchronously- Specified by:
- invokeWrappedin interface- Client
- Parameters:
- callback- The callback that is called when the response is ready
- operationName- The name of the operation to be invoked
- params- The params that matches the parts of the input message of the operation
- Throws:
- Exception
 
 - 
invokepublic void invoke(ClientCallback callback, BindingOperationInfo oi, Object... params) throws Exception Description copied from interface:ClientInvokes an operation asynchronously
 - 
invokepublic void invoke(ClientCallback callback, BindingOperationInfo oi, Object[] params, Map<String,Object> context) throws Exception Description copied from interface:ClientInvokes an operation asynchronously- Specified by:
- invokein interface- Client
- Parameters:
- callback- The callback that is called when the response is ready
- oi- The operation to be invoked
- params- The params that matches the parts of the input message of the operation
- context- contextual information for the invocation
- Throws:
- Exception
 
 - 
invokepublic void invoke(ClientCallback callback, BindingOperationInfo oi, Object[] params, Exchange exchange) throws Exception Description copied from interface:ClientInvokes an operation asynchronously- Specified by:
- invokein interface- Client
- Parameters:
- callback- The callback that is called when the response is ready
- oi- The operation to be invoked
- params- The params that matches the parts of the input message of the operation
- exchange- The Exchange to be used for the invocation
- Throws:
- Exception
 
 - 
invokepublic void invoke(ClientCallback callback, BindingOperationInfo oi, Object[] params, Map<String,Object> context, Exchange exchange) throws Exception Description copied from interface:ClientInvokes an operation asynchronously- Specified by:
- invokein interface- Client
- Parameters:
- callback- The callback that is called when the response is ready
- oi- The operation to be invoked
- params- The params that matches the parts of the input message of the operation
- context- Optional (can be null) contextual information for the invocation
- exchange- Optional (can be null) The Exchange to be used for the invocation
- Throws:
- Exception
 
 - 
invokepublic Object[] invoke(BindingOperationInfo oi, Object[] params, Map<String,Object> context, Exchange exchange) throws Exception Description copied from interface:ClientInvokes an operation synchronously- Specified by:
- invokein interface- Client
- Specified by:
- invokein interface- Retryable
- Parameters:
- oi- The operation to be invoked
- params- The params that matches the parts of the input message of the operation
- context- Optional (can be null) contextual information for the invocation
- exchange- The Exchange to be used for the invocation
- Returns:
- The return values that matche the parts of the output message of the operation
- Throws:
- Exception
 
 - 
processResultprotected Object[] processResult(Message message, Exchange exchange, BindingOperationInfo oi, Map<String,Object> resContext) throws Exception - Throws:
- Exception
 
 - 
onewayOnlyprotected void onewayOnly(Exchange exhange) 
 - 
waitResponseprotected void waitResponse(Exchange exchange) throws IOException - Throws:
- IOException
 
 - 
onMessagepublic void onMessage(Message message) Description copied from interface:MessageObserverCalled for an incoming message, i.e. where the content format(s) is/are source(s).- Specified by:
- onMessagein interface- MessageObserver
 
 - 
getConduitpublic Conduit getConduit() Description copied from interface:ClientGet the Conduit that messages for this client will be sent on.- Specified by:
- getConduitin interface- Client
- Returns:
- Conduit
 
 - 
prepareConduitSelectorprotected void prepareConduitSelector(Message message) 
 - 
setOutMessagePropertiesprotected void setOutMessageProperties(Message message, BindingOperationInfo boi) 
 - 
setExchangePropertiesprotected void setExchangeProperties(Exchange exchange, Endpoint endpoint, BindingOperationInfo boi) 
 - 
setupInterceptorChainprotected PhaseInterceptorChain setupInterceptorChain(Endpoint endpoint) 
 - 
modifyChainprotected void modifyChain(InterceptorChain chain, Message ctx, boolean in) 
 - 
modifyOnewayChainprotected void modifyOnewayChain(InterceptorChain chain, Message ctx) 
 - 
setEndpointprotected void setEndpoint(Endpoint e) 
 - 
getSynchronousTimeoutpublic int getSynchronousTimeout() 
 - 
setSynchronousTimeoutpublic void setSynchronousTimeout(int synchronousTimeout) 
 - 
getConduitSelectorpublic final ConduitSelector getConduitSelector() Description copied from interface:ClientGet the ConduitSelector responsible for retreiving the Conduit.- Specified by:
- getConduitSelectorin interface- Client
- Specified by:
- getConduitSelectorin interface- ConduitSelectorHolder
- Returns:
- the current ConduitSelector
 
 - 
getConduitSelectorprotected final ConduitSelector getConduitSelector(ConduitSelector override) 
 - 
setConduitSelectorpublic final void setConduitSelector(ConduitSelector selector) Description copied from interface:ClientSet the ConduitSelector responsible for retreiving the Conduit.- Specified by:
- setConduitSelectorin interface- Client
- Specified by:
- setConduitSelectorin interface- ConduitSelectorHolder
- Parameters:
- selector- the ConduitSelector to use
 
 - 
closepublic void close() throws Exception- Specified by:
- closein interface- AutoCloseable
- Throws:
- Exception
 
 - 
setExecutorpublic void setExecutor(Executor executor) Description copied from interface:ClientSets the executor which is used to process Asynchronous responses. The default is to use the threads provided by the transport. (example: the JMS listener threads)- Specified by:
- setExecutorin interface- Client
 
 
- 
 
-