|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.restlet.engine.Helper
org.restlet.engine.RestletHelper<T>
org.restlet.engine.ConnectorHelper<T>
org.restlet.engine.http.connector.BaseHelper<Server>
org.restlet.engine.http.connector.BaseServerHelper
public abstract class BaseServerHelper
Base server helper based on NIO blocking sockets. Here is the list of parameters that are supported. They should be set in the Server's context before it is started:
Parameter name | Value type | Default value | Description | useForwardedForHeader | boolean | false | Lookup the "X-Forwarded-For" header supported by popular proxies and caches and uses it to populate the Request.getClientAddresses() method result. This information is only safe for intermediary components within your local network. Other addresses could easily be changed by setting a fake header and should not be trusted for serious security checks. |
---|
Constructor Summary | |
---|---|
BaseServerHelper(Server server)
Constructor. |
Method Summary | |
---|---|
protected java.util.concurrent.ExecutorService |
createAcceptorService()
Creates the handler service. |
protected java.net.ServerSocket |
createServerSocket()
Create a server socket channel and bind it to the given address |
protected java.net.SocketAddress |
createSocketAddress()
Creates a socket address to listen on. |
java.net.ServerSocket |
getServerSocket()
Returns the server socket. |
void |
handle(Request request,
Response response)
Handles a call by invoking the helped Server's Server.handle(Request, Response) method. |
void |
handleInbound(Response response)
Handles an inbound message. |
void |
handleOutbound(Response response)
Handles an outbound message. |
void |
setEphemeralPort(int localPort)
Sets the ephemeral port in the attributes map if necessary. |
void |
setEphemeralPort(java.net.ServerSocket socket)
Sets the ephemeral port in the attributes map if necessary. |
void |
start()
Start callback. |
void |
stop()
Stop callback. |
Methods inherited from class org.restlet.engine.ConnectorHelper |
---|
getConnectorService, getContext, getProtocols, update |
Methods inherited from class org.restlet.engine.RestletHelper |
---|
getAttributes, getHelped, getHelpedParameters, getLogger, getMetadataService, setHelped |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BaseServerHelper(Server server)
server
- The server to help.Method Detail |
---|
protected java.util.concurrent.ExecutorService createAcceptorService()
protected java.net.ServerSocket createServerSocket() throws java.io.IOException
java.io.IOException
protected java.net.SocketAddress createSocketAddress() throws java.io.IOException
java.io.IOException
public java.net.ServerSocket getServerSocket()
public void handle(Request request, Response response)
Server.handle(Request, Response)
method.
handle
in class RestletHelper<Server>
request
- The request to handle.response
- The response to update.public void handleInbound(Response response)
BaseHelper
handleInbound
in class BaseHelper<Server>
response
- The response to handle.public void handleOutbound(Response response)
BaseHelper
handleOutbound
in class BaseHelper<Server>
response
- The response to handle.public void setEphemeralPort(int localPort)
localPort
- The ephemeral local port.public void setEphemeralPort(java.net.ServerSocket socket)
socket
- The bound server socket.public void start() throws java.lang.Exception
RestletHelper
start
in class BaseHelper<Server>
java.lang.Exception
public void stop() throws java.lang.Exception
RestletHelper
stop
in class BaseHelper<Server>
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |