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 Summary
Nested ClassesModifier and TypeClassDescriptionclassclassNested classes/interfaces inherited from interface org.apache.cxf.endpoint.Client
Client.Contexts -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Busprotected ConduitSelectorprotected Executorstatic final Stringprotected PhaseChainCacheprotected Threadprotected PhaseChainCacheprotected ClientOutFaultObserverprotected Map<Thread,ClientImpl.EchoContext> static final StringWhen a synchronous request/response invoke is done using an asynchronous transport mechanism, this is the timeout used for waiting for the response.protected intstatic final StringFields inherited from interface org.apache.cxf.endpoint.Client
KEEP_CONDUIT_ALIVE, REQUEST_CONTEXT, RESPONSE_CONTEXT -
Constructor Summary
ConstructorsConstructorDescriptionClientImpl(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 Summary
Modifier and TypeMethodDescriptionvoidclose()voiddestroy()Indicates that the client is no longer needed and that any resources it holds can now be freed.getBus()Retrieves the Bus that was used to create the ClientGet the Conduit that messages for this client will be sent on.final ConduitSelectorGet the ConduitSelector responsible for retreiving the Conduit.protected final ConduitSelectorgetConduitSelector(ConduitSelector override) protected ExceptiongetException(Exchange exchange) Gets the request context used for future invocationsGets the response context from the last invocation on this threadintObject[]Invokes an operation synchronouslyObject[]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[]Invokes an operation synchronouslyObject[]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 asynchronouslybooleanChecks 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) voidCalled for an incoming message, i.e.protected voidprepareConduitSelector(Message message) protected Object[]processResult(Message message, Exchange exchange, BindingOperationInfo oi, Map<String, Object> resContext) voidfinal voidsetConduitSelector(ConduitSelector selector) Set the ConduitSelector responsible for retreiving the Conduit.protected voidsetContext(Map<String, Object> ctx, Message message) protected voidprotected 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) 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.AbstractBasicInterceptorProvider
getInFaultInterceptors, getInInterceptors, getOutFaultInterceptors, getOutInterceptors, setInFaultInterceptors, setInInterceptors, setOutFaultInterceptors, setOutInterceptorsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.cxf.interceptor.InterceptorProvider
getInFaultInterceptors, getInInterceptors, getOutFaultInterceptors, getOutInterceptors
-
Field Details
-
THREAD_LOCAL_REQUEST_CONTEXT
- See Also:
-
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:
-
FINISHED
- See Also:
-
bus
-
conduitSelector
-
outFaultObserver
-
synchronousTimeout
protected int synchronousTimeout -
outboundChainCache
-
inboundChainCache
-
currentRequestContext
-
latestContextThread
-
requestContext
-
responseContext
-
executor
-
-
Constructor Details
-
ClientImpl
-
ClientImpl
-
ClientImpl
-
ClientImpl
Create a Client that uses a specific EndpointImpl.- Parameters:
bus-svc-port-endpointImplFactory-
-
-
Method Details
-
getBus
Description copied from interface:ClientRetrieves the Bus that was used to create the Client -
destroy
public void destroy()Description copied from interface:ClientIndicates that the client is no longer needed and that any resources it holds can now be freed. -
getEndpoint
- Specified by:
getEndpointin interfaceClient
-
releaseThreadContexts
public void releaseThreadContexts() -
getContexts
- Specified by:
getContextsin interfaceClient
-
getRequestContext
Description copied from interface:ClientGets the request context used for future invocations- Specified by:
getRequestContextin interfaceClient- Returns:
- context The context
-
getResponseContext
Description copied from interface:ClientGets the response context from the last invocation on this thread- Specified by:
getResponseContextin interfaceClient- Returns:
- context The context
-
setResponseContext
-
isThreadLocalRequestContext
public boolean isThreadLocalRequestContext()Description copied from interface:ClientChecks if the Request context is thread local or global.- Specified by:
isThreadLocalRequestContextin interfaceClient- Returns:
- true if the request context is a thread local
-
setThreadLocalRequestContext
public 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 interfaceClient
-
invoke
Description copied from interface:ClientInvokes an operation synchronously -
invoke
Description copied from interface:ClientInvokes an operation synchronously- Specified by:
invokein interfaceClient- 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
-
invoke
Description copied from interface:ClientInvokes an operation synchronously- Specified by:
invokein interfaceClient- Parameters:
operationName- The name of the operation to be invokedparams- 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
-
invokeWrapped
Description copied from interface:ClientInvokes an operation synchronously- Specified by:
invokeWrappedin interfaceClient- 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
-
invokeWrapped
Description copied from interface:ClientInvokes an operation synchronously- Specified by:
invokeWrappedin interfaceClient- Parameters:
operationName- The name of the operation to be invokedparams- 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
-
invoke
public Object[] invoke(BindingOperationInfo oi, Object[] params, Exchange exchange) throws Exception - Throws:
Exception
-
invoke
public Object[] invoke(BindingOperationInfo oi, Object[] params, Map<String, Object> context) throws ExceptionDescription copied from interface:ClientInvokes an operation synchronously- Specified by:
invokein interfaceClient- Parameters:
oi- The operation to be invokedparams- The params that matches the parts of the input message of the operationcontext- 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
-
invoke
public void invoke(ClientCallback callback, String operationName, Object... params) throws Exception Description copied from interface:ClientInvokes an operation asynchronously- Specified by:
invokein interfaceClient- Parameters:
callback- The callback that is called when the response is readyoperationName- 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
-
invoke
Description copied from interface:ClientInvokes an operation asynchronously- Specified by:
invokein interfaceClient- Parameters:
callback- The callback that is called when the response is readyoperationName- The name of the operation to be invokedparams- 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
-
invokeWrapped
public void invokeWrapped(ClientCallback callback, String operationName, Object... params) throws Exception Description copied from interface:ClientInvokes an operation asynchronously- Specified by:
invokeWrappedin interfaceClient- Parameters:
callback- The callback that is called when the response is readyoperationName- 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
-
invokeWrapped
public void invokeWrapped(ClientCallback callback, QName operationName, Object... params) throws Exception Description copied from interface:ClientInvokes an operation asynchronously- Specified by:
invokeWrappedin interfaceClient- Parameters:
callback- The callback that is called when the response is readyoperationName- The name of the operation to be invokedparams- The params that matches the parts of the input message of the operation- Throws:
Exception
-
invoke
public void invoke(ClientCallback callback, BindingOperationInfo oi, Object... params) throws Exception Description copied from interface:ClientInvokes an operation asynchronously -
invoke
public void invoke(ClientCallback callback, BindingOperationInfo oi, Object[] params, Map<String, Object> context) throws ExceptionDescription copied from interface:ClientInvokes an operation asynchronously- Specified by:
invokein interfaceClient- Parameters:
callback- The callback that is called when the response is readyoi- The operation to be invokedparams- The params that matches the parts of the input message of the operationcontext- contextual information for the invocation- Throws:
Exception
-
invoke
public void invoke(ClientCallback callback, BindingOperationInfo oi, Object[] params, Exchange exchange) throws Exception Description copied from interface:ClientInvokes an operation asynchronously- Specified by:
invokein interfaceClient- Parameters:
callback- The callback that is called when the response is readyoi- The operation to be invokedparams- The params that matches the parts of the input message of the operationexchange- The Exchange to be used for the invocation- Throws:
Exception
-
invoke
public void invoke(ClientCallback callback, BindingOperationInfo oi, Object[] params, Map<String, Object> context, Exchange exchange) throws ExceptionDescription copied from interface:ClientInvokes an operation asynchronously- Specified by:
invokein interfaceClient- Parameters:
callback- The callback that is called when the response is readyoi- The operation to be invokedparams- The params that matches the parts of the input message of the operationcontext- Optional (can be null) contextual information for the invocationexchange- Optional (can be null) The Exchange to be used for the invocation- Throws:
Exception
-
invoke
public Object[] invoke(BindingOperationInfo oi, Object[] params, Map<String, Object> context, Exchange exchange) throws ExceptionDescription copied from interface:ClientInvokes an operation synchronously- Specified by:
invokein interfaceClient- Specified by:
invokein interfaceRetryable- Parameters:
oi- The operation to be invokedparams- The params that matches the parts of the input message of the operationcontext- Optional (can be null) contextual information for the invocationexchange- 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
-
processResult
protected Object[] processResult(Message message, Exchange exchange, BindingOperationInfo oi, Map<String, Object> resContext) throws Exception- Throws:
Exception
-
onewayOnly
-
getException
-
setContext
-
waitResponse
- Throws:
IOException
-
setParameters
-
onMessage
Description copied from interface:MessageObserverCalled for an incoming message, i.e. where the content format(s) is/are source(s).- Specified by:
onMessagein interfaceMessageObserver
-
getConduit
Description copied from interface:ClientGet the Conduit that messages for this client will be sent on.- Specified by:
getConduitin interfaceClient- Returns:
- Conduit
-
prepareConduitSelector
-
setOutMessageProperties
-
setExchangeProperties
protected void setExchangeProperties(Exchange exchange, Endpoint endpoint, BindingOperationInfo boi) -
setupInterceptorChain
-
modifyChain
-
modifyOnewayChain
-
setEndpoint
-
getSynchronousTimeout
public int getSynchronousTimeout() -
setSynchronousTimeout
public void setSynchronousTimeout(int synchronousTimeout) -
getConduitSelector
Description copied from interface:ClientGet the ConduitSelector responsible for retreiving the Conduit.- Specified by:
getConduitSelectorin interfaceClient- Specified by:
getConduitSelectorin interfaceConduitSelectorHolder- Returns:
- the current ConduitSelector
-
getConduitSelector
-
setConduitSelector
Description copied from interface:ClientSet the ConduitSelector responsible for retreiving the Conduit.- Specified by:
setConduitSelectorin interfaceClient- Specified by:
setConduitSelectorin interfaceConduitSelectorHolder- Parameters:
selector- the ConduitSelector to use
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-
setExecutor
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 interfaceClient
-