Class ResteasyProxyClientFactoryImpl
java.lang.Object
com.peterphi.std.guice.restclient.resteasy.impl.ResteasyProxyClientFactoryImpl
- All Implemented Interfaces:
JAXRSProxyClientFactory
-
Field Summary
Modifier and TypeFieldDescriptionboolean
static final String
A Bearer Token generator that generates Delegated Tokens for an OAuth2 user session when calling other services -
Constructor Summary
ConstructorDescriptionResteasyProxyClientFactoryImpl
(ResteasyClientFactoryImpl clientFactory, GuiceConfig config) -
Method Summary
Modifier and TypeMethodDescription<T> T
createClient
(Class<T> iface, String endpoint) Create a dynamic proxy client for the desired service, setting the base endpoint<T> T
createClient
(Class<T> iface, URI endpoint) Create a dynamic proxy client for the desired service, setting the base endpoint<T> T
createClient
(Class<T> iface, URI endpoint, boolean preemptiveAuth) Create a dynamic proxy client for the desired service, setting the base endpoint<T> T
createClientWithBearerAuth
(Class<T> iface, URI endpoint, Supplier<String> token) Create a dynamic proxy client for the desired service, setting the base endpoint & setting up HTTP Basic auth<T> T
createClientWithPasswordAuth
(Class<T> iface, URI endpoint, String username, String password) Deprecated.<T> T
createClientWithPasswordAuth
(Class<T> iface, URI endpoint, String username, String password, boolean preemptiveAuth) Create a dynamic proxy client for the desired service, setting the base endpoint & setting up HTTP Basic authorg.jboss.resteasy.client.jaxrs.ResteasyWebTarget
createWebTarget
(URI endpoint, String username, String password) Create a WebTarget for a fixed endpoint optionally with a given username and password<T> T
Get a client for the provided interface, searching for the service in configuration using the default name(s)<T> T
Retrieve a Proxy client for the service, searching for the service in configuration using the ordered list of names<T> T
Get a client for the provided interface, building it from the provided WebTargetorg.jboss.resteasy.client.jaxrs.ResteasyWebTarget
getWebTarget
(Class<?> iface, String... names) Retrieve a WebTarget, using the configuration for the named service interface (but not creating a dynamic proxy client)org.jboss.resteasy.client.jaxrs.ResteasyWebTarget
getWebTarget
(String... names) Retrieve a WebTarget for the service, searching for the service in configuration using the ordered list of names
-
Field Details
-
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
-
-
Method Details
-
getWebTarget
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 interfaceJAXRSProxyClientFactory
- 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 interfaceJAXRSProxyClientFactory
- Parameters:
iface
- the service interface to read configuration (endpoint, auth policy, etc.) from- Returns:
-
getClient
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 interfaceJAXRSProxyClientFactory
- Parameters:
iface
- the service iface- Returns:
-
getClient
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 interfaceJAXRSProxyClientFactory
- Parameters:
iface
- the service iface- Returns:
-
getClient
Description copied from interface:JAXRSProxyClientFactory
Get a client for the provided interface, building it from the provided WebTarget- Specified by:
getClient
in interfaceJAXRSProxyClientFactory
- Parameters:
iface
- the service ifacetarget
- 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 interfaceJAXRSProxyClientFactory
- Returns:
-
createClient
Description copied from interface:JAXRSProxyClientFactory
Create a dynamic proxy client for the desired service, setting the base endpoint- Specified by:
createClient
in interfaceJAXRSProxyClientFactory
- Type Parameters:
T
- the type of the service- Parameters:
iface
- the service interfaceendpoint
- a valid URI to use as a base point for the provided service interface- Returns:
- a dynamic proxy for the service
-
createClient
Description copied from interface:JAXRSProxyClientFactory
Create a dynamic proxy client for the desired service, setting the base endpoint- Specified by:
createClient
in interfaceJAXRSProxyClientFactory
- Type Parameters:
T
- the type of the service- Parameters:
iface
- the service interfaceendpoint
- a valid URI to use as a base point for the provided service interface- Returns:
- a dynamic proxy for the service
-
createClient
Description copied from interface:JAXRSProxyClientFactory
Create a dynamic proxy client for the desired service, setting the base endpoint- Specified by:
createClient
in interfaceJAXRSProxyClientFactory
- Type Parameters:
T
- the type of the service- Parameters:
iface
- the service interfaceendpoint
- a valid URI to use as a base point for the provided service interfacepreemptiveAuth
- 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 interfaceJAXRSProxyClientFactory
- Type Parameters:
T
- the type of the service- Parameters:
iface
- the service interfaceendpoint
- a valid URI to use as a base point for the provided service interfaceusername
- the username to usepassword
- the password to use- Returns:
- a dynamic proxy for the service
-
createClientWithBearerAuth
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 interfaceJAXRSProxyClientFactory
- Type Parameters:
T
- the type of the service- Parameters:
iface
- the service interfaceendpoint
- a valid URI to use as a base point for the provided service interfacetoken
- 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 interfaceJAXRSProxyClientFactory
- Type Parameters:
T
- the type of the service- Parameters:
iface
- the service interfaceendpoint
- a valid URI to use as a base point for the provided service interfaceusername
- the username to usepassword
- the password to usepreemptiveAuth
- if true then pre-emptive basic authentication will be used if credentials are also supplied- Returns:
- a dynamic proxy for the service
-