cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Colm O hEigeartaigh (Confluence)" <conflue...@apache.org>
Subject [CONF] Apache CXF Documentation > Standalone HTTP Transport
Date Mon, 12 Aug 2013 15:16:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/en/2176/1/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 (1)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-unchanged" >h1. Configuring SSL <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >To configure the standalone HTTP
transport to use SSL, you&#39;ll need to add an &lt;http:destination&gt; definition
to your XML configuration file. See the [Configuration|Configuration] 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. <span class="diff-added-words"style="background-color:
#dfd;">For more information about configuring TLS, see the [Configuring TLS|https://cwiki.apache.org/confluence/display/CXF/TLS+Configuration]
page.</span> <br></td></tr>
            <tr><td class="diff-unchanged" > <br>Destinations in CXF are
responsible for listening for server side requests. <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. For more information about configuring TLS, see the <a href="https://cwiki.apache.org/confluence/display/CXF/TLS+Configuration"
class="external-link" rel="nofollow">Configuring TLS</a> page.</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="theme: Default; brush: xml; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
&lt;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"
  xmlns:http="http://cxf.apache.org/transports/http/configuration"
  xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration"
  xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
  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;

  &lt;http:destination name="{http://apache.org/hello_world}GreeterImplPort.http-destination"&gt;
   
  &lt;/http:destination&gt;
  
  &lt;httpj:engine-factory bus="cxf"&gt;
  &lt;!-- you just need to specify the TLS Server configuration for the certain port --&gt;
    &lt;httpj:engine port="9003"&gt;
      &lt;httpj:tlsServerParameters&gt;
        &lt;sec:keyManagers keyPassword="password"&gt;
          &lt;sec:keyStore type="JKS" password="password" 
                        file="src/test/java/org/apache/cxf/systest/http/resources/Tarpin.jks"/&gt;
        &lt;/sec:keyManagers&gt;
        &lt;sec:trustManagers&gt;
          &lt;sec:keyStore type="JKS" password="password"
                        file="src/test/java/org/apache/cxf/systest/http/resources/Truststore.jks"/&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="true" required="true"/&gt;
      &lt;/httpj:tlsServerParameters&gt;
    &lt;/httpj:engine&gt;
  &lt;/httpj:engine-factory&gt;
&lt;/bean&gt; 
</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="theme: Default; brush: java; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
    // get the jetty server form the destination
    EndpointInfo ei = new EndpointInfo();
    ei.setAddress(serviceFactory.getAddress());
    Destination destination = df.getDestination(ei);
    JettyHTTPDestination jettyDestination = (JettyHTTPDestination) destination;
    ServerEngine engine = jettyDestination.getEngine();
    Handler handler = engine.getServant(new URL(serviceFactory.getAddress()));
    org.mortbay.jetty.Server server = handler.getServer(); // The Server

    // We have to create a HandlerList structure that includes both a ResourceHandler for
the static
    // content as well as the ContextHandlerCollection created by CXF (which we retrieve as
serverHandler). 
    Handler serverHandler = server.getHandler();
    HandlerList handlerList = new HandlerList();
    ResourceHandler resourceHandler = new ResourceHandler();
    handlerList.addHandler(resourceHandler);
    handlerList.addHandler(serverHandler);

    // replace the CXF servlet connect collection with the list.
    server.setHandler(handlerList);
    // and tell the handler list that it is alive.
    handlerList.start();

    // setup the resource handler
    File staticContentFile = new File(staticContentPath); // ordinary pathname.
    URL targetURL = new URL("file://" + staticContentFile.getCanonicalPath());
    FileResource fileResource = new FileResource(targetURL);
    resourceHandler.setBaseResource(fileResource);
</pre>
</div></div>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;" class="grey">
                        <a href="https://cwiki.apache.org/confluence/users/removespacenotification.action?spaceKey=CXF20DOC">Stop
watching space</a>
            <span style="padding: 0px 5px;">|</span>
                <a href="https://cwiki.apache.org/confluence/users/editmyemailsettings.action">Change
email 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=9&originalVersion=8">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