Package org.apache.cxf.jaxrs.client
Class ThreadLocalClientState
- java.lang.Object
-
- org.apache.cxf.jaxrs.client.ThreadLocalClientState
-
- All Implemented Interfaces:
ClientState
public class ThreadLocalClientState extends Object implements ClientState
Keeps the client state such as the baseURI, currentURI, requestHeaders, current response in a thread local storage
-
-
Constructor Summary
Constructors Constructor Description ThreadLocalClientState(String baseURI)ThreadLocalClientState(String baseURI, long timeToKeepState)ThreadLocalClientState(String baseURI, long timeToKeepState, Map<String,Object> properties)ThreadLocalClientState(String baseURI, Map<String,Object> properties)ThreadLocalClientState(LocalClientState initialState, long timeToKeepState)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description URIgetBaseURI()Gets the base URIjavax.ws.rs.core.UriBuildergetCurrentBuilder()Gets the current builderjavax.ws.rs.core.MultivaluedMap<String,String>getRequestHeaders()Gets the request headersjavax.ws.rs.core.ResponsegetResponse()Gets Responseprotected ClientStategetState()javax.ws.rs.core.MultivaluedMap<String,String>getTemplates()Gets the templates mapClientStatenewState(URI currentURI, javax.ws.rs.core.MultivaluedMap<String,String> headers, javax.ws.rs.core.MultivaluedMap<String,String> templates)The factory method for creating a new state.ClientStatenewState(URI currentURI, javax.ws.rs.core.MultivaluedMap<String,String> headers, javax.ws.rs.core.MultivaluedMap<String,String> templates, Map<String,Object> properties)The factory method for creating a new state.voidreset()Resets the current state to the baseURIvoidsetBaseURI(URI baseURI)Sets the base URIvoidsetCurrentBuilder(javax.ws.rs.core.UriBuilder currentBuilder)Sets the current buildervoidsetRequestHeaders(javax.ws.rs.core.MultivaluedMap<String,String> requestHeaders)Sets the request headersvoidsetResponse(javax.ws.rs.core.Response response)Sets ResponsevoidsetTemplates(javax.ws.rs.core.MultivaluedMap<String,String> map)Sets the map containing template name and value pairsvoidsetTimeToKeepState(long timeToKeepState)
-
-
-
Constructor Detail
-
ThreadLocalClientState
public ThreadLocalClientState(String baseURI)
-
ThreadLocalClientState
public ThreadLocalClientState(String baseURI, Map<String,Object> properties)
-
ThreadLocalClientState
public ThreadLocalClientState(String baseURI, long timeToKeepState)
-
ThreadLocalClientState
public ThreadLocalClientState(String baseURI, long timeToKeepState, Map<String,Object> properties)
-
ThreadLocalClientState
public ThreadLocalClientState(LocalClientState initialState, long timeToKeepState)
-
-
Method Detail
-
setCurrentBuilder
public void setCurrentBuilder(javax.ws.rs.core.UriBuilder currentBuilder)
Description copied from interface:ClientStateSets the current builder- Specified by:
setCurrentBuilderin interfaceClientState- Parameters:
currentBuilder- the builder
-
getCurrentBuilder
public javax.ws.rs.core.UriBuilder getCurrentBuilder()
Description copied from interface:ClientStateGets the current builder- Specified by:
getCurrentBuilderin interfaceClientState- Returns:
-
setBaseURI
public void setBaseURI(URI baseURI)
Description copied from interface:ClientStateSets the base URI- Specified by:
setBaseURIin interfaceClientState- Parameters:
baseURI- baseURI
-
getBaseURI
public URI getBaseURI()
Description copied from interface:ClientStateGets the base URI- Specified by:
getBaseURIin interfaceClientState- Returns:
- baseURI
-
setResponse
public void setResponse(javax.ws.rs.core.Response response)
Description copied from interface:ClientStateSets Response- Specified by:
setResponsein interfaceClientState- Parameters:
response- response
-
getResponse
public javax.ws.rs.core.Response getResponse()
Description copied from interface:ClientStateGets Response- Specified by:
getResponsein interfaceClientState- Returns:
- response
-
setRequestHeaders
public void setRequestHeaders(javax.ws.rs.core.MultivaluedMap<String,String> requestHeaders)
Description copied from interface:ClientStateSets the request headers- Specified by:
setRequestHeadersin interfaceClientState- Parameters:
requestHeaders- request headers
-
getRequestHeaders
public javax.ws.rs.core.MultivaluedMap<String,String> getRequestHeaders()
Description copied from interface:ClientStateGets the request headers- Specified by:
getRequestHeadersin interfaceClientState- Returns:
- request headers, may be immutable
-
getTemplates
public javax.ws.rs.core.MultivaluedMap<String,String> getTemplates()
Description copied from interface:ClientStateGets the templates map- Specified by:
getTemplatesin interfaceClientState- Returns:
- templates
-
setTemplates
public void setTemplates(javax.ws.rs.core.MultivaluedMap<String,String> map)
Description copied from interface:ClientStateSets the map containing template name and value pairs- Specified by:
setTemplatesin interfaceClientState
-
reset
public void reset()
Description copied from interface:ClientStateResets the current state to the baseURI- Specified by:
resetin interfaceClientState
-
newState
public ClientState newState(URI currentURI, javax.ws.rs.core.MultivaluedMap<String,String> headers, javax.ws.rs.core.MultivaluedMap<String,String> templates)
Description copied from interface:ClientStateThe factory method for creating a new state. Example, proxy and WebClient.fromClient will use this method when creating subresource proxies and new web clients respectively to ensure thet stay thread-local if needed- Specified by:
newStatein interfaceClientState- Parameters:
currentURI- baseURIheaders- request headers, can be nulltemplates- initial templates map, can be null- Returns:
- client state
-
newState
public ClientState newState(URI currentURI, javax.ws.rs.core.MultivaluedMap<String,String> headers, javax.ws.rs.core.MultivaluedMap<String,String> templates, Map<String,Object> properties)
Description copied from interface:ClientStateThe factory method for creating a new state. Example, proxy and WebClient.fromClient will use this method when creating subresource proxies and new web clients respectively to ensure thet stay thread-local if needed- Specified by:
newStatein interfaceClientState- Parameters:
currentURI- baseURIheaders- request headers, can be nulltemplates- initial templates map, can be nullproperties- additional properties, could be null- Returns:
- client state
-
getState
protected ClientState getState()
-
setTimeToKeepState
public void setTimeToKeepState(long timeToKeepState)
-
-