com.noelios.restlet.ext.asyncweb
Class AsyncWebServerHelper

java.lang.Object
  extended by org.restlet.util.Helper
      extended by com.noelios.restlet.ConnectorHelper
          extended by com.noelios.restlet.ServerHelper
              extended by com.noelios.restlet.http.HttpServerHelper
                  extended by com.noelios.restlet.ext.asyncweb.AsyncWebServerHelper
All Implemented Interfaces:
org.safehaus.asyncweb.container.ServiceContainer
Direct Known Subclasses:
HttpServerHelper

public abstract class AsyncWebServerHelper
extends HttpServerHelper
implements org.safehaus.asyncweb.container.ServiceContainer

Abstract AsyncWeb server connector. Here is the list of parameters that are supported:

Parameter name Value type Default value Description
ioWorkerCount int 2 Number of worker threads to employ.
converter String com.noelios.restlet.http.HttpServerConverter Class name of the converter of low-level HTTP calls into high level requests and responses.
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.

This implementation passes by all of AsyncWeb ServiceContainer, HttpServiceHandler etc. mechanisms and implements a HttpServerHelper and a ServiceContainer directly. It takes care about setting up a NIOTransport.

Note: This implementation is not usable inside an AsyncWeb standard environment because it represents a container and not a handler; it takes full control over the container lifecycle.

Author:
Lars Heuer (heuer[at]semagia.com) Semagia, Jerome Louvel (contact@noelios.com)

Constructor Summary
AsyncWebServerHelper(Server server, boolean confidential)
          Constructor.
 
Method Summary
 void addServiceHandler(org.safehaus.asyncweb.container.ServiceHandler serviceHandler)
           
 void addTransport(org.safehaus.asyncweb.transport.Transport transport)
           
 void dispatchRequest(org.safehaus.asyncweb.request.AsyncWebRequest request)
           
 int getIoWorkerCount()
          Returns the number of worker threads to employ.
protected  org.safehaus.asyncweb.transport.Transport getTransport()
          Returns the AsyncWeb transport layer.
protected  void setTransport(org.safehaus.asyncweb.transport.Transport transport)
          Sets the AsyncWeb transport layer.
 void start()
          Starts the Connector.
 void stop()
          Stops the Connector.
 
Methods inherited from class com.noelios.restlet.http.HttpServerHelper
getConverter, handle, setConverter
 
Methods inherited from class com.noelios.restlet.ServerHelper
getContext, getLogger, getParameters, getServer, handle, setServer
 
Methods inherited from class com.noelios.restlet.ConnectorHelper
createContext, getProtocols
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsyncWebServerHelper

public AsyncWebServerHelper(Server server,
                            boolean confidential)
Constructor.

Parameters:
server - The server to help.
confidential - Indicates if the server is acting in HTTPS mode.
Method Detail

addServiceHandler

public void addServiceHandler(org.safehaus.asyncweb.container.ServiceHandler serviceHandler)
Specified by:
addServiceHandler in interface org.safehaus.asyncweb.container.ServiceContainer

addTransport

public void addTransport(org.safehaus.asyncweb.transport.Transport transport)
Specified by:
addTransport in interface org.safehaus.asyncweb.container.ServiceContainer

dispatchRequest

public void dispatchRequest(org.safehaus.asyncweb.request.AsyncWebRequest request)
Specified by:
dispatchRequest in interface org.safehaus.asyncweb.container.ServiceContainer

start

public void start()
           throws org.safehaus.asyncweb.container.ContainerLifecycleException
Starts the Connector.

Specified by:
start in interface org.safehaus.asyncweb.container.ServiceContainer
Overrides:
start in class ConnectorHelper
Throws:
org.safehaus.asyncweb.container.ContainerLifecycleException

stop

public void stop()
Stops the Connector.

Specified by:
stop in interface org.safehaus.asyncweb.container.ServiceContainer
Overrides:
stop in class ConnectorHelper

getIoWorkerCount

public int getIoWorkerCount()
Returns the number of worker threads to employ.

Returns:
The number of worker threads to employ.

setTransport

protected void setTransport(org.safehaus.asyncweb.transport.Transport transport)
Sets the AsyncWeb transport layer.

Parameters:
transport - The AsyncWeb transport layer.

getTransport

protected org.safehaus.asyncweb.transport.Transport getTransport()
Returns the AsyncWeb transport layer.

Returns:
The AsyncWeb transport layer.


Copyright © 2005-2007 Noelios Consulting.