org.apache.turbine.services.jsp
Class TurbineJspService

java.lang.Object
  extended byorg.apache.turbine.services.BaseInitable
      extended byorg.apache.turbine.services.BaseService
          extended byorg.apache.turbine.services.TurbineBaseService
              extended byorg.apache.turbine.services.template.BaseTemplateEngineService
                  extended byorg.apache.turbine.services.jsp.TurbineJspService
All Implemented Interfaces:
Initable, JspService, Service, TemplateEngineService

public class TurbineJspService
extends BaseTemplateEngineService
implements JspService

This is a Service that can process JSP templates from within a Turbine screen.

Version:
$Id: TurbineJspService.java 534527 2007-05-02 16:10:59Z tv $
Author:
John D. McNally, Jason van Zyl, Daniel Rall, Henning P. Schmiedehausen

Field Summary
 
Fields inherited from class org.apache.turbine.services.BaseService
name, serviceBroker
 
Fields inherited from class org.apache.turbine.services.BaseInitable
initableBroker, isInitialized
 
Fields inherited from interface org.apache.turbine.services.jsp.JspService
BUFFER_SIZE_DEFAULT, BUFFER_SIZE_KEY, JSP_EXTENSION, LINK, RUNDATA, SERVICE_NAME, TEMPLATE_PATH_KEY
 
Fields inherited from interface org.apache.turbine.services.template.TemplateEngineService
DEFAULT_ERROR_SCREEN, DEFAULT_LAYOUT, DEFAULT_LAYOUT_TEMPLATE, DEFAULT_NAVIGATION, DEFAULT_NAVIGATION_TEMPLATE, DEFAULT_PAGE, DEFAULT_SCREEN, DEFAULT_SCREEN_TEMPLATE, DEFAULT_TEMPLATE_EXTENSION, TEMPLATE_EXTENSIONS
 
Constructor Summary
TurbineJspService()
           
 
Method Summary
 void addDefaultObjects(RunData data)
          Adds some convenience objects to the request.
 int getDefaultBufferSize()
          Returns the default buffer size of the JspService
 java.lang.String getRelativeTemplateName(java.lang.String template)
          Searchs for a template in the default.template path[s] and returns the template name with a relative path which is required by javax.servlet.RequestDispatcher
 void handleRequest(RunData data, java.lang.String templateName)
          executes the JSP given by templateName.
 void handleRequest(RunData data, java.lang.String templateName, boolean isForward)
          executes the JSP given by templateName.
 void init()
          Load all configured components and initialize them.
 void init(javax.servlet.ServletConfig config)
          Deprecated. use init() instead.
 boolean templateExists(java.lang.String template)
          Determine whether a given template is available on the configured template pathes.
 
Methods inherited from class org.apache.turbine.services.template.BaseTemplateEngineService
getAssociatedFileExtensions, getTemplateEngineServiceConfiguration, initConfiguration, registerConfiguration
 
Methods inherited from class org.apache.turbine.services.TurbineBaseService
init, init, shutdown
 
Methods inherited from class org.apache.turbine.services.BaseService
getConfiguration, getName, getProperties, getServiceBroker, setName, setServiceBroker
 
Methods inherited from class org.apache.turbine.services.BaseInitable
getInit, getInitableBroker, setInit, setInitableBroker
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.turbine.services.Service
getConfiguration, getName, getProperties, setName, setServiceBroker
 
Methods inherited from interface org.apache.turbine.services.Initable
getInit, init, setInitableBroker, shutdown
 

Constructor Detail

TurbineJspService

public TurbineJspService()
Method Detail

init

public void init()
          throws InitializationException
Load all configured components and initialize them. This is a zero parameter variant which queries the Turbine Servlet for its config.

Specified by:
init in interface Initable
Overrides:
init in class TurbineBaseService
Throws:
InitializationException - Something went wrong in the init stage

init

public void init(javax.servlet.ServletConfig config)
          throws InitializationException
Deprecated. use init() instead.

Performs early initialization of this Turbine service.

Overrides:
init in class TurbineBaseService
Parameters:
config - The ServletConfiguration from Turbine
Throws:
InitializationException - Something went wrong when starting up.

addDefaultObjects

public void addDefaultObjects(RunData data)
Adds some convenience objects to the request. For example an instance of TemplateLink which can be used to generate links to other templates.

Specified by:
addDefaultObjects in interface JspService
Parameters:
data - the turbine rundata object

getDefaultBufferSize

public int getDefaultBufferSize()
Returns the default buffer size of the JspService

Specified by:
getDefaultBufferSize in interface JspService
Returns:
The default buffer size.

handleRequest

public void handleRequest(RunData data,
                          java.lang.String templateName)
                   throws TurbineException
executes the JSP given by templateName.

Specified by:
handleRequest in interface JspService
Parameters:
data - A RunData Object
templateName - the filename of the template.
Throws:
TurbineException - Any exception thrown while processing will be wrapped into a TurbineException and rethrown.

handleRequest

public void handleRequest(RunData data,
                          java.lang.String templateName,
                          boolean isForward)
                   throws TurbineException
executes the JSP given by templateName.

Specified by:
handleRequest in interface JspService
Parameters:
data - A RunData Object
templateName - the filename of the template.
isForward - whether to perform a forward or include.
Throws:
TurbineException - Any exception trown while processing will be wrapped into a TurbineException and rethrown.

templateExists

public boolean templateExists(java.lang.String template)
Determine whether a given template is available on the configured template pathes.

Specified by:
templateExists in interface TemplateEngineService
Specified by:
templateExists in class BaseTemplateEngineService
Parameters:
template - The name of the requested Template
Returns:
True if the template is available.
See Also:
TemplateEngineService.templateExists(java.lang.String)

getRelativeTemplateName

public java.lang.String getRelativeTemplateName(java.lang.String template)
Searchs for a template in the default.template path[s] and returns the template name with a relative path which is required by javax.servlet.RequestDispatcher

Specified by:
getRelativeTemplateName in interface JspService
Parameters:
template -
Returns:
String


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.