The |
Element | Description |
---|---|
httpj:tlsServerParameters | Specifies a set of properties for configuring the security used for the specific Jetty instance. See the TLS Configuration page for more information. |
httpj:tlsServerParametersRef | Refers to a set of security properties defined by a |
httpj:threadingParameters | Specifies the size of the thread pool used by the specific Jetty instance. |
httpj:threadingParametersRef | Refers to a set of properties defined by a |
httpj:connector | 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 |
httpj:handlers | 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 |
httpj:sessionSupport | 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. |
httpj:reuseAddress | 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) |
You can configure the size of a Jetty instance's thread pool by either:
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.
Attribute | Description |
---|---|
minThreads | Specifies the minimum number of threads available to the Jetty instance for processing requests. |
maxThreads | Specifies the maximum number of threads available to the Jetty instance for processing requests. |
If HttpServerEngineSupport#ENABLE_HTTP2 bus property is set, Jetty engine will enable the HTTP/2 support as well: HTTP/2 over cleartext (h2c) if TLS is not configured, regular HTTP/2 otherwise. It requires additional dependencies to be bundled by the application.
<dependency> <groupId>org.eclipse.jetty.http2</groupId> <artifactId>http2-server</artifactId> <version>${jetty.version}</version> </dependency> <dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-alpn-server</artifactId> <version>${jetty.version}</version> </dependency>
Additionally, for JDK8 you would need to include:
<dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-alpn-openjdk8-server</artifactId> <version>${jetty.version}</version> </dependency>
If you are using JDK9 and above, please use the following dependency instead:
<dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-alpn-java-server</artifactId> <version>${jetty.version}</version> </dependency>
The example below shows a configuration fragment that configures a Jetty instance on port number 9001.
<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"> ... <httpj:engine-factory bus="cxf"> <httpj:identifiedTLSServerParameters id="secure"> <httpj:tlsServerParameters> <sec:keyManagers keyPassword="password"> <sec:keyStore type="JKS" password="password" file="certs/cherry.jks"/> </sec:keyManagers> </httpj:tlsServerParameters> </httpj:identifiedTLSServerParameters> <httpj:engine port="9001"> <httpj:tlsServerParametersRef id="secure" /> <httpj:threadingParameters minThreads="5" maxThreads="15" /> <httpj:connector> <beans:bean class="org.eclipse.jetty.server.bio.SocketConnector"> <beans:property name = "port" value="9001" /> </beans:bean> </httpj:connector> <httpj:handlers> <beans:bean class="org.eclipse.jetty.server.handler.DefaultHandler"/> </httpj:handlers> <httpj:sessionSupport>true</httpj:sessionSupport> </httpj:engine> </httpj:engine-factory> </beans>