public class SecureCxfClientFactory<T> extends Object
Constructor and Description |
---|
SecureCxfClientFactory(String endpointUrl,
Class<T> interfaceClass) |
SecureCxfClientFactory(String endpointUrl,
Class<T> interfaceClass,
List<?> providers,
org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message> interceptor,
boolean disableCnCheck,
boolean allowRedirects) |
SecureCxfClientFactory(String endpointUrl,
Class<T> interfaceClass,
List<?> providers,
org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message> interceptor,
boolean disableCnCheck,
boolean allowRedirects,
Integer connectionTimeout,
Integer receiveTimeout)
Constructs a factory that will return security-aware cxf clients.
|
SecureCxfClientFactory(String endpointUrl,
Class<T> interfaceClass,
List<?> providers,
org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message> interceptor,
boolean disableCnCheck,
boolean allowRedirects,
Integer connectionTimeout,
Integer receiveTimeout,
String username,
String password)
Constructs a factory that will return security-aware cxf clients.
|
SecureCxfClientFactory(String endpointUrl,
Class<T> interfaceClass,
List<?> providers,
org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message> interceptor,
boolean disableCnCheck,
boolean allowRedirects,
PropertyResolver propertyResolver)
Constructs a factory that will return security-aware cxf clients.
|
SecureCxfClientFactory(String endpointUrl,
Class<T> interfaceClass,
String username,
String password) |
Modifier and Type | Method and Description |
---|---|
void |
addOutInterceptors(org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message> inteceptor) |
protected void |
configureTimeouts(org.apache.cxf.jaxrs.client.ClientConfiguration clientConfiguration,
Integer connectionTimeout,
Integer receiveTimeout)
Configures the connection and receive timeouts.
|
T |
getClient() |
T |
getClientForSubject(org.apache.shiro.subject.Subject subject)
Clients produced by this method will be secured with two-way ssl and the provided security
subject.
|
org.apache.cxf.jaxrs.client.WebClient |
getWebClient() |
org.apache.cxf.jaxrs.client.WebClient |
getWebClientForSubject(org.apache.shiro.subject.Subject subject)
Convenience method to get a
WebClient instead of a ClientProxyImpl . |
public SecureCxfClientFactory(String endpointUrl, Class<T> interfaceClass, String username, String password)
public SecureCxfClientFactory(String endpointUrl, Class<T> interfaceClass, List<?> providers, org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message> interceptor, boolean disableCnCheck, boolean allowRedirects)
public SecureCxfClientFactory(String endpointUrl, Class<T> interfaceClass, List<?> providers, org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message> interceptor, boolean disableCnCheck, boolean allowRedirects, PropertyResolver propertyResolver)
WebClient
to interfaceClass will create a generic web client.
This factory can and should be cached. The clients it constructs should not be.
endpointUrl
- the remote url to connect tointerfaceClass
- an interface representing the resource at the remote urlproviders
- optional list of providers to further configure the clientinterceptor
- optional message interceptor for the clientdisableCnCheck
- disable ssl check for common name / host name matchallowRedirects
- allow this client to follow redirectspublic SecureCxfClientFactory(String endpointUrl, Class<T> interfaceClass, List<?> providers, org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message> interceptor, boolean disableCnCheck, boolean allowRedirects, Integer connectionTimeout, Integer receiveTimeout)
WebClient
to interfaceClass will create a generic web client.
This factory can and should be cached. The clients it constructs should not be.
endpointUrl
- the remote url to connect tointerfaceClass
- an interface representing the resource at the remote urlproviders
- optional list of providers to further configure the clientinterceptor
- optional message interceptor for the clientdisableCnCheck
- disable ssl check for common name / host name matchallowRedirects
- allow this client to follow redirectsconnectionTimeout
- timeout for the connectionreceiveTimeout
- timeout for receiving responsespublic SecureCxfClientFactory(String endpointUrl, Class<T> interfaceClass, List<?> providers, org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message> interceptor, boolean disableCnCheck, boolean allowRedirects, Integer connectionTimeout, Integer receiveTimeout, String username, String password)
WebClient
to interfaceClass will create a generic web client.
This factory can and should be cached. The clients it constructs should not be.
This constructor represents a quick fix only.
endpointUrl
- the remote url to connect tointerfaceClass
- an interface representing the resource at the remote urlproviders
- optional list of providers to further configure the clientinterceptor
- optional message interceptor for the clientdisableCnCheck
- disable ssl check for common name / host name matchallowRedirects
- allow this client to follow redirectsconnectionTimeout
- timeout for the connectionreceiveTimeout
- timeout for receiving responsesusername
- a String representing the usernamepassword
- a String representing a passwordpublic T getClient()
public org.apache.cxf.jaxrs.client.WebClient getWebClient()
public T getClientForSubject(org.apache.shiro.subject.Subject subject)
The returned client should NOT be reused between requests! This method should be called for each new request in order to ensure that the security token is up-to-date each time.
public org.apache.cxf.jaxrs.client.WebClient getWebClientForSubject(org.apache.shiro.subject.Subject subject)
WebClient
instead of a ClientProxyImpl
.getClientForSubject(Subject subject)
protected void configureTimeouts(org.apache.cxf.jaxrs.client.ClientConfiguration clientConfiguration, Integer connectionTimeout, Integer receiveTimeout)
clientConfiguration
- Client configuration used for outgoing requests.connectionTimeout
- Connection timeout in milliseconds.receiveTimeout
- Receive timeout in milliseconds.public void addOutInterceptors(org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message> inteceptor)
This work is licensed under a Creative Commons Attribution 4.0 International License.