Apache CXF API

org.apache.cxf.jaxrs.client
Class ThreadLocalClientState

java.lang.Object
  extended by 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
ThreadLocalClientState(LocalClientState initialState, long timeToKeepState)
           
ThreadLocalClientState(String baseURI)
           
ThreadLocalClientState(String baseURI, long timeToKeepState)
           
 
Method Summary
 URI getBaseURI()
          Gets the base URI
 javax.ws.rs.core.UriBuilder getCurrentBuilder()
          Gets the current builder
 javax.ws.rs.core.MultivaluedMap<String,String> getRequestHeaders()
          Gets the request headers
 javax.ws.rs.core.Response.ResponseBuilder getResponseBuilder()
          Gets the responseBuilder
protected  ClientState getState()
           
 javax.ws.rs.core.MultivaluedMap<String,String> getTemplates()
          Gets the templates map
 ClientState newState(URI baseURI, javax.ws.rs.core.MultivaluedMap<String,String> headers, javax.ws.rs.core.MultivaluedMap<String,String> templates)
          The factory method for creating a new state.
 void reset()
          Resets the current state to the baseURI
 void setBaseURI(URI baseURI)
          Sets the base URI
 void setCurrentBuilder(javax.ws.rs.core.UriBuilder currentBuilder)
          Sets the current builder
 void setRequestHeaders(javax.ws.rs.core.MultivaluedMap<String,String> requestHeaders)
          Sets the request headers
 void setResponseBuilder(javax.ws.rs.core.Response.ResponseBuilder responseBuilder)
          Sets the responseBuilder
 void setTemplates(javax.ws.rs.core.MultivaluedMap<String,String> map)
          Sets the map containing template name and value pairs
 void setTimeToKeepState(long timeToKeepState)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadLocalClientState

public ThreadLocalClientState(String baseURI)

ThreadLocalClientState

public ThreadLocalClientState(String baseURI,
                              long timeToKeepState)

ThreadLocalClientState

public ThreadLocalClientState(LocalClientState initialState,
                              long timeToKeepState)
Method Detail

setCurrentBuilder

public void setCurrentBuilder(javax.ws.rs.core.UriBuilder currentBuilder)
Description copied from interface: ClientState
Sets the current builder

Specified by:
setCurrentBuilder in interface ClientState
Parameters:
currentBuilder - the builder

getCurrentBuilder

public javax.ws.rs.core.UriBuilder getCurrentBuilder()
Description copied from interface: ClientState
Gets the current builder

Specified by:
getCurrentBuilder in interface ClientState
Returns:

setBaseURI

public void setBaseURI(URI baseURI)
Description copied from interface: ClientState
Sets the base URI

Specified by:
setBaseURI in interface ClientState
Parameters:
baseURI - baseURI

getBaseURI

public URI getBaseURI()
Description copied from interface: ClientState
Gets the base URI

Specified by:
getBaseURI in interface ClientState
Returns:
baseURI

setResponseBuilder

public void setResponseBuilder(javax.ws.rs.core.Response.ResponseBuilder responseBuilder)
Description copied from interface: ClientState
Sets the responseBuilder

Specified by:
setResponseBuilder in interface ClientState
Parameters:
responseBuilder - responseBuilder

getResponseBuilder

public javax.ws.rs.core.Response.ResponseBuilder getResponseBuilder()
Description copied from interface: ClientState
Gets the responseBuilder

Specified by:
getResponseBuilder in interface ClientState
Returns:
responseBuilder

setRequestHeaders

public void setRequestHeaders(javax.ws.rs.core.MultivaluedMap<String,String> requestHeaders)
Description copied from interface: ClientState
Sets the request headers

Specified by:
setRequestHeaders in interface ClientState
Parameters:
requestHeaders - request headers

getRequestHeaders

public javax.ws.rs.core.MultivaluedMap<String,String> getRequestHeaders()
Description copied from interface: ClientState
Gets the request headers

Specified by:
getRequestHeaders in interface ClientState
Returns:
request headers, may be immutable

getTemplates

public javax.ws.rs.core.MultivaluedMap<String,String> getTemplates()
Description copied from interface: ClientState
Gets the templates map

Specified by:
getTemplates in interface ClientState
Returns:
templates

setTemplates

public void setTemplates(javax.ws.rs.core.MultivaluedMap<String,String> map)
Description copied from interface: ClientState
Sets the map containing template name and value pairs

Specified by:
setTemplates in interface ClientState

reset

public void reset()
Description copied from interface: ClientState
Resets the current state to the baseURI

Specified by:
reset in interface ClientState

newState

public ClientState newState(URI baseURI,
                            javax.ws.rs.core.MultivaluedMap<String,String> headers,
                            javax.ws.rs.core.MultivaluedMap<String,String> templates)
Description copied from interface: ClientState
The 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:
newState in interface ClientState
Parameters:
baseURI - baseURI
headers - request headers, can be null
templates - initial templates map, can be null
Returns:
client state

getState

protected ClientState getState()

setTimeToKeepState

public void setTimeToKeepState(long timeToKeepState)

Apache CXF API

Apache CXF