Chinaunix首页 | 论坛 | 博客
  • 博客访问: 894844
  • 博文数量: 322
  • 博客积分: 6688
  • 博客等级: 准将
  • 技术积分: 3626
  • 用 户 组: 普通用户
  • 注册时间: 2010-09-19 11:26
文章分类

全部博文(322)

文章存档

2013年(5)

2012年(66)

2011年(87)

2010年(164)

分类: 系统运维

2010-11-12 22:11:10

Overview

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.

Namespace

The elements used to configure the Jetty runtime are defined in the namespace . It is commonly refered to using the prefix httpj. In order to use the Jetty configuration elements you will need to add the lines shown below to the beans element of your endpoint's configuration file. In addition, you will need to add the configuration elements' namespace to the xsi:schemaLocation attribute.

xmlns:httpj="
       ...
       xsi:schemaLocation="...
                           
                              
                          ...>

The engine-factory element

The httpj:engine-factory 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.

The value is typically cxf which is the name of the default Bus instance.

The httpj:engine-factory 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.

ElementDescription
httpj:engineSpecifies the configuration for a particular Jetty runtime instance.
httpj:identifiedTLSServerParametersSpecifies a reusable set of properties for securing an HTTP server. It has a single attribute, id, that specifies a unique identifier by which the property set can be refered.
httpj:identifiedThreadingParametersSpecifies a reusable set of properties for controlling a Jetty instance's thread pool. It has a single attribute,id, that specifies a unique identifier by which the property set can be refered.

The engine element

The httpj:engine element is used to configure specific instances of the Jetty runtime. It has a single attribute, port, that specifies the number of the port being managed by the Jetty instance.

You can specify a value of 0 for the port attribute. Any threading properties specified in an httpj:engine element with its port attribute set to 0 are used as the configuration for all Jetty listeners that are not explicitly configured.

Each httpj:engine 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 httpj:engine-factory element.

The child elements used to provide the configuration properties are described below.

ElementDescription
httpj:tlsServerParametersSpecifies a set of properties for configuring the security used for the specific Jetty instance.
httpj:tlsServerParametersRefRefers to a set of security properties defined by a identifiedTLSServerParameters element. The id attribute provides the id of the refered identifiedTLSServerParameters element.
httpj:threadingParametersSpecifies the size of the thread pool used by the specific Jetty instance.
httpj:threadingParametersRefRefers to a set of properties defined by a identifiedThreadingParameters element. The id attribute provides the id of the refered identifiedThreadingParameters element.
httpj:connectorYou 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
httpj:handlersYou 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
httpj:sessionSupportIf 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.
httpj:reuseAddressThe 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)

Configuring the thread pool

You can configure the size of a Jetty instance's thread pool by either:

  • Specifying the size of thread pool using a identifiedThreadingParameters element in the engine-factory element. You then refer to the element using a threadingParametersRef element.
  • Specify the size of the of thread pool directly using a threadingParameters element.
    The threadingParameters has two attributes to specify the size of a thread pool. The attributes are described below.
    The httpj:identifiedThreadingParameters element has a single child threadingParameters element.
AttributeDescription
minThreadsSpecifies the minimum number of threads available to the Jetty instance for processing requests.
maxThreadsSpecifies the maximum number of threads available to the Jetty instance for processing requests.

Example

The example below shows a configuration fragment that configures a Jetty instance on port number 9001.

""
  xmlns:beans=""
  xmlns:xsi=""
  xmlns:sec="http://cxf.apache.org/configuration/security"
  xmlns:http=""
  xmlns:httpj=""
  xmlns:jaxws=""
  xsi:schemaLocation="http://cxf.apache.org/configuration/security
  		      http://cxf.apache.org/schemas/configuration/security.xsd
            
            
            
            
            
            /spring-beans-2.0.xsd">
  ...

  "cxf">
    "secure">
      "password">
        "JKS" password="password"
                      file="certs/cherry.jks"/>
      
    

    "9001">
      "secure" />
      "5"
                                 maxThreads="15" />
      
        "org.mortbay.jetty.bio.SocketConnector">
           "port" value="9001" />
        
      
      
        "org.mortbay.jetty.handler.DefaultHandler"/>         
      
      true
    
  
 
阅读(687) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2010-11-15 15:34:11

很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com