org.baswell.routes
Class RoutesConfiguration

java.lang.Object
  extended by org.baswell.routes.RoutesConfiguration

public class RoutesConfiguration
extends java.lang.Object

Global route configuration.


Field Summary
 boolean caseInsensitive
          Is route path and parameter matching case insensitive? Default value: false
 java.lang.String defaultContentType
          Default content type returned by all routes if not overridden.
 boolean defaultReturnedStringIsContent
          If true by default strings returned from route methods are sent back as the content.
 boolean developmentMode
          If true the RoutingTable will spawn a thread that rebuilds the routing table every developmentReloadCycleSeconds.
 int developmentReloadCycleSeconds
          The number of seconds between development mode reloads of the RoutingTable.
 RoutesLogger logger
          Logger Routes uses for error messages.
 MetaAuthenticator metaAuthenticator
          The authentication mechanism for the Routes meta page.
 java.lang.String rootForwardPath
          The root directory prepended to all file resource forward paths.
 java.lang.String rootPath
          The global path prepended to all route paths.
 RouteByConvention routeByConvention
          The scheme for mapping route methods to HTTP methods and HTTP paths when not explicitly set by the Route annotation.
 RouteInstancePool routeInstancePool
          The factory for creating new route instances to process HTTP requests.
 RoutesCache routesCache
          The routes cache implementation.
 java.lang.String routesMetaPath
          The path (relative to context path) to access the Routes meta page.
 boolean routeUnannotatedPublicMethods
          Default value for determining if public methods be candidates for HTTP routes if they aren't annotated with Route? If true only unannotated, public methods of the immediate class will be used.
 int streamBufferSize
          The buffer size for streaming back content.
 
Constructor Summary
RoutesConfiguration()
           
 
Method Summary
 RoutesConfiguration defineSymbol(java.lang.String symbol, java.lang.Class clazz)
          Defines a new regular expression whose identity is the given symbol and value is the regular expression for one of the following classes: Byte byte Short short Integer int Long long Float float Double double Boolean boolean String
 RoutesConfiguration defineSymbol(java.lang.String symbol, java.lang.String pattern)
          Defines a new regular expression whose id is the given symbol and value is the given pattern.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

developmentMode

public boolean developmentMode
If true the RoutingTable will spawn a thread that rebuilds the routing table every developmentReloadCycleSeconds. Default value: false


developmentReloadCycleSeconds

public int developmentReloadCycleSeconds
The number of seconds between development mode reloads of the RoutingTable. If developmentMode is false this property is not used. Default value: 5


rootPath

public java.lang.String rootPath
The global path prepended to all route paths. For example if you want your route objects to process request that start with "/api" set this variable to "/api" and then all route class paths will get prepended with this value. Default value: null


rootForwardPath

public java.lang.String rootForwardPath
The root directory prepended to all file resource forward paths. If you want each Route to specify the full forward path set this variable to null. Default value: "/WEB-INF/jsps"


caseInsensitive

public boolean caseInsensitive
Is route path and parameter matching case insensitive? Default value: false


defaultContentType

public java.lang.String defaultContentType
Default content type returned by all routes if not overridden. This can be overridden in Routes.defaultContentType(), Route.contentType(), or by explicitly calling ServletResponse.setContentType(String) in the route method. Default value: null


defaultReturnedStringIsContent

public boolean defaultReturnedStringIsContent
If true by default strings returned from route methods are sent back as the content. If false by default returned strings are interpreted as file paths that the request is forwarded to. This can be overridden in Routes.defaultReturnedStringIsContent() or Route.returnedStringIsContent(). Default value: false


streamBufferSize

public int streamBufferSize
The buffer size for streaming back content. Default value: 16 * 1024


routeInstancePool

public RouteInstancePool routeInstancePool
The factory for creating new route instances to process HTTP requests. Default value: DefaultRouteInstancePool


routeByConvention

public RouteByConvention routeByConvention
The scheme for mapping route methods to HTTP methods and HTTP paths when not explicitly set by the Route annotation. Default value: RouteByLowercaseConvention


routesCache

public RoutesCache routesCache
The routes cache implementation. No cache will be used if null. Default value: null


routesMetaPath

public java.lang.String routesMetaPath
The path (relative to context path) to access the Routes meta page. If this value is null then the Routes meta page will not be accessible. If there is a collision between this path and a routes path, the routes path will win. Default value: null


metaAuthenticator

public MetaAuthenticator metaAuthenticator
The authentication mechanism for the Routes meta page. If null, no authentication is required. Default value: null


routeUnannotatedPublicMethods

public boolean routeUnannotatedPublicMethods
Default value for determining if public methods be candidates for HTTP routes if they aren't annotated with Route? If true only unannotated, public methods of the immediate class will be used. Public, unannotated methods of extended classes will not be candidates (ex. Object.equals(Object). This can be overriden by Routes.routeUnannotatedPublicMethods(). Default value: false


logger

public RoutesLogger logger
Logger Routes uses for error messages. Set to null to suppress all logging. By default SystemErrLogger.

Constructor Detail

RoutesConfiguration

public RoutesConfiguration()
Method Detail

defineSymbol

public RoutesConfiguration defineSymbol(java.lang.String symbol,
                                        java.lang.Class clazz)
                                 throws java.lang.IllegalArgumentException
Defines a new regular expression whose identity is the given symbol and value is the regular expression for one of the following classes:

Parameters:
symbol -
clazz -
Returns:
Throws:
java.lang.IllegalArgumentException - If the given clazz is not one of the above classes.

defineSymbol

public RoutesConfiguration defineSymbol(java.lang.String symbol,
                                        java.lang.String pattern)
                                 throws java.lang.IllegalArgumentException
Defines a new regular expression whose id is the given symbol and value is the given pattern.

Parameters:
symbol -
pattern -
Returns:
Throws:
java.lang.IllegalArgumentException - If the given pattern is not a valid regular expression.