Class JAXRSClientFactoryBean

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected javax.ws.rs.core.MultivaluedMap<String,​String> headers  
      protected boolean inheritHeaders  
      protected ClientState initialState  
      protected static Logger LOG  
      protected String password  
      protected ClassLoader proxyLoader  
      protected Class<?> serviceClass  
      protected boolean threadSafe  
      protected long timeToKeepState  
      protected String username  
      • Fields inherited from class org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean

        entityProviders, schemaLocations, serviceFactory
      • Fields inherited from class org.apache.cxf.endpoint.AbstractEndpointFactory

        address, bindingConfig, bindingFactory, bindingId, bus, conduitSelector, dataBinding, destinationFactory, endpointName, endpointReference, features, properties, publishedEndpointUrl, serviceName, transportId
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void applyFeatures​(AbstractClient client)  
      Client create()
      Create a Client instance.
      <T> T create​(Class<T> cls, Object... varValues)
      Creates a proxy.
      protected ClientProxyImpl createClientProxy​(org.apache.cxf.jaxrs.model.ClassResourceInfo cri, boolean isRoot, ClientState actualState, Object[] varValues)  
      WebClient createWebClient()
      Creates a WebClient instance
      Client createWithValues​(Object... varValues)
      Create a Client instance.
      protected ClientState getActualState()  
      protected org.apache.cxf.endpoint.ConduitSelector getConduitSelector​(org.apache.cxf.endpoint.Endpoint ep)  
      protected <C extends javax.ws.rs.core.Configurable<C>>
      javax.ws.rs.core.Configurable<?>
      getConfigurableFor​(C context)  
      Map<String,​List<String>> getHeaders()
      Gets the initial headers
      String getPassword()
      Gets the password
      Class<?> getServiceClass()
      Returns the service class.
      String getUsername()
      Gets the user name
      protected void initClient​(AbstractClient client, org.apache.cxf.endpoint.Endpoint ep, boolean addHeaders)  
      protected void notifyLifecycleManager​(Object client)  
      void setClassLoader​(ClassLoader loader)
      Sets the custom class loader to be used for creating proxies.
      void setHeaders​(Map<String,​String> map)
      Sets the headers new proxy or WebClient instances will be initialized with.
      void setInheritHeaders​(boolean ih)
      Indicates if the headers set by a current proxy will be inherited when a subresource proxy is created vice versa.
      void setInitialState​(ClientState initialState)
      Sets the initial client state, can be a thread-safe state.
      void setPassword​(String password)
      Sets the password.
      void setResourceClass​(Class<?> cls)
      Sets the resource class
      void setSecondsToKeepState​(long time)
      Sets the time a thread-local client state will be kept.
      void setServiceClass​(Class<?> cls)
      Sets the service class, may be called from a Spring handler
      void setThreadSafe​(boolean threadSafe)
      Indicates if a single proxy or WebClient instance can be reused by multiple threads.
      void setUsername​(String username)
      Sets the username.
      • Methods inherited from class org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean

        checkResources, createBindingInfo, createEndpoint, createEndpointInfo, getBus, getProviders, getServiceFactory, isValidClassResourceInfo, setBus, setDataBindingProvider, setModelBeans, setModelBeans, setModelBeansWithServiceClass, setModelRef, setModelRefWithServiceClass, setProvider, setProviderComparator, setProviders, setSchemaLocation, setSchemaLocations, setServiceFactory, setServiceName, setupFactory
      • Methods inherited from class org.apache.cxf.endpoint.AbstractEndpointFactory

        addToBeans, checkPrivateEndpoint, getAddress, getBindingConfig, getBindingFactory, getBindingId, getBus, getConduitSelector, getDataBinding, getDestinationFactory, getEndpointName, getFeatures, getProperties, getProperties, getPublishedEndpointUrl, getServiceName, getTransportId, initializeAnnotationInterceptors, initializeAnnotationInterceptors, initializeAnnotationInterceptors, setAddress, setBindingConfig, setBindingFactory, setBindingId, setConduitSelector, setDataBinding, setDestinationFactory, setEndpointName, setEndpointReference, setFeatures, setProperties, setPublishedEndpointUrl, setTransportId
      • Methods inherited from class org.apache.cxf.interceptor.AbstractBasicInterceptorProvider

        getInFaultInterceptors, getInInterceptors, getOutFaultInterceptors, getOutInterceptors, setInFaultInterceptors, setInInterceptors, setOutFaultInterceptors, setOutInterceptors
    • Field Detail

      • LOG

        protected static final Logger LOG
      • username

        protected String username
      • password

        protected String password
      • inheritHeaders

        protected boolean inheritHeaders
      • headers

        protected javax.ws.rs.core.MultivaluedMap<String,​String> headers
      • threadSafe

        protected boolean threadSafe
      • timeToKeepState

        protected long timeToKeepState
      • serviceClass

        protected Class<?> serviceClass
    • Constructor Detail

      • JAXRSClientFactoryBean

        public JAXRSClientFactoryBean()
      • JAXRSClientFactoryBean

        public JAXRSClientFactoryBean​(org.apache.cxf.jaxrs.JAXRSServiceFactoryBean serviceFactory)
    • Method Detail

      • setClassLoader

        public void setClassLoader​(ClassLoader loader)
        Sets the custom class loader to be used for creating proxies. By default the class loader of the given serviceClass will be used.
        Parameters:
        loader -
      • setThreadSafe

        public void setThreadSafe​(boolean threadSafe)
        Indicates if a single proxy or WebClient instance can be reused by multiple threads.
        Parameters:
        threadSafe - if true then multiple threads can invoke on the same proxy or WebClient instance.
      • setSecondsToKeepState

        public void setSecondsToKeepState​(long time)
        Sets the time a thread-local client state will be kept. This property is ignored for thread-unsafe clients
        Parameters:
        time - secondsToKeepState
      • getUsername

        public String getUsername()
        Gets the user name
        Returns:
        the name
      • setUsername

        public void setUsername​(String username)
        Sets the username. Setting the username and password is a simple way to create a Basic Authentication token.
        Parameters:
        username - the user name
      • getPassword

        public String getPassword()
        Gets the password
        Returns:
        the password
      • setPassword

        public void setPassword​(String password)
        Sets the password. Setting the username and password is a simple way to create a Basic Authentication token.
        Parameters:
        password - the password
      • setInheritHeaders

        public void setInheritHeaders​(boolean ih)
        Indicates if the headers set by a current proxy will be inherited when a subresource proxy is created vice versa.
        Parameters:
        ih - if set to true then the current headers will be inherited
      • setResourceClass

        public void setResourceClass​(Class<?> cls)
        Sets the resource class
        Parameters:
        cls - the resource class
      • setServiceClass

        public void setServiceClass​(Class<?> cls)
        Sets the service class, may be called from a Spring handler
        Parameters:
        cls - the service class
      • getServiceClass

        public Class<?> getServiceClass()
        Returns the service class.
      • setHeaders

        public void setHeaders​(Map<String,​String> map)
        Sets the headers new proxy or WebClient instances will be initialized with.
        Parameters:
        map - the headers
      • getHeaders

        public Map<String,​List<String>> getHeaders()
        Gets the initial headers
        Returns:
        the headers
      • createWebClient

        public WebClient createWebClient()
        Creates a WebClient instance
        Returns:
        WebClient instance
      • notifyLifecycleManager

        protected void notifyLifecycleManager​(Object client)
      • getActualState

        protected ClientState getActualState()
      • create

        public <T> T create​(Class<T> cls,
                            Object... varValues)
        Creates a proxy.
        Parameters:
        cls - the proxy class
        varValues - optional list of values which will be used to substitute template variables specified in the class-level JAX-RS Path annotations
        Returns:
        the proxy
      • create

        public Client create()
        Create a Client instance. Proxies and WebClients are Clients.
        Returns:
        the client
      • createWithValues

        public Client createWithValues​(Object... varValues)
        Create a Client instance. Proxies and WebClients are Clients.
        Parameters:
        varValues - optional list of values which will be used to substitute template variables specified in the class-level JAX-RS Path annotations
        Returns:
        the client
      • createClientProxy

        protected ClientProxyImpl createClientProxy​(org.apache.cxf.jaxrs.model.ClassResourceInfo cri,
                                                    boolean isRoot,
                                                    ClientState actualState,
                                                    Object[] varValues)
      • getConduitSelector

        protected org.apache.cxf.endpoint.ConduitSelector getConduitSelector​(org.apache.cxf.endpoint.Endpoint ep)
      • initClient

        protected void initClient​(AbstractClient client,
                                  org.apache.cxf.endpoint.Endpoint ep,
                                  boolean addHeaders)
      • getConfigurableFor

        protected <C extends javax.ws.rs.core.Configurable<C>> javax.ws.rs.core.Configurable<?> getConfigurableFor​(C context)
      • applyFeatures

        protected void applyFeatures​(AbstractClient client)
      • setInitialState

        public void setInitialState​(ClientState initialState)
        Sets the initial client state, can be a thread-safe state.
        Parameters:
        initialState - the state