|
Apache CXF API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.cxf.jaxrs.client.AbstractClient
public abstract class AbstractClient
Common proxy and http-centric client implementation
Nested Class Summary | |
---|---|
protected class |
AbstractClient.AbstractBodyWriter
|
Field Summary | |
---|---|
protected ClientConfiguration |
cfg
|
protected static String |
HTTP_SCHEME
|
protected static String |
KEEP_CONDUIT_ALIVE
|
protected static String |
REQUEST_CONTEXT
|
protected static String |
RESPONSE_CONTEXT
|
Constructor Summary | |
---|---|
protected |
AbstractClient(ClientState initialState)
|
Method Summary | ||
---|---|---|
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 |
|
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
|
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 cause)
|
|
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 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
|
writeBody(T o,
Message outMessage,
Class<?> cls,
Type type,
Annotation[] anns,
OutputStream os)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
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
Constructor Detail |
---|
protected AbstractClient(ClientState initialState)
Method Detail |
---|
public Client query(String name, Object... values)
query
in interface Client
name
- query namevalues
- query values
public Client header(String name, Object... values)
header
in interface Client
name
- header namevalues
- list of header values
public Client headers(javax.ws.rs.core.MultivaluedMap<String,String> map)
headers
in interface Client
map
- headers
public Client accept(javax.ws.rs.core.MediaType... types)
accept
in interface Client
types
- list of JAXRS MediaTypes representing Accept header values
public Client type(javax.ws.rs.core.MediaType ct)
type
in interface Client
ct
- JAXRS MediaType representing Content-Type value
public Client type(String type)
type
in interface Client
type
- Content-Type value
public Client accept(String... types)
accept
in interface Client
types
- list of Accept header values
public Client cookie(javax.ws.rs.core.Cookie cookie)
cookie
in interface Client
cookie
- Cookie value
public Client modified(Date date, boolean ifNot)
modified
in interface Client
date
- Date value, will be formated as "EEE, dd MMM yyyy HH:mm:ss zzz"ifNot
- if true then If-Unmodified-Since is set, If-Modified-Since otherwise
public Client language(String language)
language
in interface Client
language
- Content-Language header value
public Client match(javax.ws.rs.core.EntityTag tag, boolean ifNot)
match
in interface Client
tag
- ETag valueifNot
- if true then If-None-Match is set, If-Match otherwise
public Client acceptLanguage(String... languages)
acceptLanguage
in interface Client
languages
- list of Accept-Language header values
public Client acceptEncoding(String... encs)
acceptEncoding
in interface Client
encs
- list of Accept-Encoding header value
public Client encoding(String enc)
encoding
in interface Client
enc
- Content-Encoding header value
public javax.ws.rs.core.MultivaluedMap<String,String> getHeaders()
getHeaders
in interface Client
public URI getBaseURI()
getBaseURI
in interface Client
public URI getCurrentURI()
getCurrentURI
in interface Client
public javax.ws.rs.core.Response getResponse()
getResponse
in interface Client
public Client reset()
reset
in interface Client
public void close()
Client
close
in interface Client
protected 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
Exception
protected <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 void completeExchange(Object response, Exchange exchange, boolean proxy)
protected Object[] preProcessResult(Message message) throws Exception
Exception
protected void checkClientException(Message outMessage, Exception ex) throws Exception
Exception
protected void waitForResponseCode(Exchange exchange)
protected URI calculateNewRequestURI(Map<String,Object> reqContext)
protected void doRunInterceptorChain(Message m)
protected Object[] retryInvoke(BindingOperationInfo oi, Object[] params, Map<String,Object> context, Exchange exchange) throws Exception
Exception
protected abstract Object retryInvoke(URI newRequestURI, javax.ws.rs.core.MultivaluedMap<String,String> headers, Object body, Exchange exchange, Map<String,Object> invContext) throws Throwable
Throwable
protected 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 cause)
protected static void setAllHeaders(javax.ws.rs.core.MultivaluedMap<String,String> headers, HttpURLConnection conn)
protected String[] parseQuotedHeaderValue(String originalValue)
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 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 Object checkIfBodyEmpty(Object body)
protected Map<String,Object> getRequestContext(Message outMessage)
protected List<?> getContentsList(Object body)
protected Exchange createExchange(Message m, Exchange exchange)
protected void setContexts(Message message, Exchange exchange, Map<String,Object> context, boolean proxy)
protected void setPlainOperationNameProperty(Message outMessage, String name)
|
Apache CXF API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |