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 > Jetty Configuration
Date Thu, 24 May 2012 07:17: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/Jetty+Configuration">Jetty
Configuration</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~ffang">Freeman
Fang</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" >                                 maxThreads=&quot;15&quot;
/&gt; <br>      &lt;httpj:connector&gt; <br></td></tr>
            <tr><td class="diff-changed-lines" >&lt;beans:bean <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">class=&quot;org.mortbay.jetty.bio.SocketConnector&quot;&gt;</span>
<span class="diff-added-words"style="background-color: #dfd;">class=&quot;org.eclipse.jetty.server.bio.SocketConnector&quot;&gt;</span>
<br></td></tr>
            <tr><td class="diff-unchanged" >           &lt;beans:property
name = &quot;port&quot; value=&quot;9001&quot; /&gt; <br>      
 &lt;/beans:bean&gt; <br>      &lt;/httpj:connector&gt; <br> 
    &lt;httpj:handlers&gt; <br></td></tr>
            <tr><td class="diff-changed-lines" >&lt;beans:bean <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">class=&quot;org.mortbay.jetty.handler.DefaultHandler&quot;/&gt;</span>
<span class="diff-added-words"style="background-color: #dfd;">class=&quot;org.eclipse.jetty.server.handler.DefaultHandler&quot;/&gt;</span>
<br></td></tr>
            <tr><td class="diff-unchanged" >      &lt;/httpj:handlers&gt;
<br>      &lt;httpj:sessionSupport&gt;true&lt;/httpj:sessionSupport&gt;
<br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h1><a name="JettyConfiguration-ConfiguringtheJettyRuntime"></a>Configuring
the Jetty Runtime</h1>


<h3><a name="JettyConfiguration-Overview"></a>Overview</h3>

<p>This section is for configuring the Jetty runtime used for the CXF standalone model.
 The Jetty runtime is used by HTTP servers and HTTP clients using a decoupled endpoint. The
Jetty runtime's thread pool, connector and handlers can be configured. You can also set a
number of the security settings for an HTTP service provider through the Jetty runtime.</p>

<h3><a name="JettyConfiguration-Namespace"></a>Namespace</h3>

<p>The elements used to configure the Jetty runtime are defined in the namespace <tt><a
href="http://cxf.apache.org/transports/http-jetty/configuration" class="external-link" rel="nofollow">http://cxf.apache.org/transports/http-jetty/configuration</a></tt>.
It is commonly refered to using the prefix <tt>httpj</tt>. In order to use the
Jetty configuration elements you will need to add the lines shown below to the <tt>beans</tt>
element of your endpoint's configuration file. In addition, you will need to add the configuration
elements' namespace to the <tt>xsi:schemaLocation</tt> attribute.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
&lt;beans ...
       <span class="code-keyword">xmlns:httpj</span>="http://cxf.apache.org/transports/http-jetty/configuration
       ...
       xsi:schemaLocation="...
                           http://cxf.apache.org/transports/http-jetty/configuration
                              http://cxf.apache.org/schemas/configuration/http-jetty.xsd
                          ...&gt;
</pre>
</div></div>

<h3><a name="JettyConfiguration-The%7B%7Benginefactory%7D%7Delement"></a>The
<tt>engine-factory</tt> element</h3>

<p>The <tt>httpj:engine-factory</tt> element is the root element used to
configure the Jetty runtime used by an application. It has a single required attribute, bus,
whose value is the name of the Bus that manages the Jetty instances being configured.</p>
<div class='panelMacro'><table class='tipMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/check.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td>The value is typically cxf which
is the name of the default Bus instance.</td></tr></table></div>
<p>The <tt>httpj:engine-factory</tt> element has three children that contain
the information used to configure the HTTP ports instantiated by the Jetty runtime factory.
The children are described below.</p>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Element </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> httpj:engine </td>
<td class='confluenceTd'> Specifies the configuration for a particular Jetty runtime
instance. </td>
</tr>
<tr>
<td class='confluenceTd'> httpj:identifiedTLSServerParameters </td>
<td class='confluenceTd'> Specifies a reusable set of properties for securing an HTTP
server. It has a single attribute, <tt>id</tt>, that specifies a unique identifier
by which the property set can be refered. </td>
</tr>
<tr>
<td class='confluenceTd'> httpj:identifiedThreadingParameters </td>
<td class='confluenceTd'> Specifies a reusable set of properties for controlling a Jetty
instance's thread pool. It has a single attribute, <tt>id</tt>, that specifies
a unique identifier by which the property set can be refered. </td>
</tr>
</tbody></table>
</div>


<h3><a name="JettyConfiguration-The%7B%7Bengine%7D%7Delement"></a>The <tt>engine</tt>
element</h3>

<p>The <tt>httpj:engine</tt> element is used to configure specific instances
of the Jetty runtime. It has a single attribute, <tt>port</tt>, that specifies
the number of the port being managed by the Jetty instance.</p>
<div class='panelMacro'><table class='tipMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/check.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td>You can specify a value of 0 for
the port attribute. Any threading properties specified in an <tt>httpj:engine</tt>
element with its port attribute set to 0 are used as the configuration for all Jetty listeners
that are not explicitly configured.</td></tr></table></div>
<p>Each <tt>httpj:engine</tt> element can have two children: one for configuring
security properties and one for configuring the Jetty instance's thread pool. For each type
of configuration you can either directly provide the configuration information or provide
a reference to a set of configuration properties defined in the parent <tt>httpj:engine-factory</tt>
element.</p>

