Class HTTPConduit
- All Implemented Interfaces:
PropertyChangeListener,EventListener,org.apache.cxf.configuration.Configurable,org.apache.cxf.transport.Assertor,org.apache.cxf.transport.Conduit,org.apache.cxf.transport.Observable
- Direct Known Subclasses:
URLConnectionHTTPConduit
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classUsed to set appropriate message properties, exchange etc.protected classWrapper output stream responsible for flushing headers and handling the incoming HTTP-level response (not necessarily the MEP response). -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.apache.cxf.configuration.security.AuthorizationPolicyThis field holds the password authorization configuration.protected HttpAuthSupplierImplements the authentication handling when talking to a server.protected final org.apache.cxf.BusThis field holds a reference to the CXF bus associated this conduit.protected CertConstraintsprotected HTTPClientPolicyThis field holds the QoS configuration settings for this conduit.protected Cookiesprotected AddressThis field holds the "default" URI for this particular conduit, which is created on demand.protected final org.apache.cxf.service.model.EndpointInfoThis field is used for two reasons.static final Stringprotected booleanstatic final Stringprotected static final Stringstatic final StringThis constant is the Message(Map) key for the HttpURLConnection that is used to get the response.static final Stringprotected static final LoggerThe Logger for this class.static final Stringstatic final Stringprotected org.apache.cxf.configuration.security.ProxyAuthorizationPolicyThis field holds the password authorization configuration for the configured proxy.protected HttpAuthSupplierImplements the proxy authentication handling.protected ProxyFactorystatic final StringThe HTTP status codes as contextual property (comma-separated integers as String) on the outgoingMessagewhich lead to settingorg.apache.cxf.transport.service_not_availablefor all responses with those status codes.static final Stringprotected org.apache.cxf.configuration.jsse.TLSClientParametersThis field holds the configuration TLS configuration which is programmatically configured.protected MessageTrustDeciderThis field contains the MessageTrustDecider.Fields inherited from class org.apache.cxf.transport.AbstractConduit
targetFields inherited from class org.apache.cxf.transport.AbstractObservable
incomingObserver -
Constructor Summary
ConstructorsConstructorDescriptionHTTPConduit(org.apache.cxf.Bus b, org.apache.cxf.service.model.EndpointInfo ei) ConstructorHTTPConduit(org.apache.cxf.Bus b, org.apache.cxf.service.model.EndpointInfo ei, org.apache.cxf.ws.addressing.EndpointReferenceType t) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidassertMessage(org.apache.cxf.message.Message message) booleanvoidclose()Close the conduitvoidclose(org.apache.cxf.message.Message msg) protected abstract OutputStreamcreateOutputStream(org.apache.cxf.message.Message message, boolean needToCacheRequest, boolean isChunking, int chunkThreshold) protected static intdetermineConnectionTimeout(org.apache.cxf.message.Message message, HTTPClientPolicy csPolicy) protected static intdetermineReceiveTimeout(org.apache.cxf.message.Message message, HTTPClientPolicy csPolicy) protected StringextractLocation(Map<String, List<String>> headers) This method extracts the value of the "Location" Http Response header.voidThis call gets called by the HTTPTransportFactory after it causes an injection of the Spring configuration properties of this Conduit.org.apache.cxf.configuration.security.AuthorizationPolicyThis method gets the Authorization Policy that was configured or explicitly set for this HTTPConduit.This method gets the Auth Supplier that was set/configured for this HTTPConduit.This is part of the Configurable interface which retrieves the configuration from spring injection.This method retrieves the Client Side Policy set/configured for this HTTPConduit.getClient(org.apache.cxf.message.Message message) final StringThis method returns the name of the conduit, which is based on the endpoint name plus the SC_HTTP_CONDUIT_SUFFIX.Allow access to the cookies that the conduit is maintainingorg.apache.cxf.configuration.security.AuthorizationPolicygetEffectiveAuthPolicy(org.apache.cxf.message.Message message) Determines effective auth policy from message, conduit and empty default with priority from first to lastprotected LoggerThis method returns the registered Logger for this conduit.org.apache.cxf.configuration.security.ProxyAuthorizationPolicyThis method retrieves the Proxy Authorization Policy for a proxy that is set/configured for this HTTPConduit.org.apache.cxf.configuration.jsse.TLSClientParametersThis method returns the TLS Client Parameters that is set/configured for this HTTPConduit.This method gets the Trust Decider that was set/configured for this HTTPConduit.protected URIgetURI()protected booleanisChunkingSupported(org.apache.cxf.message.Message message, String httpMethod) protected voidvoidprepare(org.apache.cxf.message.Message message) Prepare to send an outbound HTTP message over this http conduit to a particular endpoint.voidvoidsetAuthorization(org.apache.cxf.configuration.security.AuthorizationPolicy authorization) This method is used to set the Authorization Policy for this conduit.voidsetAuthSupplier(HttpAuthSupplier supplier) voidsetClient(HTTPClientPolicy client) This method sets the Client Side Policy for this HTTPConduit.protected voidsetHeadersByAuthorizationPolicy(org.apache.cxf.message.Message message, URI currentURI) This call places HTTP Header strings into the headers that are relevant to the Authorization policies that are set on this conduit by configuration.voidsetProxyAuthorization(org.apache.cxf.configuration.security.ProxyAuthorizationPolicy proxyAuthorization) This method sets the Proxy Authorization Policy for a specified proxy.voidsetProxyAuthSupplier(HttpAuthSupplier proxyAuthSupplier) voidsetTlsClientParameters(org.apache.cxf.configuration.jsse.TLSClientParameters params) This method sets the TLS Client Parameters for this HTTPConduit.voidsetTrustDecider(MessageTrustDecider decider) This method sets the Trust Decider for this HTTP Conduit.protected abstract voidsetupConnection(org.apache.cxf.message.Message message, Address address, HTTPClientPolicy csPolicy) Methods inherited from class org.apache.cxf.transport.AbstractConduit
getTarget, toStringMethods inherited from class org.apache.cxf.transport.AbstractObservable
activate, deactivate, getMessageObserver, getTargetReference, getTargetReference, setMessageObserverMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.cxf.transport.Observable
getMessageObserver, setMessageObserver
-
Field Details
-
KEY_HTTP_CONNECTION
This constant is the Message(Map) key for the HttpURLConnection that is used to get the response.- See Also:
-
KEY_HTTP_CONNECTION_ADDRESS
- See Also:
-
SET_HTTP_RESPONSE_MESSAGE
- See Also:
-
HTTP_RESPONSE_MESSAGE
- See Also:
-
PROCESS_FAULT_ON_HTTP_400
- See Also:
-
NO_IO_EXCEPTIONS
- See Also:
-
FORCE_HTTP_VERSION
- See Also:
-
SERVICE_NOT_AVAILABLE_ON_HTTP_STATUS_CODES
The HTTP status codes as contextual property (comma-separated integers as String) on the outgoingMessagewhich lead to settingorg.apache.cxf.transport.service_not_availablefor all responses with those status codes. This is used e.g. by theorg.apache.cxf.clustering.FailoverTargetSelectorto determine if it should do the fail-over. Default:404,429,503as perDEFAULT_SERVICE_NOT_AVAILABLE_ON_HTTP_STATUS_CODES- See Also:
-
LOG
The Logger for this class. -
KNOWN_HTTP_VERBS_WITH_NO_CONTENT
-
HTTP_VERSION
-
bus
protected final org.apache.cxf.Bus busThis field holds a reference to the CXF bus associated this conduit. -
endpointInfo
protected final org.apache.cxf.service.model.EndpointInfo endpointInfoThis field is used for two reasons. First it provides the base name for the conduit for Spring configuration. The other is to hold default address information, should it not be supplied in the Message Map, by the Message.ENDPOINT_ADDRESS property. -
defaultAddress
This field holds the "default" URI for this particular conduit, which is created on demand. -
fromEndpointReferenceType
protected boolean fromEndpointReferenceType -
proxyFactory
-
clientSidePolicy
This field holds the QoS configuration settings for this conduit. This field is injected via spring configuration based on the conduit name. -
authorizationPolicy
protected org.apache.cxf.configuration.security.AuthorizationPolicy authorizationPolicyThis field holds the password authorization configuration. This field is injected via spring configuration based on the conduit name. -
proxyAuthorizationPolicy
protected org.apache.cxf.configuration.security.ProxyAuthorizationPolicy proxyAuthorizationPolicyThis field holds the password authorization configuration for the configured proxy. This field is injected via spring configuration based on the conduit name. -
tlsClientParameters
protected org.apache.cxf.configuration.jsse.TLSClientParameters tlsClientParametersThis field holds the configuration TLS configuration which is programmatically configured. -
trustDecider
This field contains the MessageTrustDecider. -
authSupplier
Implements the authentication handling when talking to a server. If it is not set it will be created from the authorizationPolicy.authType -
proxyAuthSupplier
Implements the proxy authentication handling. If it is not set it will be created from the proxyAuthorizationPolicy.authType -
cookies
-
certConstraints
-
-
Constructor Details
-
HTTPConduit
public HTTPConduit(org.apache.cxf.Bus b, org.apache.cxf.service.model.EndpointInfo ei) throws IOException Constructor- Parameters:
b- the associated Busei- the endpoint info of the initiator- Throws:
IOException
-
HTTPConduit
public HTTPConduit(org.apache.cxf.Bus b, org.apache.cxf.service.model.EndpointInfo ei, org.apache.cxf.ws.addressing.EndpointReferenceType t) throws IOException Constructor- Parameters:
b- the associated Bus.ei- the endpoint info of the initiator.t- the endpoint reference of the target.- Throws:
IOException
-
-
Method Details
-
getLogger
This method returns the registered Logger for this conduit.- Specified by:
getLoggerin classorg.apache.cxf.transport.AbstractObservable
-
getConduitName
This method returns the name of the conduit, which is based on the endpoint name plus the SC_HTTP_CONDUIT_SUFFIX.- Returns:
-
finalizeConfig
public void finalizeConfig()This call gets called by the HTTPTransportFactory after it causes an injection of the Spring configuration properties of this Conduit. -
getCookies
Allow access to the cookies that the conduit is maintaining- Returns:
- the sessionCookies map
-
setupConnection
protected abstract void setupConnection(org.apache.cxf.message.Message message, Address address, HTTPClientPolicy csPolicy) throws IOException - Throws:
IOException
-
prepare
Prepare to send an outbound HTTP message over this http conduit to a particular endpoint.If the Message.PATH_INFO property is set it gets appended to the Conduit's endpoint URL. If the Message.QUERY_STRING property is set, it gets appended to the resultant URL following a "?".
If the Message.HTTP_REQUEST_METHOD property is NOT set, the Http request method defaults to "POST".
If the Message.PROTOCOL_HEADERS is not set on the message, it is initialized to an empty map.
This call creates the OutputStream for the content of the message. It also assigns the created Http(s)URLConnection to the Message Map.
- Specified by:
preparein interfaceorg.apache.cxf.transport.Conduit- Parameters:
message- The message to be sent.- Throws:
IOException
-
isChunkingSupported
-
createOutputStream
protected abstract OutputStream createOutputStream(org.apache.cxf.message.Message message, boolean needToCacheRequest, boolean isChunking, int chunkThreshold) throws IOException - Throws:
IOException
-
determineReceiveTimeout
protected static int determineReceiveTimeout(org.apache.cxf.message.Message message, HTTPClientPolicy csPolicy) -
determineConnectionTimeout
protected static int determineConnectionTimeout(org.apache.cxf.message.Message message, HTTPClientPolicy csPolicy) -
close
- Specified by:
closein interfaceorg.apache.cxf.transport.Conduit- Overrides:
closein classorg.apache.cxf.transport.AbstractConduit- Throws:
IOException
-
close
public void close()Close the conduit- Specified by:
closein interfaceorg.apache.cxf.transport.Conduit- Overrides:
closein classorg.apache.cxf.transport.AbstractConduit
-
getAddress
- Returns:
- the default target address
-
getURI
- Returns:
- the default target URL
- Throws:
URISyntaxException
-
setHeadersByAuthorizationPolicy
protected void setHeadersByAuthorizationPolicy(org.apache.cxf.message.Message message, URI currentURI) This call places HTTP Header strings into the headers that are relevant to the Authorization policies that are set on this conduit by configuration.An AuthorizationPolicy may also be set on the message. If so, those policies are merged. A user name or password set on the messsage overrides settings in the AuthorizationPolicy is retrieved from the configuration.
The precedence is as follows: 1. AuthorizationPolicy that is set on the Message, if exists. 2. Authorization from AuthSupplier, if exists. 3. AuthorizationPolicy set/configured for conduit. REVISIT: Since the AuthorizationPolicy is set on the message by class, then how does one override the ProxyAuthorizationPolicy which is the same type?
- Parameters:
message-currentURI-
-
getBeanName
This is part of the Configurable interface which retrieves the configuration from spring injection.- Specified by:
getBeanNamein interfaceorg.apache.cxf.configuration.Configurable
-
getEffectiveAuthPolicy
public org.apache.cxf.configuration.security.AuthorizationPolicy getEffectiveAuthPolicy(org.apache.cxf.message.Message message) Determines effective auth policy from message, conduit and empty default with priority from first to last- Parameters:
message-- Returns:
- effective AthorizationPolicy
-
getAuthorization
public org.apache.cxf.configuration.security.AuthorizationPolicy getAuthorization()This method gets the Authorization Policy that was configured or explicitly set for this HTTPConduit. -
setAuthorization
public void setAuthorization(org.apache.cxf.configuration.security.AuthorizationPolicy authorization) This method is used to set the Authorization Policy for this conduit. Using this method will override any Authorization Policy set in configuration. -
getClient
-
getClient
This method retrieves the Client Side Policy set/configured for this HTTPConduit. -
setClient
This method sets the Client Side Policy for this HTTPConduit. Using this method will override any HTTPClientPolicy set in configuration. -
getProxyAuthorization
public org.apache.cxf.configuration.security.ProxyAuthorizationPolicy getProxyAuthorization()This method retrieves the Proxy Authorization Policy for a proxy that is set/configured for this HTTPConduit. -
setProxyAuthorization
public void setProxyAuthorization(org.apache.cxf.configuration.security.ProxyAuthorizationPolicy proxyAuthorization) This method sets the Proxy Authorization Policy for a specified proxy. Using this method overrides any Authorization Policy for the proxy that is set in the configuration. -
getTlsClientParameters
public org.apache.cxf.configuration.jsse.TLSClientParameters getTlsClientParameters()This method returns the TLS Client Parameters that is set/configured for this HTTPConduit. -
setTlsClientParameters
public void setTlsClientParameters(org.apache.cxf.configuration.jsse.TLSClientParameters params) This method sets the TLS Client Parameters for this HTTPConduit. Using this method overrides any TLS Client Parameters that is configured for this HTTPConduit. -
getTrustDecider
This method gets the Trust Decider that was set/configured for this HTTPConduit.- Returns:
- The Message Trust Decider or null.
-
setTrustDecider
This method sets the Trust Decider for this HTTP Conduit. Using this method overrides any trust decider configured for this HTTPConduit. -
getAuthSupplier
This method gets the Auth Supplier that was set/configured for this HTTPConduit.- Returns:
- The Auth Supplier or null.
-
setAuthSupplier
-
getProxyAuthSupplier
-
setProxyAuthSupplier
-
extractLocation
This method extracts the value of the "Location" Http Response header.- Parameters:
headers- The Http response headers.- Returns:
- The value of the "Location" header, null if non-existent.
- Throws:
MalformedURLException
-
logStackTrace
-
assertMessage
public void assertMessage(org.apache.cxf.message.Message message) - Specified by:
assertMessagein interfaceorg.apache.cxf.transport.Assertor
-
canAssert
- Specified by:
canAssertin interfaceorg.apache.cxf.transport.Assertor
-
propertyChange
- Specified by:
propertyChangein interfacePropertyChangeListener
-