org.nnsoft.shs
Class AbstractHttpServerConfiguration

java.lang.Object
  extended by org.nnsoft.shs.AbstractHttpServerConfiguration
All Implemented Interfaces:
HttpServerConfiguration
Direct Known Subclasses:
SimpleHttpServerLauncher

public abstract class AbstractHttpServerConfiguration
extends Object
implements HttpServerConfiguration

An abstract RequestDispatcherConfiguration implementation that helps on dropping the boilerplate code of repeating the binder variable reference when binding.


Constructor Summary
AbstractHttpServerConfiguration()
           
 
Method Summary
protected  void bindServerToHost(String host)
          Configure the host name or the textual representation of its IP address the server has to be bound.
protected  void bindServerToPort(int port)
          Configure the port number where binding the server.
protected abstract  void configure()
           
 void configure(HttpServerConfigurator configurator)
          
protected  RequestHandlerBuilder serve(String path)
          Starts binding a request path, can be expressed using the web.xml grammar, to a RequestHandler.
protected  void serveRequestsWithThreads(int threads)
          Configure the number of threads that will serve the HTTP requests.
protected  void sessionsHaveMagAge(int sessionMaxAge)
          Configure the maximum number of seconds of life of HTTP Sessions.
protected  DefaultResponseBuilder when(Response.Status status)
          Allows defining the default response has to be shown when replying to clients with specified status.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractHttpServerConfiguration

public AbstractHttpServerConfiguration()
Method Detail

configure

public final void configure(HttpServerConfigurator configurator)

Specified by:
configure in interface HttpServerConfiguration

configure

protected abstract void configure()
See Also:
RequestDispatcherConfiguration#configure(HttpServerConfigurator)

bindServerToHost

protected final void bindServerToHost(String host)
Configure the host name or the textual representation of its IP address the server has to be bound.

Parameters:
host - the host name or the textual representation of its IP address.
See Also:
HttpServerConfigurator.bindServerToHost(String)

bindServerToPort

protected final void bindServerToPort(int port)
Configure the port number where binding the server.

Parameters:
port - the port number where binding the server.
See Also:
HttpServerConfigurator.bindServerToPort(int)

serveRequestsWithThreads

protected final void serveRequestsWithThreads(int threads)
Configure the number of threads that will serve the HTTP requests.

Parameters:
threads - the number of threads that will serve the HTTP requests.
See Also:
HttpServerConfigurator.serveRequestsWithThreads(int)

sessionsHaveMagAge

protected final void sessionsHaveMagAge(int sessionMaxAge)
Configure the maximum number of seconds of life of HTTP Sessions.

Parameters:
sessionMaxAge - the maximum number of seconds of life of HTTP Sessions.
See Also:
HttpServerConfigurator.sessionsHaveMagAge(int)

serve

protected final RequestHandlerBuilder serve(String path)
Starts binding a request path, can be expressed using the web.xml grammar, to a RequestHandler.

Parameters:
path - the path for handling calls.
Returns:
the builder to associate a RequestDispatcher
See Also:
HttpServerConfigurator.serve(String)

when

protected final DefaultResponseBuilder when(Response.Status status)
Allows defining the default response has to be shown when replying to clients with specified status.

Parameters:
status - the status the server is replying to clients
Returns:
the builder to associate a fixed file to the given status


Copyright © 2012 99 Software Foundation. All Rights Reserved.