2
* Copyright 2005-2012 Restlet S.A.S.
4
* The contents of this file are subject to the terms of one of the following
5
* open source licenses: Apache 2.0 or LGPL 3.0 or LGPL 2.1 or CDDL 1.0 or EPL
6
* 1.0 (the "Licenses"). You can select the license that you prefer but you may
7
* not use this file except in compliance with one of these Licenses.
9
* You can obtain a copy of the Apache 2.0 license at
10
* http://www.opensource.org/licenses/apache-2.0
12
* You can obtain a copy of the LGPL 3.0 license at
13
* http://www.opensource.org/licenses/lgpl-3.0
15
* You can obtain a copy of the LGPL 2.1 license at
16
* http://www.opensource.org/licenses/lgpl-2.1
18
* You can obtain a copy of the CDDL 1.0 license at
19
* http://www.opensource.org/licenses/cddl1
21
* You can obtain a copy of the EPL 1.0 license at
22
* http://www.opensource.org/licenses/eclipse-1.0
24
* See the Licenses for the specific language governing permissions and
25
* limitations under the Licenses.
27
* Alternatively, you can obtain a royalty free commercial license with less
28
* limitations, transferable or non-transferable, directly at
29
* http://www.restlet.com/products/restlet-framework
31
* Restlet is a registered trademark of Restlet S.A.S.
34
package org.restlet.ext.jetty;
36
import org.eclipse.jetty.server.AbstractConnector;
37
import org.eclipse.jetty.server.bio.SocketConnector;
38
import org.eclipse.jetty.server.nio.BlockingChannelConnector;
39
import org.eclipse.jetty.server.nio.SelectChannelConnector;
40
import org.restlet.Server;
41
import org.restlet.data.Protocol;
44
* Jetty HTTP server connector. Here is the list of additional parameters that
45
* are supported. They should be set in the Server's context before it is
49
* <th>Parameter name</th>
51
* <th>Default value</th>
52
* <th>Description</th>
58
* <td>The type of Jetty connector to use.<br>
59
* 1 : Selecting NIO connector (Jetty's SelectChannelConnector class).<br>
60
* 2 : Blocking NIO connector (Jetty's BlockingChannelConnector class).<br>
61
* 3 : Blocking BIO connector (Jetty's SocketConnector class).</td>
65
* @see <a href="http://jetty.mortbay.org/jetty6/">Jetty home page</a>
66
* @author Jerome Louvel
68
public class HttpServerHelper extends JettyServerHelper {
75
public HttpServerHelper(Server server) {
77
getProtocols().add(Protocol.HTTP);
81
* Creates a new internal Jetty connector.
83
* @return A new internal Jetty connector.
86
protected AbstractConnector createConnector() {
87
AbstractConnector result = null;
89
// Create and configure the Jetty HTTP connector
92
// Selecting NIO connector
93
result = new SelectChannelConnector();
96
// Blocking NIO connector
97
result = new BlockingChannelConnector();
100
// Blocking BIO connector
101
result = new SocketConnector();
109
* Returns the type of Jetty connector to use.
111
* @return The type of Jetty connector to use.
113
public int getType() {
114
return Integer.parseInt(getHelpedParameters()
115
.getFirstValue("type", "1"));