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 Wed, 21 Oct 2009 00:18:00 GMT
<html>
<head>
    <base href="http://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=CXF20DOC&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background-color: white" bgcolor="white">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
     <h2><a href="http://cwiki.apache.org/confluence/display/CXF20DOC/Jetty+Configuration">Jetty
Configuration</a></h2>
     <h4>Page <b>edited</b> by             <a href="http://cwiki.apache.org/confluence/display/~dkulp">Daniel
Kulp</a>
    </h4>
     
          <br/>
     <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" 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.<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><br/>
The value is typically cxf which is the name of the default Bus instance.</td></tr></table></div><br/>
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>
<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>

<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.<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><br/>
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><br/>
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>
<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>

<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>


<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>

<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;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: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.mortbay.jetty.nio.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.mortbay.jetty.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;/hj: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="http://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
       </div>

       <a href="http://cwiki.apache.org/confluence/display/CXF20DOC/Jetty+Configuration">View
Online</a>
       |
       <a href="http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=60564&revisedVersion=5&originalVersion=4">View
Change</a>
              |
       <a href="http://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