nl.pbemengine.engine.ng.base.webserver
Class ContextPathHandler

java.lang.Object
  extended by nl.pbemengine.engine.ng.base.webserver.ContextPathHandler

public class ContextPathHandler
extends java.lang.Object

Handler class for a specific context path of the web server, handles all actions and page requests for this context path.

Author:
Jeroen Steenbeeke

Field Summary
static java.lang.String ACTION_SUFFIX
          The file extension that signifies we are invoking an action rather than requesting a file
 
Constructor Summary
ContextPathHandler(java.lang.String name, freemarker.cache.TemplateLoader loader, ResourceFetcher fetcher)
          Create a new ContextPathHandler with the indicate template loader
 
Method Summary
 freemarker.cache.TemplateLoader getLoader()
          Return the templateloader for this ContextPathHandler, used to instantiate result mappings that use templates
 Content processRequest(java.lang.String requestedObject, PageContext context)
          Process a web request for this context path
 boolean registerAction(java.lang.String name, java.lang.Class action)
          Register an action class for use when a specific action name is invoked
 boolean registerResult(java.lang.String actionName, java.lang.String resultName, ResultAction response)
          Register a Result object to be associated with a specific result from a specific action
 void setIndexAction(java.lang.Class indexAction)
           
 void setServer(WebServer server)
           
 void setServerCallback(WebserverCallback serverCallback)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACTION_SUFFIX

public static final java.lang.String ACTION_SUFFIX
The file extension that signifies we are invoking an action rather than requesting a file

See Also:
Constant Field Values
Constructor Detail

ContextPathHandler

public ContextPathHandler(java.lang.String name,
                          freemarker.cache.TemplateLoader loader,
                          ResourceFetcher fetcher)
Create a new ContextPathHandler with the indicate template loader

Parameters:
name - The name of the context path handler, used for error messages
loader - The TemplateLoader object, which is used to load template objects
fetcher - The ResourceFetcher object, which is used to load non-template objects
Method Detail

setServerCallback

public void setServerCallback(WebserverCallback serverCallback)

setServer

public void setServer(WebServer server)

registerAction

public boolean registerAction(java.lang.String name,
                              java.lang.Class action)
Register an action class for use when a specific action name is invoked

Parameters:
name - The name of the action request that triggers this action class. For instance, if your name equals "foo", then "foo.action" will trigger this class
action - The action class triggered by the name
Returns:
true if succesful, false otherwise

registerResult

public boolean registerResult(java.lang.String actionName,
                              java.lang.String resultName,
                              ResultAction response)
Register a Result object to be associated with a specific result from a specific action

Parameters:
actionName - The action to tie this result to
resultName - The result name to trigger the response object
response - The response to tie to this action/result combination
Returns:
true if succesful, false otherwise

processRequest

public Content processRequest(java.lang.String requestedObject,
                              PageContext context)
Process a web request for this context path

Parameters:
requestedObject - The object requested
context - The context in which it was requested
Returns:
A Content object

getLoader

public freemarker.cache.TemplateLoader getLoader()
Return the templateloader for this ContextPathHandler, used to instantiate result mappings that use templates

Returns:
A TemplateLoader object

setIndexAction

public void setIndexAction(java.lang.Class indexAction)


Copyright © 2008. All Rights Reserved.