Author: buildbot
Date: Thu Mar 21 19:25:10 2013
New Revision: 855469
Log:
Production update by buildbot for camel
Modified:
websites/production/camel/content/http4.html
Modified: websites/production/camel/content/http4.html
==============================================================================
--- websites/production/camel/content/http4.html (original)
+++ websites/production/camel/content/http4.html Thu Mar 21 19:25:10 2013
@@ -465,7 +465,48 @@ httpComponent.setHttpClientConfigurer(<s
</pre>
</div></div>
-<p>As long as you implement the HttpClientConfigurer and configure your
keystore and truststore as described above, it will work fine.</p></div>
+<p>As long as you implement the HttpClientConfigurer and configure your
keystore and truststore as described above, it will work fine.</p>
+
+<h5><a shape="rect" name="HTTP4-UsingHTTPStoauthenticategotchas"></a>Using
HTTPS to authenticate gotchas</h5>
+
+<p>An end user reported that he had problem with authenticating with HTTPS.
The problem was eventually resolved by providing a custom configured
<tt>org.apache.http.protocol.HttpContext</tt>:</p>
+
+<p>1. Create a (Spring) factory for HttpContexts:</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
+<pre class="code-java">
+<span class="code-keyword">public</span> class HttpContextFactory {
+
+ <span class="code-keyword">private</span> <span
class="code-object">String</span> httpHost = <span
class="code-quote">"localhost"</span>;
+ <span class="code-keyword">private</span> <span
class="code-object">String</span> httpPort = 9001;
+
+ <span class="code-keyword">private</span> BasicHttpContext httpContext =
<span class="code-keyword">new</span> BasicHttpContext();
+ <span class="code-keyword">private</span> BasicAuthCache authCache = <span
class="code-keyword">new</span> BasicAuthCache();
+ <span class="code-keyword">private</span> BasicScheme basicAuth = <span
class="code-keyword">new</span> BasicScheme();
+
+ <span class="code-keyword">public</span> HttpContext getObject() {
+ authCache.put(<span class="code-keyword">new</span> HttpHost(httpHost,
httpPort), basicAuth);
+
+ httpContext.setAttribute(ClientContext.AUTH_CACHE, authCache);
+
+ <span class="code-keyword">return</span> httpContext;
+ }
+
+ <span class="code-comment">// getter and setter
+</span>}
+</pre>
+</div></div>
+<p>2. Declare an HttpContext in the Spring application context file:</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
+<pre class="code-java">
+<bean id=<span class="code-quote">"myHttpContext"</span> factory-bean=<span
class="code-quote">"httpContextFactory"</span> factory-method=<span
class="code-quote">"getObject"</span>/>
+</pre>
+</div></div>
+<p>3. Reference the context in the http4 URL:</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
+<pre class="code-java">
+<to uri=<span class="code-quote">"https4:<span
class="code-comment">//myhostname.com:443/myURL?httpContext=myHttpContext"</span>/></span>
+</pre>
+</div></div></div>
</td>
<td valign="top">
<div class="navigation">