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.engine;
36
import java.util.List;
37
import java.util.concurrent.CopyOnWriteArrayList;
39
import org.restlet.Connector;
40
import org.restlet.Context;
41
import org.restlet.data.Protocol;
44
* Base connector helper.
46
* @author Jerome Louvel
48
public abstract class ConnectorHelper<T extends Connector> extends
52
* Returns the connector service associated to a request.
54
* @return The connector service associated to a request.
56
public static org.restlet.service.ConnectorService getConnectorService() {
57
org.restlet.service.ConnectorService result = null;
58
org.restlet.Application application = org.restlet.Application
61
if (application != null) {
62
result = application.getConnectorService();
64
result = new org.restlet.service.ConnectorService();
70
/** The protocols simultaneously supported. */
71
private final List<Protocol> protocols;
76
public ConnectorHelper(T connector) {
78
this.protocols = new CopyOnWriteArrayList<Protocol>();
82
* Returns the helped Restlet context.
84
* @return The helped Restlet context.
87
public Context getContext() {
88
if (Edition.CURRENT == Edition.GWT) {
92
return super.getContext();
96
* Returns the protocols simultaneously supported.
98
* @return The protocols simultaneously supported.
100
public List<Protocol> getProtocols() {
101
return this.protocols;
105
public void start() throws Exception {
109
public void stop() throws Exception {
113
public void update() throws Exception {