Class JAXRSClientFactory


  • public final class JAXRSClientFactory
    extends Object
    Factory for creating proxy clients.
    • Method Detail

      • create

        public static <T> T create​(String baseAddress,
                                   Class<T> cls)
        Creates a proxy
        Parameters:
        baseAddress - baseAddress
        cls - resource class, if not interface then a CGLIB proxy will be created
        Returns:
        typed proxy
      • create

        public static <T> T create​(String baseAddress,
                                   Class<T> cls,
                                   ClassLoader loader)
        Creates a proxy using a custom class loader
        Parameters:
        baseAddress - baseAddress
        loader - class loader
        cls - resource class, if not interface then a CGLIB proxy will be created
        Returns:
        typed proxy
      • create

        public static <T> T create​(URI baseURI,
                                   Class<T> cls)
        Creates a proxy
        Parameters:
        baseURI - baseURI
        cls - resource class, if not interface then a CGLIB proxy will be created
        Returns:
        typed proxy
      • create

        public static <T> T create​(URI baseURI,
                                   Class<T> cls,
                                   boolean inheritHeaders)
        Creates a proxy
        Parameters:
        baseURI - baseURI
        cls - resource class, if not interface then a CGLIB proxy will be created
        inheritHeaders - if true then existing proxy headers will be inherited by subresource proxies if any
        Returns:
        typed proxy
      • create

        public static <T> T create​(String baseAddress,
                                   Class<T> cls,
                                   Map<String,​Object> properties)
        Creates a proxy
        Parameters:
        baseAddress - baseAddres
        cls - resource class, if not interface then a CGLIB proxy will be created
        properties - additional properties
        Returns:
        typed proxy
      • create

        public static <T> T create​(String baseAddress,
                                   Class<T> cls,
                                   String configLocation)
        Creates a proxy
        Parameters:
        baseAddress - baseAddress
        cls - resource class, if not interface then a CGLIB proxy will be created
        configLocation - classpath location of the configuration resource
        Returns:
        typed proxy
      • create

        public static <T> T create​(String baseAddress,
                                   Class<T> cls,
                                   String configLocation,
                                   Object... varValues)
        Creates a proxy
        Parameters:
        baseAddress - baseAddress
        cls - resource class, if not interface then a CGLIB proxy will be created This class is expected to have a root JAXRS Path annotation containing template variables, for ex, "/path/{id1}/{id2}"
        configLocation - classpath location of the configuration resource
        varValues - values to replace root Path template variables
        Returns:
        typed proxy
      • create

        public static <T> T create​(String baseAddress,
                                   Class<T> cls,
                                   List<?> providers)
        Creates a proxy
        Parameters:
        baseAddress - baseAddress
        cls - proxy class, if not interface then a CGLIB proxy will be created
        providers - list of providers
        Returns:
        typed proxy
      • create

        public static <T> T create​(String baseAddress,
                                   Class<T> cls,
                                   List<?> providers,
                                   boolean threadSafe)
        Creates a thread safe proxy
        Parameters:
        baseAddress - baseAddress
        cls - proxy class, if not interface then a CGLIB proxy will be created
        providers - list of providers
        threadSafe - if true then a thread-safe proxy will be created
        Returns:
        typed proxy
      • create

        public static <T> T create​(String baseAddress,
                                   Class<T> cls,
                                   List<?> providers,
                                   Map<String,​Object> properties,
                                   boolean threadSafe)
        Creates a thread safe proxy
        Parameters:
        baseAddress - baseAddress
        cls - proxy class, if not interface then a CGLIB proxy will be created
        providers - list of providers
        threadSafe - if true then a thread-safe proxy will be created
        properties - additional properties
        Returns:
        typed proxy
      • create

        public static <T> T create​(String baseAddress,
                                   Class<T> cls,
                                   List<?> providers,
                                   long timeToKeepState)
        Creates a thread safe proxy and allows to specify time to keep state.
        Parameters:
        baseAddress - baseAddress
        cls - proxy class, if not interface then a CGLIB proxy will be created
        providers - list of providers
        timeToKeepState - how long to keep this state
        Returns:
        typed proxy
      • create

        public static <T> T create​(String baseAddress,
                                   Class<T> cls,
                                   List<?> providers,
                                   String configLocation)
        Creates a proxy
        Parameters:
        baseAddress - baseAddress
        cls - proxy class, if not interface then a CGLIB proxy will be created
        providers - list of providers
        configLocation - classpath location of the configuration resource
        Returns:
        typed proxy
      • create

        public static <T> T create​(String baseAddress,
                                   Class<T> cls,
                                   List<?> providers,
                                   List<org.apache.cxf.feature.Feature> features,
                                   String configLocation)
        Creates a proxy
        Parameters:
        baseAddress - baseAddress
        cls - proxy class, if not interface then a CGLIB proxy will be created
        providers - list of providers
        features - the features which will be applied to the client
        configLocation - classpath location of the configuration resource
        Returns:
        typed proxy
      • create

        public static <T> T create​(String baseAddress,
                                   Class<T> cls,
                                   String username,
                                   String password,
                                   String configLocation)
        Creates a proxy which will do basic authentication
        Parameters:
        baseAddress - baseAddress
        cls - proxy class, if not interface then a CGLIB proxy will be created
        username - username
        password - password
        configLocation - classpath location of the configuration resource
        Returns:
        typed proxy
      • create

        public static <T> T create​(String baseAddress,
                                   Class<T> cls,
                                   List<?> providers,
                                   String username,
                                   String password,
                                   String configLocation)
        Creates a proxy which will do basic authentication
        Parameters:
        baseAddress - baseAddress
        cls - proxy class, if not interface then a CGLIB proxy will be created
        providers - list of providers
        username - username
        password - password
        configLocation - classpath location of the configuration resource
        Returns:
        typed proxy
      • createFromModel

        public static <T> T createFromModel​(String baseAddress,
                                            Class<T> cls,
                                            String modelRef,
                                            String configLocation)
        Creates a proxy using user resource model
        Parameters:
        baseAddress - baseAddress
        cls - proxy class, if not interface then a CGLIB proxy will be created
        modelRef - model location
        Returns:
        typed proxy
      • createFromModel

        public static <T> T createFromModel​(String baseAddress,
                                            Class<T> cls,
                                            String modelRef,
                                            List<?> providers,
                                            String configLocation)
        Creates a proxy using user resource model
        Parameters:
        baseAddress - baseAddress
        cls - proxy class, if not interface then a CGLIB proxy will be created
        modelRef - model location
        providers - list of providers
        configLocation - classpath location of the configuration resource
        Returns:
        typed proxy
      • createFromModel

        public static <T> T createFromModel​(String baseAddress,
                                            Class<T> cls,
                                            String modelRef,
                                            List<?> providers,
                                            boolean threadSafe)
        Creates a thread safe proxy using user resource model
        Parameters:
        baseAddress - baseAddress
        cls - proxy class, if not interface then a CGLIB proxy will be created
        modelRef - model location
        providers - list of providers
        threadSafe - if true then thread-safe proxy will be created
        Returns:
        typed proxy
      • createFromModel

        public static <T> T createFromModel​(String baseAddress,
                                            Class<T> cls,
                                            String modelRef,
                                            List<?> providers,
                                            long timeToKeepState)
        Creates a thread safe proxy using user resource model and allows to specify time to keep state.
        Parameters:
        baseAddress - baseAddress
        cls - proxy class, if not interface then a CGLIB proxy will be created
        modelRef - model location
        providers - list of providers
        timeToKeepState - how long to keep this state
        Returns:
        typed proxy
      • createFromModel

        public static <T> T createFromModel​(String baseAddress,
                                            Class<T> cls,
                                            List<org.apache.cxf.jaxrs.model.UserResource> modelBeans,
                                            String configLocation)
        Creates a proxy using user resource model
        Parameters:
        baseAddress - baseAddress
        cls - proxy class, if not interface then a CGLIB proxy will be created
        modelBeans - model beans
        configLocation - classpath location of the configuration resource
        Returns:
        typed proxy
      • createFromModel

        public static <T> T createFromModel​(String baseAddress,
                                            Class<T> cls,
                                            List<org.apache.cxf.jaxrs.model.UserResource> modelBeans,
                                            List<?> providers,
                                            String configLocation)
        Creates a proxy using user resource model
        Parameters:
        baseAddress - baseAddress
        cls - proxy class, if not interface then a CGLIB proxy will be created
        modelBeans - model beans
        providers - list of providers
        configLocation - classpath location of the configuration resource
        Returns:
        typed proxy
      • fromClient

        public static <T> T fromClient​(Client client,
                                       Class<T> cls)
        Creates a proxy, baseURI will be set to Client currentURI
        Parameters:
        client - Client instance
        cls - proxy class, if not interface then a CGLIB proxy will be created
        Returns:
        typed proxy
      • fromClient

        public static <T> T fromClient​(Client client,
                                       Class<T> cls,
                                       boolean inheritHeaders)
        Creates a proxy, baseURI will be set to Client currentURI
        Parameters:
        client - Client instance
        cls - proxy class, if not interface then a CGLIB proxy will be created
        inheritHeaders - if true then existing Client headers will be inherited by new proxy and subresource proxies if any
        Returns:
        typed proxy