Class ResteasyProxyClientFactoryImpl

java.lang.Object
com.peterphi.std.guice.restclient.resteasy.impl.ResteasyProxyClientFactoryImpl
All Implemented Interfaces:
JAXRSProxyClientFactory

public class ResteasyProxyClientFactoryImpl extends Object implements JAXRSProxyClientFactory
  • Field Details

    • OAUTH_DELEGATING_BEARER_GENERATOR

      public static final String OAUTH_DELEGATING_BEARER_GENERATOR
      A Bearer Token generator that generates Delegated Tokens for an OAuth2 user session when calling other services
      See Also:
    • defaultStoreCookies

      @Inject(optional=true) public boolean defaultStoreCookies
  • Constructor Details

    • ResteasyProxyClientFactoryImpl

      public ResteasyProxyClientFactoryImpl()
    • ResteasyProxyClientFactoryImpl

      public ResteasyProxyClientFactoryImpl(ResteasyClientFactoryImpl clientFactory, GuiceConfig config)
  • Method Details

    • getWebTarget

      public org.jboss.resteasy.client.jaxrs.ResteasyWebTarget getWebTarget(String... names)
      Description copied from interface: JAXRSProxyClientFactory
      Retrieve a WebTarget for the service, searching for the service in configuration using the ordered list of names
      Specified by:
      getWebTarget in interface JAXRSProxyClientFactory
      Returns:
    • getWebTarget

      public org.jboss.resteasy.client.jaxrs.ResteasyWebTarget getWebTarget(Class<?> iface, String... names)
      Description copied from interface: JAXRSProxyClientFactory
      Retrieve a WebTarget, using the configuration for the named service interface (but not creating a dynamic proxy client)
      Specified by:
      getWebTarget in interface JAXRSProxyClientFactory
      Parameters:
      iface - the service interface to read configuration (endpoint, auth policy, etc.) from
      Returns:
    • getClient

      public <T> T getClient(Class<T> iface, String... names)
      Description copied from interface: JAXRSProxyClientFactory
      Retrieve a Proxy client for the service, searching for the service in configuration using the ordered list of names
      Specified by:
      getClient in interface JAXRSProxyClientFactory
      Parameters:
      iface - the service iface
      Returns:
    • getClient

      public <T> T getClient(Class<T> iface)
      Description copied from interface: JAXRSProxyClientFactory
      Get a client for the provided interface, searching for the service in configuration using the default name(s)
      Specified by:
      getClient in interface JAXRSProxyClientFactory
      Parameters:
      iface - the service iface
      Returns:
    • getClient

      public <T> T getClient(Class<T> iface, javax.ws.rs.client.WebTarget target)
      Description copied from interface: JAXRSProxyClientFactory
      Get a client for the provided interface, building it from the provided WebTarget
      Specified by:
      getClient in interface JAXRSProxyClientFactory
      Parameters:
      iface - the service iface
      target - the WebTarget to use to build the dynamic proxy client
      Returns:
    • createWebTarget

      public org.jboss.resteasy.client.jaxrs.ResteasyWebTarget createWebTarget(URI endpoint, String username, String password)
      Description copied from interface: JAXRSProxyClientFactory
      Create a WebTarget for a fixed endpoint optionally with a given username and password
      Specified by:
      createWebTarget in interface JAXRSProxyClientFactory
      Returns:
    • createClient

      public <T> T createClient(Class<T> iface, String endpoint)
      Description copied from interface: JAXRSProxyClientFactory
      Create a dynamic proxy client for the desired service, setting the base endpoint
      Specified by:
      createClient in interface JAXRSProxyClientFactory
      Type Parameters:
      T - the type of the service
      Parameters:
      iface - the service interface
      endpoint - a valid URI to use as a base point for the provided service interface
      Returns:
      a dynamic proxy for the service
    • createClient

      public <T> T createClient(Class<T> iface, URI endpoint)
      Description copied from interface: JAXRSProxyClientFactory
      Create a dynamic proxy client for the desired service, setting the base endpoint
      Specified by:
      createClient in interface JAXRSProxyClientFactory
      Type Parameters:
      T - the type of the service
      Parameters:
      iface - the service interface
      endpoint - a valid URI to use as a base point for the provided service interface
      Returns:
      a dynamic proxy for the service
    • createClient

      public <T> T createClient(Class<T> iface, URI endpoint, boolean preemptiveAuth)
      Description copied from interface: JAXRSProxyClientFactory
      Create a dynamic proxy client for the desired service, setting the base endpoint
      Specified by:
      createClient in interface JAXRSProxyClientFactory
      Type Parameters:
      T - the type of the service
      Parameters:
      iface - the service interface
      endpoint - a valid URI to use as a base point for the provided service interface
      preemptiveAuth - if true, enable pre-emptive basic authentication
      Returns:
      a dynamic proxy for the service
    • createClientWithPasswordAuth

      @Deprecated public <T> T createClientWithPasswordAuth(Class<T> iface, URI endpoint, String username, String password)
      Deprecated.
      Description copied from interface: JAXRSProxyClientFactory
      Create a dynamic proxy client for the desired service, setting the base endpoint & setting up HTTP Basic auth
      Specified by:
      createClientWithPasswordAuth in interface JAXRSProxyClientFactory
      Type Parameters:
      T - the type of the service
      Parameters:
      iface - the service interface
      endpoint - a valid URI to use as a base point for the provided service interface
      username - the username to use
      password - the password to use
      Returns:
      a dynamic proxy for the service
    • createClientWithBearerAuth

      public <T> T createClientWithBearerAuth(Class<T> iface, URI endpoint, Supplier<String> token)
      Description copied from interface: JAXRSProxyClientFactory
      Create a dynamic proxy client for the desired service, setting the base endpoint & setting up HTTP Basic auth
      Specified by:
      createClientWithBearerAuth in interface JAXRSProxyClientFactory
      Type Parameters:
      T - the type of the service
      Parameters:
      iface - the service interface
      endpoint - a valid URI to use as a base point for the provided service interface
      token - a supplier that will be asked to provide a token for each HTTP call
      Returns:
      a dynamic proxy for the service
    • createClientWithPasswordAuth

      public <T> T createClientWithPasswordAuth(Class<T> iface, URI endpoint, String username, String password, boolean preemptiveAuth)
      Description copied from interface: JAXRSProxyClientFactory
      Create a dynamic proxy client for the desired service, setting the base endpoint & setting up HTTP Basic auth
      Specified by:
      createClientWithPasswordAuth in interface JAXRSProxyClientFactory
      Type Parameters:
      T - the type of the service
      Parameters:
      iface - the service interface
      endpoint - a valid URI to use as a base point for the provided service interface
      username - the username to use
      password - the password to use
      preemptiveAuth - if true then pre-emptive basic authentication will be used if credentials are also supplied
      Returns:
      a dynamic proxy for the service