Author: buildbot
Date: Thu Apr 11 11:56:52 2019
New Revision: 1043478
Log:
Production update by buildbot for cxf
Modified:
websites/production/cxf/content/cache/docs.pageCache
websites/production/cxf/content/docs/client-http-transport-including-ssl-support.html
Modified: websites/production/cxf/content/cache/docs.pageCache
==============================================================================
Binary files - no diff available.
Modified:
websites/production/cxf/content/docs/client-http-transport-including-ssl-support.html
==============================================================================
---
websites/production/cxf/content/docs/client-http-transport-including-ssl-support.html
(original)
+++
websites/production/cxf/content/docs/client-http-transport-including-ssl-support.html
Thu Apr 11 11:56:52 2019
@@ -119,15 +119,15 @@ Apache CXF -- Client HTTP Transport (inc
<!-- Content -->
<div class="wiki-content">
<div id="ConfluenceContent"><p><style type="text/css">/*<![CDATA[*/
-div.rbtoc1536659841013 {padding: 0px;}
-div.rbtoc1536659841013 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1536659841013 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1554983772071 {padding: 0px;}
+div.rbtoc1554983772071 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1554983772071 li {margin-left: 0px;padding-left: 0px;}
-/*]]>*/</style></p><div class="toc-macro rbtoc1536659841013">
+/*]]>*/</style></p><div class="toc-macro rbtoc1554983772071">
<ul class="toc-indentation"><li><a shape="rect"
href="#ClientHTTPTransport(includingSSLsupport)-Authentication">Authentication</a>
<ul class="toc-indentation"><li><a shape="rect"
href="#ClientHTTPTransport(includingSSLsupport)-BasicAuthentication">Basic
Authentication</a></li><li><a shape="rect"
href="#ClientHTTPTransport(includingSSLsupport)-DigestAuthentication">Digest
Authentication</a></li><li><a shape="rect"
href="#ClientHTTPTransport(includingSSLsupport)-Supplyingdynamicauthorization">Supplying
dynamic authorization</a></li><li><a shape="rect"
href="#ClientHTTPTransport(includingSSLsupport)-SpnegoAuthentication(Kerberos)">Spnego
Authentication (Kerberos)</a>
<ul class="toc-indentation"><li><a shape="rect"
href="#ClientHTTPTransport(includingSSLsupport)-CredentialDelegation">Credential
Delegation</a></li></ul>
-</li><li><a shape="rect"
href="#ClientHTTPTransport(includingSSLsupport)-NTLMAuthentication">NTLM
Authentication</a></li></ul>
+</li><li><a shape="rect"
href="#ClientHTTPTransport(includingSSLsupport)-NTLMAuthentication">NTLM
Authentication</a></li><li><a shape="rect"
href="#ClientHTTPTransport(includingSSLsupport)-ProxyAuthentication">Proxy
Authentication</a></li></ul>
</li><li><a shape="rect"
href="#ClientHTTPTransport(includingSSLsupport)-ConfiguringSSLSupport">Configuring
SSL Support</a></li><li><a shape="rect"
href="#ClientHTTPTransport(includingSSLsupport)-AdvancedConfiguration">Advanced
Configuration</a>
<ul class="toc-indentation"><li><a shape="rect"
href="#ClientHTTPTransport(includingSSLsupport)-UsingConfiguration">Using
Configuration</a>
<ul class="toc-indentation"><li><a shape="rect"
href="#ClientHTTPTransport(includingSSLsupport)-Namespace">Namespace</a></li><li><a
shape="rect"
href="#ClientHTTPTransport(includingSSLsupport)-Theconduitelement">The conduit
element</a></li><li><a shape="rect"
href="#ClientHTTPTransport(includingSSLsupport)-Theclientelement">The client
element</a>
@@ -150,7 +150,7 @@ div.rbtoc1536659841013 li {margin-left:
</authorization>
</conduit>
</pre>
-</div></div><p>Note: The AuthorizationType element can be omitted if you're
using Basic authentication, as above.</p><h2
id="ClientHTTPTransport(includingSSLsupport)-DigestAuthentication">Digest
Authentication</h2><p>Same as above but use AuthorizationType "Digest".</p><h2
id="ClientHTTPTransport(includingSSLsupport)-Supplyingdynamicauthorization">Supplying
dynamic authorization</h2><p>You can implement the
org.apache.cxf.transport.http.auth.HttpAuthSupplier interface or one of its
implementations.</p><p>The main method this interface provides is:<br
clear="none"> public String getAuthorization(AuthorizationPolicy authPolicy,
URL currentURL, Message message, String fullHeader);</p><p>So you get the
HttpAuthPolicy, the service URL, the CXF message and the full Authorization
header. The fullHeader is the Authorization Header the server sent after the
last try. This way you can implement multi phase authentications. You are
expected to return the authorization Header to send to the ser
ver. For a simple implementation you can look at
org.apache.cxf.transport.http.auth.DefaultBasicAuthSupplier.</p><p>If you set
your implementation class as AuthSupplier on the conduit CXF will use
it.</p><h2
id="ClientHTTPTransport(includingSSLsupport)-SpnegoAuthentication(Kerberos)">Spnego
Authentication (Kerberos)</h2><p>Starting with CXF 2.4.0 CXF supports Spnego
authentication using the standard AuthPolicy mechanism. Spnego is activated by
setting the AuthPolicy.authorizationType to 'Negotiate'. If userName is left
blank then single sign on is used with the TGT from e.g. Windows Login. If
userName is set then a new LoginContext is established and the ticket is
created out of this.</p><p>By default the SpnegoAuthSupplier uses the OID for
Spnego. Some servers require the OID for Kerberos. This can be activated by
setting the contextual property auth.spnego.useKerberosOid to
'true'.</p><p>Kerberos Config:</p><p>Make sure that krb5.conf/krb5.ini is
configured correctly for the Kerbe
ros realm you want to authenticate against<br clear="none"> and supply it to
your application by setting the java.security.krb5.conf system
property</p><p>Login Config:</p><p>Create a file login.conf and supply it to
CXF using the System property java.security.auth.login.config.</p><p>The file
should contain:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+</div></div><p>Note: The AuthorizationType element can be omitted if you're
using Basic authentication, as above.</p><h2
id="ClientHTTPTransport(includingSSLsupport)-DigestAuthentication">Digest
Authentication</h2><p>Same as above but use AuthorizationType "Digest".</p><h2
id="ClientHTTPTransport(includingSSLsupport)-Supplyingdynamicauthorization">Supplying
dynamic authorization</h2><p>You can implement the
org.apache.cxf.transport.http.auth.HttpAuthSupplier interface or one of its
implementations.</p><p>The main method this interface provides is:<br
clear="none">public String getAuthorization(AuthorizationPolicy authPolicy, URL
currentURL, Message message, String fullHeader);</p><p>So you get the
HttpAuthPolicy, the service URL, the CXF message and the full Authorization
header. The fullHeader is the Authorization Header the server sent after the
last try. This way you can implement multi phase authentications. You are
expected to return the authorization Header to send to the serv
er. For a simple implementation you can look at
org.apache.cxf.transport.http.auth.DefaultBasicAuthSupplier.</p><p>If you set
your implementation class as AuthSupplier on the conduit CXF will use
it.</p><h2
id="ClientHTTPTransport(includingSSLsupport)-SpnegoAuthentication(Kerberos)">Spnego
Authentication (Kerberos)</h2><p>Starting with CXF 2.4.0 CXF supports Spnego
authentication using the standard AuthPolicy mechanism. Spnego is activated by
setting the AuthPolicy.authorizationType to 'Negotiate'. If userName is left
blank then single sign on is used with the TGT from e.g. Windows Login. If
userName is set then a new LoginContext is established and the ticket is
created out of this.</p><p>By default the SpnegoAuthSupplier uses the OID for
Spnego. Some servers require the OID for Kerberos. This can be activated by
setting the contextual property auth.spnego.useKerberosOid to
'true'.</p><p>Kerberos Config:</p><p>Make sure that krb5.conf/krb5.ini is
configured correctly for the Kerber
os realm you want to authenticate against<br clear="none">and supply it to
your application by setting the java.security.krb5.conf system
property</p><p>Login Config:</p><p>Create a file login.conf and supply it to
CXF using the System property java.security.auth.login.config.</p><p>The file
should contain:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">CXFClient {
com.sun.security.auth.module.Krb5LoginModule required client=TRUE
useTicketCache=true;
};
@@ -185,7 +185,7 @@ div.rbtoc1536659841013 li {margin-left:
</conduit>
...
</pre>
-</div></div><h2
id="ClientHTTPTransport(includingSSLsupport)-NTLMAuthentication">NTLM
Authentication</h2><p>CXF doesn't support NTLM authentication "out of the box"
on Java 5, but with some additional libraries and configuration, the standard
HttpURLConnection objects that we use can do the NTLM authentication. On Java
6, NTLM authentication is built into the Java runtime and you don't need to do
anything special.</p><p>On Java 5, you need a library that will augment the
HttpURLConnection to do it. See: <a shape="rect" class="external-link"
href="http://jcifs.samba.org/src/docs/httpclient.html"
rel="nofollow">http://jcifs.samba.org/src/docs/httpclient.html</a> Note: jcifs
is LGPL licensed, not Apache licensed.</p><p>Next, you need to configure jcifs
to use the correct domains, wins servers, etc... Notice that the<br
clear="none"> bit which sets the username/password to use for NTLM is commented
out. If credentials are<br clear="none"> missing jcifs will use the underlying
NT credent
ials.</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+</div></div><h2
id="ClientHTTPTransport(includingSSLsupport)-NTLMAuthentication">NTLM
Authentication</h2><p>CXF doesn't support NTLM authentication "out of the box"
on Java 5, but with some additional libraries and configuration, the standard
HttpURLConnection objects that we use can do the NTLM authentication. On Java
6, NTLM authentication is built into the Java runtime and you don't need to do
anything special.</p><p>On Java 5, you need a library that will augment the
HttpURLConnection to do it. See: <a shape="rect" class="external-link"
href="http://jcifs.samba.org/src/docs/httpclient.html"
rel="nofollow">http://jcifs.samba.org/src/docs/httpclient.html</a> Note: jcifs
is LGPL licensed, not Apache licensed.</p><p>Next, you need to configure jcifs
to use the correct domains, wins servers, etc... Notice that the<br
clear="none">bit which sets the username/password to use for NTLM is commented
out. If credentials are<br clear="none">missing jcifs will use the underlying
NT credentia
ls.</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">//Set the jcifs
properties
jcifs.Config.setProperty("jcifs.smb.client.domain", "ben.com");
jcifs.Config.setProperty("jcifs.netbios.wins", "xxx.xxx.xxx.xxx");
@@ -206,7 +206,19 @@ httpClientPolicy.setConnectionTimeout(36
httpClientPolicy.setAllowChunking(false);
http.setClient(httpClientPolicy);
</pre>
-</div></div><p>Please also see <a shape="rect"
href="https://cwiki.apache.org/confluence/display/CXF20DOC/Asynchronous+Client+HTTP+Transport">Asynchronous
HTTP Conduit</a> for more information on NTLM.</p><h1
id="ClientHTTPTransport(includingSSLsupport)-ConfiguringSSLSupport">Configuring
SSL Support</h1><p>When using an "https" URL, CXF will, by default, use the
certs and keystores that are part of the JDK. For many HTTPs applications, that
is enough and no configuration is necessary. However, when using custom client
certificates or self signed server certificates or similar, you may need to
specifically configure in the keystores and trust managers and such to
establish the SSL connection.</p><p>To configure your client to use SSL, you'll
need to add an <http:conduit> definition to your XML configuration file.
See the <a shape="rect" href="configuration.html">Configuration</a> guide to
learn how to supply your own XML configuration file to CXF. If you are already
using Sprin
g, this can be added to your existing beans definitions.</p><p>A <a
shape="rect" class="external-link"
href="https://github.com/apache/cxf/tree/master/distribution/src/main/release/samples/wsdl_first_https/"
rel="nofollow">wsdl_first_https</a> sample can be found in the CXF
distribution with more detail. Also see this <a shape="rect"
class="external-link"
href="http://techpolesen.blogspot.com/2007/08/using-ssl-with-xfirecxf-battling.html"
rel="nofollow">blog entry</a> for another example.</p><p>Here is a sample of
what your conduit definition might look like:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>Please also see <a shape="rect"
href="https://cwiki.apache.org/confluence/display/CXF20DOC/Asynchronous+Client+HTTP+Transport">Asynchronous
HTTP Conduit</a> for more information on NTLM.</p><h2
id="ClientHTTPTransport(includingSSLsupport)-ProxyAuthentication">Proxy
Authentication</h2><p>Proxy authentication can be configured as
follows.</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default"> <conduit
name="{http://example.com/}HelloWorldServicePort.http-conduit"
+ xmlns:sec="http://cxf.apache.org/configuration/security"
+ xmlns="http://cxf.apache.org/transports/http/configuration">
+ <proxyAuthorization>
+ <sec:UserName>myuser</sec:UserName>
+ <sec:Password>mypasswd</sec:Password>
+ </proxyAuthorization>
+ <client AllowChunking="false" ProxyServer="localhost"
ProxyServerPort="8080" />
+ </conduit></pre>
+</div></div><p>This works over HTTPS and HTTPS, but note for the latter it is
necessary to set the following system property (see <a shape="rect"
class="external-link"
href="https://www.oracle.com/technetwork/java/javase/8u111-relnotes-3124969.html"
rel="nofollow">here</a> for more information "Disable Basic authentication for
HTTPS tunneling"):</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme:
Default">-Djdk.http.auth.tunneling.disabledSchemes=</pre>
+</div></div><p><br clear="none"></p><h1
id="ClientHTTPTransport(includingSSLsupport)-ConfiguringSSLSupport">Configuring
SSL Support</h1><p>When using an "https" URL, CXF will, by default, use the
certs and keystores that are part of the JDK. For many HTTPs applications, that
is enough and no configuration is necessary. However, when using custom client
certificates or self signed server certificates or similar, you may need to
specifically configure in the keystores and trust managers and such to
establish the SSL connection.</p><p>To configure your client to use SSL, you'll
need to add an <http:conduit> definition to your XML configuration file.
See the <a shape="rect" href="configuration.html">Configuration</a> guide to
learn how to supply your own XML configuration file to CXF. If you are already
using Spring, this can be added to your existing beans definitions.</p><p>A <a
shape="rect" class="external-link"
href="https://github.com/apache/cxf/tree/master/distribution/src/m
ain/release/samples/wsdl_first_https/" rel="nofollow">wsdl_first_https</a>
sample can be found in the CXF distribution with more detail. Also see this <a
shape="rect" class="external-link"
href="http://techpolesen.blogspot.com/2007/08/using-ssl-with-xfirecxf-battling.html"
rel="nofollow">blog entry</a> for another example.</p><p>Here is a sample of
what your conduit definition might look like:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default"><beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:sec="http://cxf.apache.org/configuration/security"
@@ -287,7 +299,7 @@ http.setClient(httpClientPolicy);
</http-conf:conduit>
...
</pre>
-</div></div><p>The <code>http-conf:conduit</code> element has a number of
child elements that specify configuration information. They are described
below. See also Sun's <a shape="rect" class="external-link"
href="http://java.sun.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html"
rel="nofollow">JSSE Guide</a> for more information on configuring SSL.</p><div
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1"
rowspan="1" class="confluenceTh"><p>Element</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>http-conf:client</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the HTTP connection
properties such as timeouts, keep-alive requests, content types,
etc.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>http-conf:authorization</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Sp
ecifies the the parameters for configuring the basic authentication method
that the endpoint uses preemptively.</p></td></tr><tr><td colspan="1"
rowspan="1"
class="confluenceTd"><p><code>http-conf:proxyAuthorization</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the parameters for
configuring basic authentication against outgoing HTTP proxy
servers.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>http-conf:tlsClientParameters</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the parameters used
to configure SSL/TLS.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>http-conf:authSupplier</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the bean reference or
class name of the object that supplies the authentication information used by
the endpoint both preemptively or in response to a 401 HTTP
challenge.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>http-conf:trustDecider</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the bean reference or
class name of the object that checks the HTTP(S) URLConnection object in order
to establish trust for a connection with an HTTPS service provider before any
information is transmitted.</p></td></tr></tbody></table></div><h3
id="ClientHTTPTransport(includingSSLsupport)-Theclientelement">The
<code>client</code> element</h3><p>The <code>http-conf:client</code> element is
used to configure the non-security properties of a client's HTTP connection.
Its attributes, described below, specify the connection's properties.</p><div
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1"
rowspan="1" class="confluenceTh"><p>Attribute</p></th><th colspan="1"
rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>ConnectionTimeout</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies the amount of time, in
milliseconds, that the client will attempt to establish a connection before it
times out. The default is 30000 (30 seconds). <br clear="none"
class="atl-forced-newline"> 0 specifies that the client will continue to
attempt to open a connection indefinitely.</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>ReceiveTimeout</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the amount of time,
in milliseconds, that the client will wait for a response before it times out.
The default is 60000. <br clear="none" class="atl-forced-newline"> 0 specifies
that the client will wait indefinitely.</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>AutoRedirect</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Specifies if the client will
automatically follow a server issued redirection. The default is
false.</p></td></tr><tr><td colspan=
"1" rowspan="1"
class="confluenceTd"><p><code>MaxRetransmits</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies the maximum number of times a
client will retransmit a request to satisfy a redirect. The default is -1 which
specifies that unlimited retransmissions are allowed.</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>AllowChunking</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies whether the client will send
requests using chunking. The default is true which specifies that the client
will use chunking when sending requests. <br clear="none"
class="atl-forced-newline"> Chunking cannot be used used if either of the
following are true:</p><ul><li><code>http-conf:basicAuthSupplier</code> is
configured to provide credentials
preemptively.</li><li><code>AutoRedirect</code> is set to true. <br
clear="none" class="atl-forced-newline"> In both cases the value of
<code>AllowChunking</code> is ignored and chun
king is disallowed. <br clear="none" class="atl-forced-newline"> See note
about chunking below.</li></ul></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>ChunkingThreshold</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies the threshold at which CXF will
switch from non-chunking to chunking. By default, messages less than 4K are
buffered and sent non-chunked. Once this threshold is reached, the message is
chunked.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>Accept</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Specifies what media types the client is prepared to
handle. The value is used as the value of the HTTP <code>Accept</code>
property. The value of the attribute is specified using as multipurpose
internet mail extensions (MIME) types. See note about chunking
below.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>AcceptLanguage</code></p></td><td colspa
n="1" rowspan="1" class="confluenceTd"><p>Specifies what language (for
example, American English) the client prefers for the purposes of receiving a
response. The value is used as the value of the HTTP AcceptLanguage property.
<br clear="none" class="atl-forced-newline"> Language tags are regulated by the
International Organization for Standards (ISO) and are typically formed by
combining a language code, determined by the ISO-639 standard, and country
code, determined by the ISO-3166 standard, separated by a hyphen. For example,
en-US represents American English.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>AcceptEncoding</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies what content encodings the client
is prepared to handle. Content encoding labels are regulated by the Internet
Assigned Numbers Authority (IANA). The value is used as the value of the HTTP
<code>AcceptEncoding</code> property.</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>ContentType</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the media type of the
data being sent in the body of a message. Media types are specified using
multipurpose internet mail extensions (MIME) types. The value is used as the
value of the HTTP <code>ContentType</code> property. The default is
<code>text/xml</code>. <br clear="none" class="atl-forced-newline">
<strong>Tip:</strong> For web services, this should be set to
<code>text/xml</code>. If the client is sending HTML form data to a CGI script,
this should be set to application/x-www-form-urlencoded. If the HTTP POST
request is bound to a fixed payload format (as opposed to SOAP), the content
type is typically set to application/octet-stream.</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>Host</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the Internet host and
port number of the resource on wh
ich the request is being invoked. The value is used as the value of the HTTP
<code>Host</code> property. <br clear="none" class="atl-forced-newline">
<strong>Tip:</strong> This attribute is typically not required. It is only
required by certain DNS scenarios or application designs. For example, it
indicates what host the client prefers for clusters (that is, for virtual
servers mapping to the same Internet protocol (IP)
address).</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>Connection</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies whether a particular connection
is to be kept open or closed after each request/response dialog. There are two
valid values:</p><ul><li><code>Keep-Alive</code>(default) specifies that the
client wants to keep its connection open after the initial request/response
sequence. If the server honors it, the connection is kept open until the
consumer closes it.</li><li><code>close</code> specifies that t
he connection to the server is closed after each request/response
sequence.</li></ul></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>CacheControl</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies directives about the behavior
that must be adhered to by caches involved in the chain comprising a request
from a client to a server.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>Cookie</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Specifies a static cookie to be sent with all
requests.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>BrowserType</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies information about the browser
from which the request originates. In the HTTP specification from the World
Wide Web consortium (W3C) this is also known as the <em>user-agent</em>. Some
servers optimize based upon the client that is sending the requ
est.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>Referer</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies the URL of the resource that
directed the consumer to make requests on a particular service. The value is
used as the value of the HTTP Referer property. <br clear="none"
class="atl-forced-newline"> <strong>Note:</strong> This HTTP property is used
when a request is the result of a browser user clicking on a hyperlink rather
than typing a URL. This can allow the server to optimize processing based upon
previous task flow, and to generate lists of back-links to resources for the
purposes of logging, optimized caching, tracing of obsolete or mistyped links,
and so on. However, it is typically not used in web services applications. <br
clear="none" class="atl-forced-newline"> <strong>Important:</strong> If the
AutoRedirect attribute is set to true and the request is redirected, any value
specified in the Refererattribute is
overridden. The value of the HTTP Referer property will be set to the URL of
the service who redirected the consumer's original
request.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>DecoupledEndpoint</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies the URL of a decoupled endpoint
for the receipt of responses over a separate server->client connection. <br
clear="none" class="atl-forced-newline"> <strong>Warning:</strong> You must
configure both the client and server to use WS-Addressing for the decoupled
endpoint to work.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>ProxyServer</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies the URL of the proxy server
through which requests are routed.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>ProxyServerPort</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies the port numb
er of the proxy server through which requests are routed.</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd">NonProxyHosts</td><td colspan="1"
rowspan="1" class="confluenceTd">Specifies a list of hosts that should be
directly routed. This value is a list of patterns separated by '|', where each
pattern may start or end with a '*' for wildcard matching.</td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>ProxyServerType</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies the type of proxy server used to
route requests. Valid values
are:</p><ul><li>HTTP(default)</li><li>SOCKS</li></ul></td></tr></tbody></table></div><h4
id="ClientHTTPTransport(includingSSLsupport)-ExampleusingtheClientElement">Example
using the <code>Client</code> Element</h4><p>The example below shows a the
configuration for an HTTP client that wants to keep its connection to the
server open between requests, will only retransmit requests once per invocation,
and cannot use chunking streams.</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeHeader panelHeader pdl"
style="border-bottom-width: 1px;"><b>HTTP Consumer Endpoint
Configuration</b></div><div class="codeContent panelContent pdl">
+</div></div><p>The <code>http-conf:conduit</code> element has a number of
child elements that specify configuration information. They are described
below. See also Sun's <a shape="rect" class="external-link"
href="http://java.sun.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html"
rel="nofollow">JSSE Guide</a> for more information on configuring SSL.</p><div
class="table-wrap"><table class="wrapped confluenceTable"><tbody><tr><th
colspan="1" rowspan="1" class="confluenceTh"><p>Element</p></th><th colspan="1"
rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>http-conf:client</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies the HTTP connection properties
such as timeouts, keep-alive requests, content types, etc.</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>http-conf:authorization</code></p></td><td
colspan="1" rowspan="1" class="confluenceT
d"><p>Specifies the the parameters for configuring the basic authentication
method that the endpoint uses preemptively.</p></td></tr><tr><td colspan="1"
rowspan="1"
class="confluenceTd"><p><code>http-conf:proxyAuthorization</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the parameters for
configuring basic authentication against outgoing HTTP proxy
servers.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>http-conf:tlsClientParameters</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the parameters used
to configure SSL/TLS.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>http-conf:authSupplier</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the bean reference or
class name of the object that supplies the authentication information used by
the endpoint both preemptively or in response to a 401 HTTP
challenge.</p></td></tr><tr><td colspan="1" rows
pan="1"
class="confluenceTd"><p><code>http-conf:trustDecider</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the bean reference or
class name of the object that checks the HTTP(S) URLConnection object in order
to establish trust for a connection with an HTTPS service provider before any
information is transmitted.</p></td></tr></tbody></table></div><h3
id="ClientHTTPTransport(includingSSLsupport)-Theclientelement">The
<code>client</code> element</h3><p>The <code>http-conf:client</code> element is
used to configure the non-security properties of a client's HTTP connection.
Its attributes, described below, specify the connection's properties.</p><div
class="table-wrap"><table class="wrapped confluenceTable"><tbody><tr><th
colspan="1" rowspan="1" class="confluenceTh"><p>Attribute</p></th><th
colspan="1" rowspan="1"
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>ConnectionTimeout</code></p></td>
<td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the amount of
time, in milliseconds, that the client will attempt to establish a connection
before it times out. The default is 30000 (30 seconds). <br clear="none"
class="atl-forced-newline">0 specifies that the client will continue to attempt
to open a connection indefinitely.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>ReceiveTimeout</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies the amount of time, in
milliseconds, that the client will wait for a response before it times out. The
default is 60000. <br clear="none" class="atl-forced-newline">0 specifies that
the client will wait indefinitely.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>AutoRedirect</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies if the client will automatically
follow a server issued redirection. The default is false.</p></td></tr><t
r><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>MaxRetransmits</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies the maximum number of times a
client will retransmit a request to satisfy a redirect. The default is -1 which
specifies that unlimited retransmissions are allowed.</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>AllowChunking</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies whether the client will send
requests using chunking. The default is true which specifies that the client
will use chunking when sending requests. <br clear="none"
class="atl-forced-newline">Chunking cannot be used used if either of the
following are true:</p><ul><li><code>http-conf:basicAuthSupplier</code> is
configured to provide credentials
preemptively.</li><li><code>AutoRedirect</code> is set to true. <br
clear="none" class="atl-forced-newline">In both cases the value of
<code>AllowChunking</code> is igno
red and chunking is disallowed. <br clear="none"
class="atl-forced-newline">See note about chunking
below.</li></ul></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>ChunkingThreshold</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies the threshold at which CXF will
switch from non-chunking to chunking. By default, messages less than 4K are
buffered and sent non-chunked. Once this threshold is reached, the message is
chunked.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>Accept</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Specifies what media types the client is prepared to
handle. The value is used as the value of the HTTP <code>Accept</code>
property. The value of the attribute is specified using as multipurpose
internet mail extensions (MIME) types. See note about chunking
below.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>AcceptLanguage</code></p></td
><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies what language
>(for example, American English) the client prefers for the purposes of
>receiving a response. The value is used as the value of the HTTP
>AcceptLanguage property. <br clear="none" class="atl-forced-newline">Language
>tags are regulated by the International Organization for Standards (ISO) and
>are typically formed by combining a language code, determined by the ISO-639
>standard, and country code, determined by the ISO-3166 standard, separated by
>a hyphen. For example, en-US represents American
>English.</p></td></tr><tr><td colspan="1" rowspan="1"
>class="confluenceTd"><p><code>AcceptEncoding</code></p></td><td colspan="1"
>rowspan="1" class="confluenceTd"><p>Specifies what content encodings the
>client is prepared to handle. Content encoding labels are regulated by the
>Internet Assigned Numbers Authority (IANA). The value is used as the value of
>the HTTP <code>AcceptEncoding</code> property.</p></td></tr><tr><td c
olspan="1" rowspan="1"
class="confluenceTd"><p><code>ContentType</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies the media type of the data being
sent in the body of a message. Media types are specified using multipurpose
internet mail extensions (MIME) types. The value is used as the value of the
HTTP <code>ContentType</code> property. The default is <code>text/xml</code>.
<br clear="none" class="atl-forced-newline"><strong>Tip:</strong> For web
services, this should be set to <code>text/xml</code>. If the client is sending
HTML form data to a CGI script, this should be set to
application/x-www-form-urlencoded. If the HTTP POST request is bound to a fixed
payload format (as opposed to SOAP), the content type is typically set to
application/octet-stream.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>Host</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Specifies the Internet host and port number of the resou
rce on which the request is being invoked. The value is used as the value of
the HTTP <code>Host</code> property. <br clear="none"
class="atl-forced-newline"><strong>Tip:</strong> This attribute is typically
not required. It is only required by certain DNS scenarios or application
designs. For example, it indicates what host the client prefers for clusters
(that is, for virtual servers mapping to the same Internet protocol (IP)
address).</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>Connection</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies whether a particular connection
is to be kept open or closed after each request/response dialog. There are two
valid values:</p><ul><li><code>Keep-Alive</code>(default) specifies that the
client wants to keep its connection open after the initial request/response
sequence. If the server honors it, the connection is kept open until the
consumer closes it.</li><li><code>close</code> specifie
s that the connection to the server is closed after each request/response
sequence.</li></ul></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>CacheControl</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies directives about the behavior
that must be adhered to by caches involved in the chain comprising a request
from a client to a server.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>Cookie</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Specifies a static cookie to be sent with all
requests.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>BrowserType</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies information about the browser
from which the request originates. In the HTTP specification from the World
Wide Web consortium (W3C) this is also known as the <em>user-agent</em>. Some
servers optimize based upon the client that is sending
the request.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>Referer</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies the URL of the resource that
directed the consumer to make requests on a particular service. The value is
used as the value of the HTTP Referer property. <br clear="none"
class="atl-forced-newline"><strong>Note:</strong> This HTTP property is used
when a request is the result of a browser user clicking on a hyperlink rather
than typing a URL. This can allow the server to optimize processing based upon
previous task flow, and to generate lists of back-links to resources for the
purposes of logging, optimized caching, tracing of obsolete or mistyped links,
and so on. However, it is typically not used in web services applications. <br
clear="none" class="atl-forced-newline"><strong>Important:</strong> If the
AutoRedirect attribute is set to true and the request is redirected, any value
specified in the Refererattrib
ute is overridden. The value of the HTTP Referer property will be set to the
URL of the service who redirected the consumer's original
request.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>DecoupledEndpoint</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies the URL of a decoupled endpoint
for the receipt of responses over a separate server->client connection. <br
clear="none" class="atl-forced-newline"><strong>Warning:</strong> You must
configure both the client and server to use WS-Addressing for the decoupled
endpoint to work.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>ProxyServer</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies the URL of the proxy server
through which requests are routed.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>ProxyServerPort</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies the port
number of the proxy server through which requests are
routed.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd">NonProxyHosts</td><td colspan="1" rowspan="1"
class="confluenceTd">Specifies a list of hosts that should be directly routed.
This value is a list of patterns separated by '|', where each pattern may start
or end with a '*' for wildcard matching.</td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>ProxyServerType</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the type of proxy
server used to route requests. Valid values
are:</p><ul><li>HTTP(default)</li><li>SOCKS</li></ul></td></tr></tbody></table></div><h4
id="ClientHTTPTransport(includingSSLsupport)-ExampleusingtheClientElement">Example
using the <code>Client</code> Element</h4><p>The example below shows a the
configuration for an HTTP client that wants to keep its connection to the
server open between requests, will only retransmit requests once per invoca
tion, and cannot use chunking streams.</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeHeader panelHeader pdl"
style="border-bottom-width: 1px;"><b>HTTP Consumer Endpoint
Configuration</b></div><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default"><beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
@@ -373,7 +385,7 @@ http.setClient(httpClientPolicy);
// Passing the SEI class that is generated by wsdl2java
ServicePort proxy = service.getPort(portName, SEI.class);
</pre>
-</div></div><h2
id="ClientHTTPTransport(includingSSLsupport)-ClientCacheControlDirectives">Client
Cache Control Directives</h2><p>The following table lists the cache control
directives supported by an HTTP client.</p><div class="table-wrap"><table
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1"
class="confluenceTh"><p>Directive</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>Behavior</p></th></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>no-cache</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Caches cannot use a particular response to satisfy
subsequent requests without first revalidating that response with the server.
If specific response header fields are specified with this value, the
restriction applies only to those header fields within the response. If no
response header fields are specified, the restriction applies to the entire
response.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>no-store</p></td
><td colspan="1" rowspan="1" class="confluenceTd"><p>Caches must not store any
>part of a response or any part of the request that invoked
>it.</p></td></tr><tr><td colspan="1" rowspan="1"
>class="confluenceTd"><p>max-age</p></td><td colspan="1" rowspan="1"
>class="confluenceTd"><p>The consumer can accept a response whose age is no
>greater than the specified time in seconds.</p></td></tr><tr><td colspan="1"
>rowspan="1" class="confluenceTd"><p>max-stale</p></td><td colspan="1"
>rowspan="1" class="confluenceTd"><p>The consumer can accept a response that
>has exceeded its expiration time. If a value is assigned to max-stale, it
>represents the number of seconds beyond the expiration time of a response up
>to which the consumer can still accept that response. If no value is
>assigned, it means the consumer can accept a stale response of any
>age.</p></td></tr><tr><td colspan="1" rowspan="1"
>class="confluenceTd"><p>min-fresh</p></td><td colspan="1" rowspan="1"
>class="confluenceTd"><p>The consumer
wants a response that will be still be fresh for at least the specified number
of seconds indicated.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>no-transform</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Caches must not modify media type or location of the
content in a response between a provider and a consumer.</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>only-if-cached</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Caches should return only
responses that are currently stored in the cache, and not responses that need
to be reloaded or revalidated.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>cache-extension</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Specifies additional extensions to the other cache
directives. Extensions might be informational or behavioral. An extended
directive is specified in the context of a standard directive, so that
applications not understa
nding the extended directive can at least adhere to the behavior mandated by
the standard directive.</p></td></tr></tbody></table></div><h1
id="ClientHTTPTransport(includingSSLsupport)-ANoteAboutChunking">A Note About
Chunking</h1><p>There are two ways of putting a body into an HTTP
stream:</p><ul><li>The "standard" way used by most browsers is to specify a
Content-Length header in the HTTP headers. This allows the receiver to know how
much data is coming and when to stop reading. The problem with this approach is
that the length needs to be pre-determined. The data cannot be streamed as
generated as the length needs to be calculated upfront. Thus, if chunking is
turned off, we need to buffer the data in a byte buffer (or temp file if too
large) so that the Content-Length can be calculated.</li><li>Chunked - with
this mode, the data is sent to the receiver in chunks. Each chunk is preceded
by a hexidecimal chunk size. When a chunk size is 0, the receiver knows all the
data has been
received. This mode allows better streaming as we just need to buffer a small
amount, up to 8K by default, and when the buffer fills, write out the
chunk.</li></ul><p>In general, Chunked will perform better as the streaming can
take place directly. HOWEVER, there are some problems with
chunking:</p><ul><li>Many proxy servers don't understand it, especially older
proxy servers. Many proxy servers want the Content-Length up front so they can
allocate a buffer to store the request before passing it onto the real
server.</li><li>Some of the older WebServices stacks also have problems with
Chunking. Specifically, older versions of .NET.</li></ul><p>If you are getting
strange errors (generally not soap faults, but other HTTP type errors) when
trying to interact with a service, try turning off chunking to see if that
helps.</p><h1
id="ClientHTTPTransport(includingSSLsupport)-Whentosetcustomheaders">When to
set custom headers</h1><p>If you use a custom CXF interceptor to set one or
more out
bound HTTP headers then it is recommended to get this interceptor running at a
stage preceding the WRITE stage, before the outbound body is written
out.</p><p>Otherwise the custom headers may get lost. The headers may get
retained in some cases even if they are added after the body is written out,
example, when a chunking threshold value (4K by default) has not been
reached,</p><p>but relying on it for the headers not to be lost is brittle and
should be avoided.</p><h1
id="ClientHTTPTransport(includingSSLsupport)-AsynchronousHTTPConduit">Asynchronous
HTTP Conduit</h1><p>Please see <a shape="rect"
href="asynchronous-client-http-transport.html">Asynchronous HTTP Conduit</a>
page for more information.</p></div>
+</div></div><h2
id="ClientHTTPTransport(includingSSLsupport)-ClientCacheControlDirectives">Client
Cache Control Directives</h2><p>The following table lists the cache control
directives supported by an HTTP client.</p><div class="table-wrap"><table
class="wrapped confluenceTable"><tbody><tr><th colspan="1" rowspan="1"
class="confluenceTh"><p>Directive</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>Behavior</p></th></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>no-cache</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Caches cannot use a particular response to satisfy
subsequent requests without first revalidating that response with the server.
If specific response header fields are specified with this value, the
restriction applies only to those header fields within the response. If no
response header fields are specified, the restriction applies to the entire
response.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>no-store
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Caches must not
store any part of a response or any part of the request that invoked
it.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>max-age</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>The consumer can accept a response whose age is no
greater than the specified time in seconds.</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p>max-stale</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>The consumer can accept a response that has
exceeded its expiration time. If a value is assigned to max-stale, it
represents the number of seconds beyond the expiration time of a response up to
which the consumer can still accept that response. If no value is assigned, it
means the consumer can accept a stale response of any age.</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>min-fresh</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>The c
onsumer wants a response that will be still be fresh for at least the
specified number of seconds indicated.</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p>no-transform</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Caches must not modify media type or
location of the content in a response between a provider and a
consumer.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>only-if-cached</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Caches should return only responses that are currently
stored in the cache, and not responses that need to be reloaded or
revalidated.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>cache-extension</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Specifies additional extensions to the other cache
directives. Extensions might be informational or behavioral. An extended
directive is specified in the context of a standard directive, so that
applications not
understanding the extended directive can at least adhere to the behavior
mandated by the standard directive.</p></td></tr></tbody></table></div><h1
id="ClientHTTPTransport(includingSSLsupport)-ANoteAboutChunking">A Note About
Chunking</h1><p>There are two ways of putting a body into an HTTP
stream:</p><ul><li>The "standard" way used by most browsers is to specify a
Content-Length header in the HTTP headers. This allows the receiver to know how
much data is coming and when to stop reading. The problem with this approach is
that the length needs to be pre-determined. The data cannot be streamed as
generated as the length needs to be calculated upfront. Thus, if chunking is
turned off, we need to buffer the data in a byte buffer (or temp file if too
large) so that the Content-Length can be calculated.</li><li>Chunked - with
this mode, the data is sent to the receiver in chunks. Each chunk is preceded
by a hexidecimal chunk size. When a chunk size is 0, the receiver knows all the
data h
as been received. This mode allows better streaming as we just need to buffer
a small amount, up to 8K by default, and when the buffer fills, write out the
chunk.</li></ul><p>In general, Chunked will perform better as the streaming can
take place directly. HOWEVER, there are some problems with
chunking:</p><ul><li>Many proxy servers don't understand it, especially older
proxy servers. Many proxy servers want the Content-Length up front so they can
allocate a buffer to store the request before passing it onto the real
server.</li><li>Some of the older WebServices stacks also have problems with
Chunking. Specifically, older versions of .NET.</li></ul><p>If you are getting
strange errors (generally not soap faults, but other HTTP type errors) when
trying to interact with a service, try turning off chunking to see if that
helps.</p><h1
id="ClientHTTPTransport(includingSSLsupport)-Whentosetcustomheaders">When to
set custom headers</h1><p>If you use a custom CXF interceptor to set one or
more outbound HTTP headers then it is recommended to get this interceptor
running at a stage preceding the WRITE stage, before the outbound body is
written out.</p><p>Otherwise the custom headers may get lost. The headers may
get retained in some cases even if they are added after the body is written
out, example, when a chunking threshold value (4K by default) has not been
reached,</p><p>but relying on it for the headers not to be lost is brittle and
should be avoided.</p><h1
id="ClientHTTPTransport(includingSSLsupport)-AsynchronousHTTPConduit">Asynchronous
HTTP Conduit</h1><p>Please see <a shape="rect"
href="asynchronous-client-http-transport.html">Asynchronous HTTP Conduit</a>
page for more information.</p></div>
</div>
<!-- Content -->
</td>