restart.server
Class RestServerPolicy

java.lang.Object
  extended by restart.server.RestServerPolicy

public abstract class RestServerPolicy
extends java.lang.Object

Policies about the RestServer

Author:
Thibault Ducray

Field Summary
static long DEFAULT_MAX_CONTENTLENGTH
           
static int DEFAULT_MAX_HEADERLINE_LENGTH
           
static int DEFAULT_MAX_RUNNING_THREADS
           
static int DEFAULT_SO_TIMEOUT
           
 
Constructor Summary
RestServerPolicy()
           
 
Method Summary
 boolean acceptConnectionFrom(java.net.InetAddress inetAddress)
          Accept this connection ?
static RestServerPolicy getDefaultInstance()
          Get a default instance
 long getMaxContentLength(java.lang.String contentType)
          Maximum length of content, by type.
 int getMaxHeaderLineLength()
          Header line max length
 int getMaxRunningThreads()
          Maximum number of running socket threads (ie active connections).
 int getSoTimeout()
          SO_TIMEOUT
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MAX_RUNNING_THREADS

public static final int DEFAULT_MAX_RUNNING_THREADS
See Also:
Constant Field Values

DEFAULT_SO_TIMEOUT

public static final int DEFAULT_SO_TIMEOUT
See Also:
Constant Field Values

DEFAULT_MAX_CONTENTLENGTH

public static final long DEFAULT_MAX_CONTENTLENGTH
See Also:
Constant Field Values

DEFAULT_MAX_HEADERLINE_LENGTH

public static final int DEFAULT_MAX_HEADERLINE_LENGTH
See Also:
Constant Field Values
Constructor Detail

RestServerPolicy

public RestServerPolicy()
Method Detail

getDefaultInstance

public static RestServerPolicy getDefaultInstance()
Get a default instance


getMaxRunningThreads

public int getMaxRunningThreads()
Maximum number of running socket threads (ie active connections).


getSoTimeout

public int getSoTimeout()
SO_TIMEOUT


getMaxHeaderLineLength

public int getMaxHeaderLineLength()
Header line max length


getMaxContentLength

public long getMaxContentLength(java.lang.String contentType)
Maximum length of content, by type. If the type is unknown the default max contentLength is returned. If you reimplement this class you may want to use a hashtable contentType -> maxContentLength

Parameters:
contentType - the mime contentType
Returns:
the max contentLength for the give contentType, -1 means "no limit", 0 means "none of this" !

acceptConnectionFrom

public boolean acceptConnectionFrom(java.net.InetAddress inetAddress)
Accept this connection ?
Override this method to filter incoming connections (eg: on IP address).

Returns:
yes (true) or no (false). Default is true.