org.apache.turbine.services.jsp
Class TurbineJspService

java.lang.Object
  |
  +--org.apache.turbine.services.BaseInitable
        |
        +--org.apache.turbine.services.BaseService
              |
              +--org.apache.turbine.services.TurbineBaseService
                    |
                    +--org.apache.turbine.services.template.BaseTemplateEngineService
                          |
                          +--org.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.

Author:
John D. McNally, Jason van Zyl, Daniel Rall

Fields inherited from class org.apache.turbine.services.BaseService
configuration, name, properties, serviceBroker
 
Fields inherited from class org.apache.turbine.services.BaseInitable
initableBroker, isInitialized
 
Fields inherited from interface org.apache.turbine.services.jsp.JspService
LINK, RUNDATA, SERVICE_NAME
 
Fields inherited from interface org.apache.turbine.services.template.TemplateEngineService
DEFAULT_ERROR_SCREEN, DEFAULT_LAYOUT, DEFAULT_LAYOUT_TEMPLATE, DEFAULT_NAVIGATION, DEFAULT_PAGE, DEFAULT_SCREEN, DEFAULT_TEMPLATE_EXTENSION, TEMPLATE_EXTENSIONS
 
Constructor Summary
TurbineJspService()
           
 
Method Summary
 void addDefaultObjects(RunData data)
          Adds some convenience objects to the request.
 int getDefaultBufferSize()
          The buffer size
 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 filename)
          Process the request
 void handleRequest(RunData data, java.lang.String filename, boolean isForward)
          Process the request
 void init()
          Load all configured components and initialize them.
 void init(javax.servlet.ServletConfig config)
          Performs early initialization of this Turbine service.
 boolean templateExists(java.lang.String template)
          Determine whether a given template exists.
 
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
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 JspLink which can be used to generate links to other templates.
Specified by:
addDefaultObjects in interface JspService
Parameters:
RunData - the turbine rundata object

getDefaultBufferSize

public int getDefaultBufferSize()
The buffer size
Specified by:
getDefaultBufferSize in interface JspService

handleRequest

public void handleRequest(RunData data,
                          java.lang.String filename)
                   throws TurbineException
Process the request
Specified by:
handleRequest in interface JspService
Parameters:
RunData -  
String - the filename of the template.
Throws:
TurbineException - Any exception trown while processing will be wrapped into a TurbineException and rethrown.

handleRequest

public void handleRequest(RunData data,
                          java.lang.String filename,
                          boolean isForward)
                   throws TurbineException
Process the request
Specified by:
handleRequest in interface JspService
Parameters:
RunData -  
String - the filename of the template.
boolean - 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 exists. This service currently only supports file base template hierarchies so we will use the utility methods provided by the template service to do the searching.
Overrides:
templateExists in class BaseTemplateEngineService
Parameters:
String - template
Returns:
boolean

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:
String - template
Returns:
String


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