Package org.apache.cxf.jaxrs.client
Class AbstractClient
java.lang.Object
org.apache.cxf.jaxrs.client.AbstractClient
- All Implemented Interfaces:
Client
- Direct Known Subclasses:
ClientProxyImpl,WebClient
Common proxy and http-centric client implementation
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classprotected classprotected static final class -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaccept(jakarta.ws.rs.core.MediaType... types) Set HTTP Accept headerSet HTTP Accept headeracceptEncoding(String... encs) Set HTTP Accept-Encoding headeracceptLanguage(String... languages) Set HTTP Accept-Language headerprotected voidaddMatrixQueryParamsToBuilder(jakarta.ws.rs.core.UriBuilder ub, String paramName, org.apache.cxf.jaxrs.model.ParameterType pt, Annotation[] anns, Object... pValues) authorization(Object auth) Set HTTP Authorization headerprotected URIcalculateNewRequestURI(Map<String, Object> reqContext) protected voidcheckClientException(org.apache.cxf.message.Message outMessage, Exception ex) protected voidprotected ObjectcheckIfBodyEmpty(Object body, String contentType) voidclose()Release the internal state and configuration associated with this clientprotected voidcompleteExchange(org.apache.cxf.message.Exchange exchange, boolean proxy) protected StringconvertParamValue(Object pValue, Annotation[] anns) protected StringconvertParamValue(Object pValue, Class<?> pClass, Annotation[] anns) protected jakarta.ws.rs.WebApplicationExceptionconvertToWebApplicationException(jakarta.ws.rs.core.Response r) cookie(jakarta.ws.rs.core.Cookie cookie) Set HTTP Cookie headerprotected org.apache.cxf.message.ExchangecreateExchange(org.apache.cxf.message.Message m, org.apache.cxf.message.Exchange exchange) protected org.apache.cxf.message.MessagecreateMessage(Object body, String httpMethod, jakarta.ws.rs.core.MultivaluedMap<String, String> headers, URI currentURI, org.apache.cxf.message.Exchange exchange, Map<String, Object> invocationContext, boolean proxy) protected voiddoRunInterceptorChain(org.apache.cxf.message.Message m) Set HTTP Content-Encoding headerprotected voidfinalize()protected static ParameterizedTypefindCallbackType(Class<?> cls) Get the base URI this Client has been intialized withprotected static Class<?>getCallbackClass(Type outType) protected static TypegetCallbackType(jakarta.ws.rs.client.InvocationCallback<?> callback) protected AbstractClient.ConfigurationReferenceReturns configuration referenceprotected List<?>getContentsList(Object body) protected jakarta.ws.rs.core.UriBuilderGet the current URI this Client is working withGet the copy of request headersgetRequestContext(org.apache.cxf.message.Message outMessage) jakarta.ws.rs.core.ResponseGet the response state if anyprotected ClientStategetState()getTemplateParametersMap(org.apache.cxf.jaxrs.model.URITemplate template, List<Object> values) Set arbitrary HTTP HeaderSet HTTP HeadersSet HTTP Content-Language headermatch(jakarta.ws.rs.core.EntityTag tag, boolean ifNot) Set HTTP If-Match or If-None-Match headerSet HTTP If-Modified-Since or If-Unmodified-Since headerprotected String[]parseQuotedHeaderValue(String originalValue) protected voidprepareConduitSelector(org.apache.cxf.message.Message message, URI currentURI, boolean proxy) protected Object[]preProcessResult(org.apache.cxf.message.Message message) Update the current URI query parametersprotected <T> TreadBody(jakarta.ws.rs.core.Response r, org.apache.cxf.message.Message outMessage, Class<T> cls, Type type, Annotation[] anns) voidprotected static voidreportMessageHandlerProblem(String name, Class<?> cls, jakarta.ws.rs.core.MediaType ct, Throwable ex) reset()Reset the headers and response state if anyprotected voidresetBaseAddress(URI uri) protected voidresetCurrentBuilder(URI uri) protected voidprotected voidprotected booleanresponseStreamCanBeClosed(org.apache.cxf.message.Message outMessage, Class<?> cls) protected abstract ObjectretryInvoke(URI newRequestURI, jakarta.ws.rs.core.MultivaluedMap<String, String> headers, Object body, org.apache.cxf.message.Exchange exchange, Map<String, Object> invContext) protected Object[]retryInvoke(org.apache.cxf.service.model.BindingOperationInfo oi, Object[] params, Map<String, Object> context, org.apache.cxf.message.Exchange exchange) protected voidsetAsyncMessageObserverIfNeeded(org.apache.cxf.message.Exchange exchange) protected voidsetConfiguration(ClientConfiguration config) protected voidReferences the configuration (by another client) so it won't shut down till all the client instances are closed.protected voidsetContexts(org.apache.cxf.message.Message message, org.apache.cxf.message.Exchange exchange, Map<String, Object> context, boolean proxy) protected voidsetEmptyRequestPropertyIfNeeded(org.apache.cxf.message.Message outMessage, Object body) protected voidsetPlainOperationNameProperty(org.apache.cxf.message.Message outMessage, String name) protected jakarta.ws.rs.core.Response.ResponseBuildersetResponseBuilder(org.apache.cxf.message.Message outMessage, org.apache.cxf.message.Exchange exchange) protected voidsetSupportOnewayResponseProperty(org.apache.cxf.message.Message outMessage) protected static org.apache.cxf.transport.MessageObserverprotected static org.apache.cxf.phase.PhaseInterceptorChainprotected static org.apache.cxf.phase.PhaseInterceptorChaintype(jakarta.ws.rs.core.MediaType ct) Set HTTP Content-Type headerSet HTTP Content-Type headerprotected voidwaitForResponseCode(org.apache.cxf.message.Exchange exchange) protected <T> voidwriteBody(T o, org.apache.cxf.message.Message outMessage, Class<?> cls, Type type, Annotation[] anns, OutputStream os)
-
Field Details
-
EXECUTOR_SERVICE_PROPERTY
- See Also:
-
REQUEST_CONTEXT
- See Also:
-
RESPONSE_CONTEXT
- See Also:
-
KEEP_CONDUIT_ALIVE
- See Also:
-
HTTP_SCHEME
- See Also:
-
cfg
-
-
Constructor Details
-
AbstractClient
-
-
Method Details
-
query
Update the current URI query parameters -
header
Set arbitrary HTTP Header -
headers
Set HTTP Headers -
accept
Set HTTP Accept header -
type
Set HTTP Content-Type header -
type
Set HTTP Content-Type header -
accept
Set HTTP Accept header -
cookie
Set HTTP Cookie header -
authorization
Set HTTP Authorization header- Specified by:
authorizationin interfaceClient- Parameters:
auth- Authorization value- Returns:
- the updated Client
-
modified
Set HTTP If-Modified-Since or If-Unmodified-Since header -
language
Set HTTP Content-Language header -
match
Set HTTP If-Match or If-None-Match header -
acceptLanguage
Set HTTP Accept-Language header- Specified by:
acceptLanguagein interfaceClient- Parameters:
languages- list of Accept-Language header values- Returns:
- the updated Client
-
acceptEncoding
Set HTTP Accept-Encoding header- Specified by:
acceptEncodingin interfaceClient- Parameters:
encs- list of Accept-Encoding header value- Returns:
- the updated Client
-
encoding
Set HTTP Content-Encoding header -
getHeaders
Get the copy of request headers- Specified by:
getHeadersin interfaceClient- Returns:
- request headers
-
getBaseURI
Get the base URI this Client has been intialized with- Specified by:
getBaseURIin interfaceClient- Returns:
- base URI
-
getCurrentURI
Get the current URI this Client is working with- Specified by:
getCurrentURIin interfaceClient- Returns:
- current URI
-
getResponse
public jakarta.ws.rs.core.Response getResponse()Get the response state if any- Specified by:
getResponsein interfaceClient- Returns:
- JAXRS Response response
-
reset
Reset the headers and response state if any -
finalize
-
close
public void close()Description copied from interface:ClientRelease the internal state and configuration associated with this client -
removeAllHeaders
public void removeAllHeaders() -
getState
-
getCurrentBuilder
protected jakarta.ws.rs.core.UriBuilder getCurrentBuilder() -
resetResponse
protected void resetResponse() -
resetBaseAddress
-
resetCurrentBuilder
-
getTemplateParametersMap
-
setResponseBuilder
protected jakarta.ws.rs.core.Response.ResponseBuilder setResponseBuilder(org.apache.cxf.message.Message outMessage, org.apache.cxf.message.Exchange exchange) throws Exception - Throws:
Exception
-
writeBody
protected <T> void writeBody(T o, org.apache.cxf.message.Message outMessage, Class<?> cls, Type type, Annotation[] anns, OutputStream os) -
convertToWebApplicationException
protected jakarta.ws.rs.WebApplicationException convertToWebApplicationException(jakarta.ws.rs.core.Response r) -
readBody
protected <T> T readBody(jakarta.ws.rs.core.Response r, org.apache.cxf.message.Message outMessage, Class<T> cls, Type type, Annotation[] anns) -
responseStreamCanBeClosed
protected boolean responseStreamCanBeClosed(org.apache.cxf.message.Message outMessage, Class<?> cls) -
completeExchange
protected void completeExchange(org.apache.cxf.message.Exchange exchange, boolean proxy) -
preProcessResult
- Throws:
Exception
-
checkClientException
protected void checkClientException(org.apache.cxf.message.Message outMessage, Exception ex) throws Exception - Throws:
Exception
-
waitForResponseCode
protected void waitForResponseCode(org.apache.cxf.message.Exchange exchange) -
calculateNewRequestURI
-
doRunInterceptorChain
protected void doRunInterceptorChain(org.apache.cxf.message.Message m) -
retryInvoke
protected Object[] retryInvoke(org.apache.cxf.service.model.BindingOperationInfo oi, Object[] params, Map<String, Object> context, org.apache.cxf.message.Exchange exchange) throws Exception- Throws:
Exception
-
retryInvoke
protected abstract Object retryInvoke(URI newRequestURI, jakarta.ws.rs.core.MultivaluedMap<String, String> headers, Object body, org.apache.cxf.message.Exchange exchange, Map<String, throws ThrowableObject> invContext) - Throws:
Throwable
-
addMatrixQueryParamsToBuilder
protected void addMatrixQueryParamsToBuilder(jakarta.ws.rs.core.UriBuilder ub, String paramName, org.apache.cxf.jaxrs.model.ParameterType pt, Annotation[] anns, Object... pValues) -
convertParamValue
-
convertParamValue
-
reportMessageHandlerProblem
-
parseQuotedHeaderValue
-
getConfiguration
-
setConfiguration
-
prepareConduitSelector
protected void prepareConduitSelector(org.apache.cxf.message.Message message, URI currentURI, boolean proxy) -
setupOutInterceptorChain
protected static org.apache.cxf.phase.PhaseInterceptorChain setupOutInterceptorChain(ClientConfiguration cfg) -
setupInInterceptorChain
protected static org.apache.cxf.phase.PhaseInterceptorChain setupInInterceptorChain(ClientConfiguration cfg) -
setupInFaultObserver
protected static org.apache.cxf.transport.MessageObserver setupInFaultObserver(ClientConfiguration cfg) -
setSupportOnewayResponseProperty
protected void setSupportOnewayResponseProperty(org.apache.cxf.message.Message outMessage) -
checkClosed
protected void checkClosed() -
createMessage
-
setEmptyRequestPropertyIfNeeded
protected void setEmptyRequestPropertyIfNeeded(org.apache.cxf.message.Message outMessage, Object body) -
checkIfBodyEmpty
-
getRequestContext
-
getContentsList
-
createExchange
protected org.apache.cxf.message.Exchange createExchange(org.apache.cxf.message.Message m, org.apache.cxf.message.Exchange exchange) -
setAsyncMessageObserverIfNeeded
protected void setAsyncMessageObserverIfNeeded(org.apache.cxf.message.Exchange exchange) -
setContexts
-
setPlainOperationNameProperty
protected void setPlainOperationNameProperty(org.apache.cxf.message.Message outMessage, String name) -
getCallbackType
-
findCallbackType
-
getCallbackClass
-
resetResponseStateImmediatelyIfNeeded
protected void resetResponseStateImmediatelyIfNeeded() -
setConfigurationReference
References the configuration (by another client) so it won't shut down till all the client instances are closed.- Parameters:
reference- configuration reference
-
getConfigurationReference
Returns configuration reference- Returns:
- configuration reference
-