public abstract class BaseServerHelper extends BaseHelper<Server>
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 and Description |
---|
BaseServerHelper(Server server)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected ExecutorService |
createAcceptorService()
Creates the handler service.
|
protected ServerSocket |
createServerSocket()
Create a server socket channel and bind it to the given address
|
protected SocketAddress |
createSocketAddress()
Creates a socket address to listen on.
|
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.
|
boolean |
isProxying()
Indicates if the helper is going through a client proxy or is a server
proxy.
|
void |
setEphemeralPort(int localPort)
Sets the ephemeral port in the attributes map if necessary.
|
void |
setEphemeralPort(ServerSocket socket)
Sets the ephemeral port in the attributes map if necessary.
|
void |
start()
Start callback.
|
void |
stop()
Stop callback.
|
createConnection, createController, createControllerService, createResponse, createWorkerService, getConnections, getController, getControllerSleepTimeMs, getInboundBufferSize, getInboundMessages, getMaxConnectionsPerHost, getMaxThreads, getMaxTotalConnections, getMinThreads, getOutboundBufferSize, getOutboundMessages, getThreadMaxIdleTimeMs, getWorkerService, handleNextInbound, handleNextOutbound, isClientSide, isControllerDaemon, isPersistingConnections, isPipeliningConnections, isServerSide, isTracing, isWorkerServiceFull
getConnectorService, getContext, getProtocols, update
getAttributes, getHelped, getHelpedParameters, getLogger, getMetadataService, setHelped
public BaseServerHelper(Server server)
server
- The server to help.protected ExecutorService createAcceptorService()
protected ServerSocket createServerSocket() throws IOException
IOException
protected SocketAddress createSocketAddress() throws IOException
IOException
public 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 boolean isProxying()
BaseHelper
isProxying
in class BaseHelper<Server>
public void setEphemeralPort(int localPort)
localPort
- The ephemeral local port.public void setEphemeralPort(ServerSocket socket)
socket
- The bound server socket.public void start() throws Exception
RestletHelper
start
in class BaseHelper<Server>
Exception
public void stop() throws Exception
RestletHelper
stop
in class BaseHelper<Server>
Exception
Copyright © 2005–2016. All rights reserved.