<p>The child elements used to provide the configuration properties are described below.</p>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Element </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> httpj:tlsServerParameters </td>
<td class='confluenceTd'> Specifies a set of properties for configuring the security
used for the specific Jetty instance. </td>
</tr>
<tr>
<td class='confluenceTd'> httpj:tlsServerParametersRef </td>
<td class='confluenceTd'> Refers to a set of security properties defined by a <tt>identifiedTLSServerParameters</tt>
element. The <tt>id</tt> attribute provides the id of the refered <tt>identifiedTLSServerParameters</tt>
element. </td>
</tr>
<tr>
<td class='confluenceTd'> httpj:threadingParameters </td>
<td class='confluenceTd'> Specifies the size of the thread pool used by the specific
Jetty instance. </td>
</tr>
<tr>
<td class='confluenceTd'> httpj:threadingParametersRef </td>
<td class='confluenceTd'> Refers to a set of properties defined by a <tt>identifiedThreadingParameters</tt>
element. The <tt>id</tt> attribute provides the id of the refered <tt>identifiedThreadingParameters</tt>
element. </td>
</tr>
<tr>
<td class='confluenceTd'> httpj:connector </td>
<td class='confluenceTd'> You can use spring beans syntax to instantiate a connector
and set the connector's properties , this connector will be set to the Jetty server engine
</td>
</tr>
<tr>
<td class='confluenceTd'> httpj:handlers </td>
<td class='confluenceTd'> You can use spring beans syntax to instantiate a Jetty handler
list and set these handlers' properties , the jetty handlers will be set to the Jetty server
engine </td>
</tr>
<tr>
<td class='confluenceTd'> httpj:sessionSupport </td>
<td class='confluenceTd'> If the value is true , the Jetty Engine will set up a session
manager for the Jetty server engine to maintain the sessions. The default value of it is false.</td>
</tr>
<tr>
<td class='confluenceTd'> httpj:reuseAddress </td>
<td class='confluenceTd'> The the value is true, the Jetty Engine connector's socket
will enable the SO_REUSEADDR flage. The default value of it is true. (This feature is available
in CXF 2.0.3)</td>
</tr>
</tbody></table>
</div>


<h3><a name="JettyConfiguration-Configuringthethreadpool"></a>Configuring
the thread pool</h3>

<p>You can configure the size of a Jetty instance's thread pool by either:</p>
<ul>
	<li>Specifying the size of thread pool using a <tt>identifiedThreadingParameters</tt>
element in the <tt>engine-factory</tt> element. You then refer to the element
using a <tt>threadingParametersRef</tt> element.</li>
	<li>Specify the size of the of thread pool directly using a <tt>threadingParameters</tt>
element.<br/>
The <tt>threadingParameters</tt> has two attributes to specify the size of a thread
pool. The attributes are described below. 
<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/warning.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td>The <tt>httpj:identifiedThreadingParameters</tt>
element has a single child <tt>threadingParameters</tt> element.</td></tr></table></div></li>
</ul>


<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Attribute </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> minThreads </td>
<td class='confluenceTd'> Specifies the minimum number of threads available to the Jetty
instance for processing requests. </td>
</tr>
<tr>
<td class='confluenceTd'> maxThreads </td>
<td class='confluenceTd'> Specifies the maximum number of threads available to the Jetty
instance for processing requests. </td>
</tr>
</tbody></table>
</div>


<h3><a name="JettyConfiguration-Example"></a>Example</h3>

<p>The example below shows a configuration fragment that configures a Jetty instance
on port number 9001.</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:beans</span>=<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;httpj:engine-factory bus=<span class="code-quote">"cxf"</span>&gt;</span>
    <span class="code-tag">&lt;httpj:identifiedTLSServerParameters id=<span class="code-quote">"secure"</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">"certs/cherry.jks"</span>/&gt;
        <span class="code-tag">&lt;/sec:keyManagers&gt;</span>
      <span class="code-tag">&lt;/httpj:tlsServerParameters&gt;</span>
    <span class="code-tag">&lt;/httpj:identifiedTLSServerParameters&gt;</span>

    <span class="code-tag">&lt;httpj:engine port=<span class="code-quote">"9001"</span>&gt;</span>
      <span class="code-tag">&lt;httpj:tlsServerParametersRef id=<span class="code-quote">"secure"</span>
/&gt;</span>
      &lt;httpj:threadingParameters minThreads=<span class="code-quote">"5"</span>
                                 maxThreads=<span class="code-quote">"15"</span>
/&gt;
      <span class="code-tag">&lt;httpj:connector&gt;</span>
        <span class="code-tag">&lt;beans:bean class=<span class="code-quote">"org.eclipse.jetty.server.bio.SocketConnector"</span>&gt;</span>
           <span class="code-tag">&lt;beans:property name = <span class="code-quote">"port"</span>
value=<span class="code-quote">"9001"</span> /&gt;</span>
        <span class="code-tag">&lt;/beans:bean&gt;</span>
      <span class="code-tag">&lt;/httpj:connector&gt;</span>
      <span class="code-tag">&lt;httpj:handlers&gt;</span>
        <span class="code-tag">&lt;beans:bean class=<span class="code-quote">"org.eclipse.jetty.server.handler.DefaultHandler"</span>/&gt;</span>
        
      <span class="code-tag">&lt;/httpj:handlers&gt;</span>
      <span class="code-tag">&lt;httpj:sessionSupport&gt;</span>true<span
class="code-tag">&lt;/httpj:sessionSupport&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;/beans&gt;</span>
</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/Jetty+Configuration">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=60564&revisedVersion=10&originalVersion=9">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CXF20DOC/Jetty+Configuration?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message