Class 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 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: 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
      • setResponse

        public void setResponse​(javax.ws.rs.core.Response response)
        Description copied from interface: ClientState
        Sets Response
        Specified by:
        setResponse in interface ClientState
        Parameters:
        response - response
      • getResponse

        public javax.ws.rs.core.Response getResponse()
        Description copied from interface: ClientState
        Gets Response
        Specified by:
        getResponse in interface ClientState
        Returns:
        response
      • 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 currentURI,
                                    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:
        currentURI - baseURI
        headers - request headers, can be null
        templates - 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: 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:
        currentURI - baseURI
        headers - request headers, can be null
        templates - initial templates map, can be null
        properties - additional properties, could be null
        Returns:
        client state
      • setTimeToKeepState

        public void setTimeToKeepState​(long timeToKeepState)