public abstract class AbstractClient extends Object implements Client
| Modifier and Type | Class and Description |
|---|---|
protected class |
AbstractClient.AbstractBodyWriter |
| Modifier and Type | Field and Description |
|---|---|
protected ClientConfiguration |
cfg |
protected static String |
HTTP_SCHEME |
protected static String |
KEEP_CONDUIT_ALIVE |
protected static String |
REQUEST_CONTEXT |
protected static String |
RESPONSE_CONTEXT |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractClient(ClientState initialState) |
| Modifier and Type | Method and Description |
|---|---|
Client |
accept(javax.ws.rs.core.MediaType... types)
sets HTTP Accept header
|
Client |
accept(String... types)
sets HTTP Accept header
|
Client |
acceptEncoding(String... encs)
sets HTTP Accept-Encoding header
|
Client |
acceptLanguage(String... languages)
sets HTTP Accept-Language header
|
protected void |
addMatrixQueryParamsToBuilder(javax.ws.rs.core.UriBuilder ub,
String paramName,
ParameterType pt,
Annotation[] anns,
Object... pValues) |
protected URI |
calculateNewRequestURI(Map<String,Object> reqContext) |
protected void |
checkClientException(Message outMessage,
Exception ex) |
protected Object |
checkIfBodyEmpty(Object body) |
void |
close()
Releases the internal state and configuration associated with this client
|
protected void |
completeExchange(Object response,
Exchange exchange,
boolean proxy) |
protected String |
convertParamValue(Object pValue,
Annotation[] anns) |
protected javax.ws.rs.WebApplicationException |
convertToWebApplicationException(javax.ws.rs.core.Response r) |
Client |
cookie(javax.ws.rs.core.Cookie cookie)
sets HTTP Cookie header
|
protected Exchange |
createExchange(Message m,
Exchange exchange) |
protected Message |
createMessage(Object body,
String httpMethod,
javax.ws.rs.core.MultivaluedMap<String,String> headers,
URI currentURI,
Exchange exchange,
Map<String,Object> invocationContext,
boolean proxy) |
protected void |
doRunInterceptorChain(Message m) |
Client |
encoding(String enc)
sets HTTP Content-Encoding header
|
protected void |
finalize() |
URI |
getBaseURI()
Gets the base URI this Client has been intialized with
|
protected ClientConfiguration |
getConfiguration() |
protected List<?> |
getContentsList(Object body) |
protected javax.ws.rs.core.UriBuilder |
getCurrentBuilder() |
URI |
getCurrentURI()
Gets the current URI this Client is working with
|
javax.ws.rs.core.MultivaluedMap<String,String> |
getHeaders()
Gets the copy of request headers
|
protected Map<String,Object> |
getRequestContext(Message outMessage) |
javax.ws.rs.core.Response |
getResponse()
Gets the response state if any
|
protected ClientState |
getState() |
protected javax.ws.rs.core.MultivaluedMap<String,String> |
getTemplateParametersMap(URITemplate template,
List<Object> values) |
Client |
header(String name,
Object... values)
Sets arbitrary HTTP Header
|
Client |
headers(javax.ws.rs.core.MultivaluedMap<String,String> map)
Sets HTTP Headers
|
Client |
language(String language)
sets HTTP Content-Language header
|
Client |
match(javax.ws.rs.core.EntityTag tag,
boolean ifNot)
sets HTTP If-Match or If-None-Match header
|
Client |
modified(Date date,
boolean ifNot)
sets HTTP If-Modified-Since or If-Unmodified-Since header
|
protected String[] |
parseQuotedHeaderValue(String originalValue) |
protected void |
prepareConduitSelector(Message message,
URI currentURI,
boolean proxy) |
protected Object[] |
preProcessResult(Message message) |
Client |
query(String name,
Object... values)
Updates the current URI query parameters
|
protected <T> T |
readBody(javax.ws.rs.core.Response r,
Message outMessage,
Class<T> cls,
Type type,
Annotation[] anns) |
protected static void |
reportMessageHandlerProblem(String name,
Class<?> cls,
javax.ws.rs.core.MediaType ct,
Throwable ex) |
Client |
reset()
Resets the headers and response state if any
|
protected void |
resetBaseAddress(URI uri) |
protected void |
resetCurrentBuilder(URI uri) |
protected void |
resetResponse() |
protected boolean |
responseStreamCanBeClosed(Message outMessage,
Class<?> cls) |
protected Object[] |
retryInvoke(BindingOperationInfo oi,
Object[] params,
Map<String,Object> context,
Exchange exchange) |
protected abstract Object |
retryInvoke(URI newRequestURI,
javax.ws.rs.core.MultivaluedMap<String,String> headers,
Object body,
Exchange exchange,
Map<String,Object> invContext) |
protected static void |
setAllHeaders(javax.ws.rs.core.MultivaluedMap<String,String> headers,
HttpURLConnection conn) |
protected void |
setConfiguration(ClientConfiguration config) |
protected void |
setContexts(Message message,
Exchange exchange,
Map<String,Object> context,
boolean proxy) |
protected void |
setEmptyRequestPropertyIfNeeded(Message outMessage,
Object body) |
protected void |
setPlainOperationNameProperty(Message outMessage,
String name) |
protected javax.ws.rs.core.Response.ResponseBuilder |
setResponseBuilder(Message outMessage,
Exchange exchange) |
protected void |
setSupportOnewayResponseProperty(Message outMessage) |
protected static MessageObserver |
setupInFaultObserver(ClientConfiguration cfg) |
protected static PhaseInterceptorChain |
setupInInterceptorChain(ClientConfiguration cfg) |
protected static PhaseInterceptorChain |
setupOutInterceptorChain(ClientConfiguration cfg) |
Client |
type(javax.ws.rs.core.MediaType ct)
sets HTTP Content-Type header
|
Client |
type(String type)
sets HTTP Content-Type header
|
protected void |
waitForResponseCode(Exchange exchange) |
protected <T> void |
writeBody(T o,
Message outMessage,
Class<?> cls,
Type type,
Annotation[] anns,
OutputStream os) |
protected static final String REQUEST_CONTEXT
protected static final String RESPONSE_CONTEXT
protected static final String KEEP_CONDUIT_ALIVE
protected static final String HTTP_SCHEME
protected ClientConfiguration cfg
protected AbstractClient(ClientState initialState)
public Client accept(javax.ws.rs.core.MediaType... types)
public Client type(javax.ws.rs.core.MediaType ct)
public Client cookie(javax.ws.rs.core.Cookie cookie)
public Client modified(Date date, boolean ifNot)
public Client match(javax.ws.rs.core.EntityTag tag, boolean ifNot)
public Client acceptLanguage(String... languages)
acceptLanguage in interface Clientlanguages - list of Accept-Language header valuespublic Client acceptEncoding(String... encs)
acceptEncoding in interface Clientencs - list of Accept-Encoding header valuepublic javax.ws.rs.core.MultivaluedMap<String,String> getHeaders()
getHeaders in interface Clientpublic URI getBaseURI()
getBaseURI in interface Clientpublic URI getCurrentURI()
getCurrentURI in interface Clientpublic javax.ws.rs.core.Response getResponse()
getResponse in interface Clientpublic Client reset()
public void close()
Clientprotected ClientState getState()
protected javax.ws.rs.core.UriBuilder getCurrentBuilder()
protected void resetResponse()
protected void resetBaseAddress(URI uri)
protected void resetCurrentBuilder(URI uri)
protected javax.ws.rs.core.MultivaluedMap<String,String> getTemplateParametersMap(URITemplate template, List<Object> values)
protected javax.ws.rs.core.Response.ResponseBuilder setResponseBuilder(Message outMessage, Exchange exchange) throws Exception
Exceptionprotected <T> void writeBody(T o,
Message outMessage,
Class<?> cls,
Type type,
Annotation[] anns,
OutputStream os)
protected javax.ws.rs.WebApplicationException convertToWebApplicationException(javax.ws.rs.core.Response r)
protected <T> T readBody(javax.ws.rs.core.Response r,
Message outMessage,
Class<T> cls,
Type type,
Annotation[] anns)
protected boolean responseStreamCanBeClosed(Message outMessage, Class<?> cls)
protected Object[] preProcessResult(Message message) throws Exception
Exceptionprotected void checkClientException(Message outMessage, Exception ex) throws Exception
Exceptionprotected void waitForResponseCode(Exchange exchange)
protected void doRunInterceptorChain(Message m)
protected Object[] retryInvoke(BindingOperationInfo oi, Object[] params, Map<String,Object> context, Exchange exchange) throws Exception
Exceptionprotected abstract Object retryInvoke(URI newRequestURI, javax.ws.rs.core.MultivaluedMap<String,String> headers, Object body, Exchange exchange, Map<String,Object> invContext) throws Throwable
Throwableprotected void addMatrixQueryParamsToBuilder(javax.ws.rs.core.UriBuilder ub,
String paramName,
ParameterType pt,
Annotation[] anns,
Object... pValues)
protected String convertParamValue(Object pValue, Annotation[] anns)
protected static void reportMessageHandlerProblem(String name, Class<?> cls, javax.ws.rs.core.MediaType ct, Throwable ex)
protected static void setAllHeaders(javax.ws.rs.core.MultivaluedMap<String,String> headers, HttpURLConnection conn)
protected ClientConfiguration getConfiguration()
protected void setConfiguration(ClientConfiguration config)
protected void prepareConduitSelector(Message message, URI currentURI, boolean proxy)
protected static PhaseInterceptorChain setupOutInterceptorChain(ClientConfiguration cfg)
protected static PhaseInterceptorChain setupInInterceptorChain(ClientConfiguration cfg)
protected static MessageObserver setupInFaultObserver(ClientConfiguration cfg)
protected void setSupportOnewayResponseProperty(Message outMessage)
protected void finalize()
throws Throwable
protected Message createMessage(Object body, String httpMethod, javax.ws.rs.core.MultivaluedMap<String,String> headers, URI currentURI, Exchange exchange, Map<String,Object> invocationContext, boolean proxy)
protected void setEmptyRequestPropertyIfNeeded(Message outMessage, Object body)
protected void setContexts(Message message, Exchange exchange, Map<String,Object> context, boolean proxy)
Apache CXF