cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache CXF Documentation > Standalone HTTP Transport
Date Fri, 04 Jan 2013 11:25:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/2042/9/1/_/styles/combined.css?spaceKey=CXF20DOC&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/CXF20DOC/Standalone+HTTP+Transport">Standalone
HTTP Transport</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~coheigea@apache.org">Colm
O hEigeartaigh</a>
    </h4>
        <br/>
                         <h4>Changes (2)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >  xmlns:jaxws=&quot;http://java.sun.com/xml/ns/jaxws&quot;
<br>  xsi:schemaLocation=&quot; <br></td></tr>
            <tr><td class="diff-unchanged" >           http://cxf.apache.org/configuration/security
              http://cxf.apache.org/schemas/configuration/security.xsd <br></td></tr>
            <tr><td class="diff-unchanged" >           http://cxf.apache.org/transports/http/configuration
<br>              http://cxf.apache.org/schemas/configuration/http-conf.xsd <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >              http://www.springframework.org/schema/beans/spring-beans-2.0.xsd&quot;&gt;
<br> <br></td></tr>
            <tr><td class="diff-unchanged" >  &lt;http:destination name=&quot;{http://apache.org/hello_world}GreeterImplPort.http-destination&quot;&gt;
    <br>  &lt;/http:destination&gt; <br> <br>  &lt;httpj:engine-factory
bus=&quot;cxf&quot;&gt; <br></td></tr>
            <tr><td class="diff-unchanged" >  &lt;!-- you just need to specify
the TLS Server configuration for the certain port --&gt;
    &lt;httpj:engine port=&quot;9003&quot;&gt;
      &lt;httpj:tlsServerParameters&gt;
        &lt;sec:keyManagers keyPassword=&quot;password&quot;&gt;
          &lt;sec:keyStore type=&quot;JKS&quot; password=&quot;password&quot;

                        file=&quot;src/test/java/org/apache/cxf/systest/http/resources/Tarpin.jks&quot;/&gt;
        &lt;/sec:keyManagers&gt;
        &lt;sec:trustManagers&gt;
          &lt;sec:keyStore type=&quot;JKS&quot; password=&quot;password&quot;
                        file=&quot;src/test/java/org/apache/cxf/systest/http/resources/Truststore.jks&quot;/&gt;
        &lt;/sec:trustManagers&gt;
        &lt;sec:cipherSuitesFilter&gt;
          &lt;!-- these filters ensure that a ciphersuite with
               export-suitable or null encryption is used,
               but exclude anonymous Diffie-Hellman key change as
               this is vulnerable to man-in-the-middle attacks --&gt;
          &lt;sec:include&gt;.*_EXPORT_.*&lt;/sec:include&gt;
          &lt;sec:include&gt;.*_EXPORT1024_.*&lt;/sec:include&gt;
          &lt;sec:include&gt;.*_WITH_DES_.*&lt;/sec:include&gt;
          &lt;sec:include&gt;.*_WITH_AES_.*&lt;/sec:include&gt;
          &lt;sec:include&gt;.*_WITH_NULL_.*&lt;/sec:include&gt;
          &lt;sec:exclude&gt;.*_DH_anon_.*&lt;/sec:exclude&gt;
        &lt;/sec:cipherSuitesFilter&gt;
        &lt;sec:clientAuthentication want=&quot;true&quot; required=&quot;true&quot;/&gt;
      &lt;/httpj:tlsServerParameters&gt;
    &lt;/httpj:engine&gt;
  &lt;/httpj:engine-factory&gt; <br></td></tr>
            <tr><td class="diff-unchanged" >&lt;/bean&gt;  <br>{code}
<br> <br>h1. Add the static content pages into the jetty server <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">CXF
standalone http tansport is based on jetty server, the below code shows how to get the jetty
server from the destination and how to add the static content path to the jetty server. <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">The
CXF standalone http transport is based on the jetty server. The code below shows how to get
the jetty server from the destination and how to add the static content path to the jetty
server. <br></td></tr>
            <tr><td class="diff-unchanged" >{code:java} <br>    // get the
jetty server form the destination <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h1><a name="StandaloneHTTPTransport-ConfiguringSSL"></a>Configuring
SSL</h1>

<p>To configure the standalone HTTP transport to use SSL, you'll need to add an &lt;http:destination&gt;
definition to your XML configuration file. See the <a href="/confluence/display/CXF20DOC/Configuration"
title="Configuration">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>Destinations in CXF are responsible for listening for server side requests.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
&lt;beans xmlns=<span class="code-quote">"http://www.springframework.org/schema/beans"</span>
  <span class="code-keyword">xmlns:xsi</span>=<span class="code-quote">"http://www.w3.org/2001/XMLSchema-instance"</span>
  <span class="code-keyword">xmlns:sec</span>=<span class="code-quote">"http://cxf.apache.org/configuration/security"</span>
  <span class="code-keyword">xmlns:http</span>=<span class="code-quote">"http://cxf.apache.org/transports/http/configuration"</span>
  <span class="code-keyword">xmlns:httpj</span>=<span class="code-quote">"http://cxf.apache.org/transports/http-jetty/configuration"</span>
  <span class="code-keyword">xmlns:jaxws</span>=<span class="code-quote">"http://java.sun.com/xml/ns/jaxws"</span>
  xsi:schemaLocation="
           http://cxf.apache.org/configuration/security
              http://cxf.apache.org/schemas/configuration/security.xsd
           http://cxf.apache.org/transports/http/configuration
              http://cxf.apache.org/schemas/configuration/http-conf.xsd
           http://cxf.apache.org/transports/http-jetty/configuration
              http://cxf.apache.org/schemas/configuration/http-jetty.xsd
           http://www.springframework.org/schema/beans
              http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"&gt;

  <span class="code-tag">&lt;http:destination name=<span class="code-quote">"{http://apache.org/hello_world}GreeterImplPort.http-destination"</span>&gt;</span>
   
  <span class="code-tag">&lt;/http:destination&gt;</span>
  
  <span class="code-tag">&lt;httpj:engine-factory bus=<span class="code-quote">"cxf"</span>&gt;</span>
  <span class="code-tag"><span class="code-comment">&lt;!-- you just need
to specify the TLS Server configuration for the certain port --&gt;</span></span>
    <span class="code-tag">&lt;httpj:engine port=<span class="code-quote">"9003"</span>&gt;</span>
      <span class="code-tag">&lt;httpj:tlsServerParameters&gt;</span>
        <span class="code-tag">&lt;sec:keyManagers keyPassword=<span class="code-quote">"password"</span>&gt;</span>
          &lt;sec:keyStore type=<span class="code-quote">"JKS"</span> password=<span
class="code-quote">"password"</span> 
                        file=<span class="code-quote">"src/test/java/org/apache/cxf/systest/http/resources/Tarpin.jks"</span>/&gt;
        <span class="code-tag">&lt;/sec:keyManagers&gt;</span>
        <span class="code-tag">&lt;sec:trustManagers&gt;</span>
          &lt;sec:keyStore type=<span class="code-quote">"JKS"</span> password=<span
class="code-quote">"password"</span>
                        file=<span class="code-quote">"src/test/java/org/apache/cxf/systest/http/resources/Truststore.jks"</span>/&gt;
        <span class="code-tag">&lt;/sec:trustManagers&gt;</span>
        <span class="code-tag">&lt;sec:cipherSuitesFilter&gt;</span>
          &lt;!-- these filters ensure that a ciphersuite with
               export-suitable or null encryption is used,
               but exclude anonymous Diffie-Hellman key change as
               this is vulnerable to man-in-the-middle attacks --&gt;
          <span class="code-tag">&lt;sec:include&gt;</span>.*_EXPORT_.*<span
class="code-tag">&lt;/sec:include&gt;</span>
          <span class="code-tag">&lt;sec:include&gt;</span>.*_EXPORT1024_.*<span
class="code-tag">&lt;/sec:include&gt;</span>
          <span class="code-tag">&lt;sec:include&gt;</span>.*_WITH_DES_.*<span
class="code-tag">&lt;/sec:include&gt;</span>
          <span class="code-tag">&lt;sec:include&gt;</span>.*_WITH_AES_.*<span
class="code-tag">&lt;/sec:include&gt;</span>
          <span class="code-tag">&lt;sec:include&gt;</span>.*_WITH_NULL_.*<span
class="code-tag">&lt;/sec:include&gt;</span>
          <span class="code-tag">&lt;sec:exclude&gt;</span>.*_DH_anon_.*<span
class="code-tag">&lt;/sec:exclude&gt;</span>
        <span class="code-tag">&lt;/sec:cipherSuitesFilter&gt;</span>
        <span class="code-tag">&lt;sec:clientAuthentication want=<span class="code-quote">"true"</span>
required=<span class="code-quote">"true"</span>/&gt;</span>
      <span class="code-tag">&lt;/httpj:tlsServerParameters&gt;</span>
    <span class="code-tag">&lt;/httpj:engine&gt;</span>
  <span class="code-tag">&lt;/httpj:engine-factory&gt;</span>
<span class="code-tag">&lt;/bean&gt;</span> 
</pre>
</div></div>

<h1><a name="StandaloneHTTPTransport-Addthestaticcontentpagesintothejettyserver"></a>Add
the static content pages into the jetty server</h1>
<p>The CXF standalone http transport is based on the jetty server. The code below shows
how to get the jetty server from the destination and how to add the static content path to
the jetty server.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
    <span class="code-comment">// get the jetty server form the destination
</span>    EndpointInfo ei = <span class="code-keyword">new</span> EndpointInfo();
    ei.setAddress(serviceFactory.getAddress());
    Destination destination = df.getDestination(ei);
    JettyHTTPDestination jettyDestination = (JettyHTTPDestination) destination;
    ServerEngine engine = jettyDestination.getEngine();
    Handler handler = engine.getServant(<span class="code-keyword">new</span>
URL(serviceFactory.getAddress()));
    org.mortbay.jetty.Server server = handler.getServer(); <span class="code-comment">//
The Server
</span>
    <span class="code-comment">// We have to create a HandlerList structure that includes
both a ResourceHandler <span class="code-keyword">for</span> the <span class="code-keyword">static</span>
</span>    <span class="code-comment">// content as well as the ContextHandlerCollection
created by CXF (which we retrieve as serverHandler). 
</span>    Handler serverHandler = server.getHandler();
    HandlerList handlerList = <span class="code-keyword">new</span> HandlerList();
    ResourceHandler resourceHandler = <span class="code-keyword">new</span> ResourceHandler();
    handlerList.addHandler(resourceHandler);
    handlerList.addHandler(serverHandler);

    <span class="code-comment">// replace the CXF servlet connect collection with the
list.
</span>    server.setHandler(handlerList);
    <span class="code-comment">// and tell the handler list that it is alive.
</span>    handlerList.start();

    <span class="code-comment">// setup the resource handler
</span>    File staticContentFile = <span class="code-keyword">new</span>
File(staticContentPath); <span class="code-comment">// ordinary pathname.
</span>    URL targetURL = <span class="code-keyword">new</span> URL(<span
class="code-quote">"file:<span class="code-comment">//"</span> + staticContentFile.getCanonicalPath());
</span>    FileResource fileResource = <span class="code-keyword">new</span>
FileResource(targetURL);
    resourceHandler.setBaseResource(fileResource);
</pre>
</div></div>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/CXF20DOC/Standalone+HTTP+Transport">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=49945&revisedVersion=8&originalVersion=7">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CXF20DOC/Standalone+HTTP+Transport?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message