org.blojsom.dispatcher.webmacro
Class WebMacroDispatcher

java.lang.Object
  extended byorg.blojsom.dispatcher.webmacro.WebMacroDispatcher
All Implemented Interfaces:
Dispatcher

public class WebMacroDispatcher
extends java.lang.Object
implements Dispatcher

WebMacro dispatcher

Since:
blojsom 3.0
Version:
$Id: WebMacroDispatcher.java,v 1.2 2007/01/17 01:15:46 czarneckid Exp $
Author:
David Czarnecki

Constructor Summary
WebMacroDispatcher()
          Construct a new instance of the WebMacro dispatcher
 
Method Summary
 void dispatch(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse, Blog blog, java.util.Map context, java.lang.String flavorTemplate, java.lang.String flavorContentType)
          Dispatch a request and response.
protected  java.lang.String getWebMacroGlobalTemplatePath()
          Return a path appropriate for the WebMacro file resource loader
protected  java.lang.String getWebMacroTemplatePathForBlog(java.lang.String blogID)
          Return a path appropriate for the WebMacro file resource loader for a given blog
 void init()
          Initialization method for blojsom dispatchers
protected  void populateWebMacroContext(javax.servlet.http.HttpServletRequest httpServletRequest, java.util.Map context)
          Populate the WebMacro context with the request and session attributes
 void setBlojsomProperties(java.util.Properties blojsomProperties)
          Set the properties in use by blojsom
 void setServletConfig(javax.servlet.ServletConfig servletConfig)
          Set the ServletConfig
 void setWebMacroProperties(java.util.Properties webMacroProperties)
          Set the WebMacro properties for use by the dispatcher
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebMacroDispatcher

public WebMacroDispatcher()
Construct a new instance of the WebMacro dispatcher

Method Detail

setWebMacroProperties

public void setWebMacroProperties(java.util.Properties webMacroProperties)
Set the WebMacro properties for use by the dispatcher

Parameters:
webMacroProperties - Properties for WebMacro configuration

setBlojsomProperties

public void setBlojsomProperties(java.util.Properties blojsomProperties)
Set the properties in use by blojsom

Parameters:
blojsomProperties - Properties in use by blojsom

setServletConfig

public void setServletConfig(javax.servlet.ServletConfig servletConfig)
Set the ServletConfig

Parameters:
servletConfig - ServletConfig

init

public void init()
          throws BlojsomException
Initialization method for blojsom dispatchers

Specified by:
init in interface Dispatcher
Throws:
BlojsomException - If there is an error initializing the dispatcher

getWebMacroTemplatePathForBlog

protected java.lang.String getWebMacroTemplatePathForBlog(java.lang.String blogID)
Return a path appropriate for the WebMacro file resource loader for a given blog

Parameters:
blogID - Blog ID
Returns:
blojsom installation directory + base configuration directory + Blog ID + templates directory

getWebMacroGlobalTemplatePath

protected java.lang.String getWebMacroGlobalTemplatePath()
Return a path appropriate for the WebMacro file resource loader

Returns:
blojsom installation directory + base configuration directory + templates directory

populateWebMacroContext

protected void populateWebMacroContext(javax.servlet.http.HttpServletRequest httpServletRequest,
                                       java.util.Map context)
Populate the WebMacro context with the request and session attributes

Parameters:
httpServletRequest - Request
context - Context

dispatch

public void dispatch(javax.servlet.http.HttpServletRequest httpServletRequest,
                     javax.servlet.http.HttpServletResponse httpServletResponse,
                     Blog blog,
                     java.util.Map context,
                     java.lang.String flavorTemplate,
                     java.lang.String flavorContentType)
              throws java.io.IOException,
                     javax.servlet.ServletException
Dispatch a request and response. A context map is provided for the BlojsomServlet to pass any required information for use by the dispatcher. The dispatcher is also provided with the template for the requested flavor along with the content type for the specific flavor.

Specified by:
dispatch in interface Dispatcher
Parameters:
httpServletRequest - Request
httpServletResponse - Response
blog - Blog
context - Context map
flavorTemplate - Template to dispatch to for the requested flavor
flavorContentType - Content type for the requested flavor
Throws:
java.io.IOException - If there is an exception during IO
javax.servlet.ServletException - If there is an exception in dispatching the request