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 > Jetty Configuration
Date Mon, 12 Aug 2013 15:21: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/Jetty+Configuration">Jetty
Configuration</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-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >The child elements used to provide
the configuration properties are described below. <br>|| Element || Description || <br></td></tr>
            <tr><td class="diff-changed-lines" >| httpj:tlsServerParameters |
Specifies a set of properties for configuring the security used for the specific Jetty instance.
See the [TLS <span class="diff-changed-words">Configuration|https://cwiki.apache.org/confluence/display/CXF<span
class="diff-added-chars"style="background-color: #dfd;">20DOC</span>/TLS+Configuration]</span>
page for more information.| <br></td></tr>
            <tr><td class="diff-unchanged" >| httpj:tlsServerParametersRef | Refers
to a set of security properties defined by a {{identifiedTLSServerParameters}} element. The
{{id}} attribute provides the id of the referred {{identifiedTLSServerParameters}} element.
| <br>| httpj:threadingParameters | Specifies the size of the thread pool used by the
specific Jetty instance. | <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 referred 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="theme: Default; brush: xml; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
&lt;beans ...
  xmlns:httpj="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 referred. </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 referred. </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. See the <a href="https://cwiki.apache.org/confluence/display/CXF20DOC/TLS+Configuration"
class="external-link" rel="nofollow">TLS Configuration</a> page for more information.</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 referred <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 referred <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="theme: Default; brush: xml; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
&lt;beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:beans="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;httpj:engine-factory bus="cxf"&gt;
    &lt;httpj:identifiedTLSServerParameters id="secure"&gt;
      &lt;httpj:tlsServerParameters&gt;
        &lt;sec:keyManagers keyPassword="password"&gt;
          &lt;sec:keyStore type="JKS" password="password"
                      file="certs/cherry.jks"/&gt;
        &lt;/sec:keyManagers&gt;
      &lt;/httpj:tlsServerParameters&gt;
    &lt;/httpj:identifiedTLSServerParameters&gt;

    &lt;httpj:engine port="9001"&gt;
      &lt;httpj:tlsServerParametersRef id="secure" /&gt;
      &lt;httpj:threadingParameters minThreads="5"
                                 maxThreads="15" /&gt;
      &lt;httpj:connector&gt;
        &lt;beans:bean class="org.eclipse.jetty.server.bio.SocketConnector"&gt;
           &lt;beans:property name = "port" value="9001" /&gt;
        &lt;/beans:bean&gt;
      &lt;/httpj:connector&gt;
      &lt;httpj:handlers&gt;
        &lt;beans:bean class="org.eclipse.jetty.server.handler.DefaultHandler"/&gt;
        
      &lt;/httpj:handlers&gt;
      &lt;httpj:sessionSupport&gt;true&lt;/httpj:sessionSupport&gt;
    &lt;/httpj:engine&gt;
  &lt;/httpj:engine-factory&gt;
 &lt;/beans&gt;
</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/Jetty+Configuration">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=60564&revisedVersion=14&originalVersion=13">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