|
|||||||||
| Home >> All >> org >> apache >> [ turbine overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.turbine
Class Turbine

java.lang.Objectjavax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.apache.turbine.Turbine
- All Implemented Interfaces:
- java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig, TurbineConstants
- public class Turbine
- extends javax.servlet.http.HttpServlet
- implements TurbineConstants
- extends javax.servlet.http.HttpServlet
Turbine is the main servlet for the entire system. It is final
because you should not ever need to subclass this servlet. If you
need to perform initialization of a service, then you should implement the
Services API and let your code be initialized by it.
If you need to override something in the doGet() or
doPost() methods, edit the TurbineResources.properties file and
specify your own classes there.
Turbine servlet recognizes the following initialization parameters.
propertiesthe path to TurbineResources.properties file used by the default implementation ofResourceService, relative to the application root.basedirthis parameter is used only if your application server does not support web applications, or the or does not supportServletContext.getRealPath(String)method correctly. You can use this parameter to specify the directory within the server's filesystem, that is the base of your web application.
- Version:
- $Id: Turbine.java 264152 2005-08-29 14:50:22Z henning $
| Field Summary | |
private static java.lang.String |
applicationRoot
The base from which the Turbine application will operate. |
static java.lang.String |
BASEDIR_KEY
The base directory key |
private static org.apache.commons.configuration.Configuration |
configuration
Our internal configuration object |
private static boolean |
firstDoGet
Should initialization activities be performed during doGet() execution? |
private static boolean |
firstInit
In certain situations the init() method is called more than once, somtimes even concurrently. |
private static java.lang.Throwable |
initFailure
Whether init succeeded or not. |
private java.lang.String |
inputEncoding
Default Input encoding if the servlet container does not report an encoding |
private static org.apache.commons.logging.Log |
log
Logging class from commons.logging |
static java.lang.String |
REDIRECTED_PATHINFO_NAME
Name of path info parameter used to indicate the redirected stage of a given user's initial Turbine request |
private org.apache.turbine.services.rundata.RunDataService |
rundataService
A reference to the RunData Service |
private static long |
serialVersionUID
SerialVersionUID for serialization |
private static org.apache.turbine.util.ServerData |
serverData
Keep all the properties of the web server in a convenient data structure |
private static javax.servlet.ServletConfig |
servletConfig
Servlet config for this Turbine webapp. |
private static javax.servlet.ServletContext |
servletContext
Servlet context for this Turbine webapp. |
private org.apache.turbine.services.template.TemplateService |
templateService
A reference to the Template Service |
private static java.lang.String |
webappRoot
The webapp root where the Turbine application is running in the servlet container. |
| Fields inherited from class javax.servlet.http.HttpServlet |
|
| Fields inherited from class javax.servlet.GenericServlet |
|
| Constructor Summary | |
Turbine()
|
|
| Method Summary | |
private void |
cleanupTemplateContext(org.apache.turbine.util.RunData data)
cleans the Velocity Context if available. |
private void |
configure(javax.servlet.ServletConfig config,
javax.servlet.ServletContext context)
Read the master configuration file in, configure logging and start up any early services. |
private static void |
createRuntimeDirectories(javax.servlet.ServletContext context,
javax.servlet.ServletConfig config)
Create any directories that might be needed during runtime. |
void |
destroy()
The Servlet destroy method. |
void |
doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
The primary method invoked when the Turbine servlet is executed. |
void |
doPost(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
In this application doGet and doPost are the same thing. |
protected static java.lang.String |
findInitParameter(javax.servlet.ServletContext context,
javax.servlet.ServletConfig config,
java.lang.String name,
java.lang.String defaultValue)
Finds the specified servlet configuration/initialization parameter, looking first for a servlet-specific parameter, then for a global parameter, and using the provided default if not found. |
static java.lang.String |
getApplicationRoot()
Get the application root for this Turbine webapp. |
static org.apache.commons.configuration.Configuration |
getConfiguration()
Return the current configuration with all keys included |
static java.lang.String |
getContextPath()
Return the context path. |
static org.apache.turbine.util.ServerData |
getDefaultServerData()
Return all the Turbine Servlet information (Server Name, Port, Scheme in a ServerData structure. |
static java.lang.String |
getRealPath(java.lang.String path)
Used to get the real path of configuration and resource information. |
static java.lang.String |
getScriptName()
Get the script name. |
static java.lang.String |
getServerName()
Return the server name. |
static java.lang.String |
getServerPort()
Return the server port. |
static java.lang.String |
getServerScheme()
Return the server scheme. |
private org.apache.turbine.services.ServiceManager |
getServiceManager()
Return an instance of the currently configured Service Manager |
java.lang.String |
getServletInfo()
Return the servlet info. |
static javax.servlet.ServletConfig |
getTurbineServletConfig()
Get the servlet config for this turbine webapp. |
static javax.servlet.ServletContext |
getTurbineServletContext()
Get the servlet context for this turbine webapp. |
private void |
handleException(org.apache.turbine.util.RunData data,
javax.servlet.http.HttpServletResponse res,
java.lang.Throwable t)
This method is about making sure that we catch and display errors to the screen in one fashion or another. |
void |
init()
This init method will load the default resources from a properties file. |
void |
init(org.apache.turbine.util.RunData data)
Initializes the services which need RunData to
initialize themselves (post startup). |
private void |
loginAction(org.apache.turbine.util.RunData data)
This method is executed if the configured Login action should be executed by Turbine. |
private void |
logoutAction(org.apache.turbine.util.RunData data)
This method is executed if the configured Logout action should be executed by Turbine. |
static void |
saveServletInfo(org.apache.turbine.util.RunData data)
Save some information about this servlet so that it can be utilized by object instances that do not have direct access to RunData. |
static void |
setApplicationRoot(java.lang.String val)
Set the application root for the webapp. |
static void |
setTurbineServletConfig(javax.servlet.ServletConfig config)
Set the servlet config for this turbine webapp. |
static void |
setTurbineServletContext(javax.servlet.ServletContext context)
Set the servlet context for this turbine webapp. |
| Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service |
| Methods inherited from class javax.servlet.GenericServlet |
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, init, log, log |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
serialVersionUID
private static final long serialVersionUID
- SerialVersionUID for serialization
- See Also:
- Constant Field Values
REDIRECTED_PATHINFO_NAME
public static final java.lang.String REDIRECTED_PATHINFO_NAME
- Name of path info parameter used to indicate the redirected stage of
a given user's initial Turbine request
- See Also:
- Constant Field Values
BASEDIR_KEY
public static final java.lang.String BASEDIR_KEY
- The base directory key
- See Also:
- Constant Field Values
firstInit
private static boolean firstInit
- In certain situations the init() method is called more than once,
somtimes even concurrently. This causes bad things to happen,
so we use this flag to prevent it.
initFailure
private static java.lang.Throwable initFailure
- Whether init succeeded or not.
firstDoGet
private static boolean firstDoGet
- Should initialization activities be performed during doGet() execution?
serverData
private static org.apache.turbine.util.ServerData serverData
- Keep all the properties of the web server in a convenient data
structure
applicationRoot
private static java.lang.String applicationRoot
- The base from which the Turbine application will operate.
servletConfig
private static javax.servlet.ServletConfig servletConfig
- Servlet config for this Turbine webapp.
servletContext
private static javax.servlet.ServletContext servletContext
- Servlet context for this Turbine webapp.
webappRoot
private static java.lang.String webappRoot
- The webapp root where the Turbine application
is running in the servlet container.
This might differ from the application root.
configuration
private static org.apache.commons.configuration.Configuration configuration
- Our internal configuration object
templateService
private org.apache.turbine.services.template.TemplateService templateService
- A reference to the Template Service
rundataService
private org.apache.turbine.services.rundata.RunDataService rundataService
- A reference to the RunData Service
inputEncoding
private java.lang.String inputEncoding
- Default Input encoding if the servlet container does not report an encoding
log
private static org.apache.commons.logging.Log log
- Logging class from commons.logging
| Constructor Detail |
Turbine
public Turbine()
| Method Detail |
init
public final void init()
throws javax.servlet.ServletException
- This init method will load the default resources from a
properties file.
This method is called by init(ServletConfig config)
configure
private void configure(javax.servlet.ServletConfig config, javax.servlet.ServletContext context) throws java.lang.Exception
- Read the master configuration file in, configure logging
and start up any early services.
createRuntimeDirectories
private static void createRuntimeDirectories(javax.servlet.ServletContext context, javax.servlet.ServletConfig config)
- Create any directories that might be needed during
runtime. Right now this includes:
- The directory to write the log files to (relative to the
web application root), or
nullfor the default of/logs. The directory is specified via theTurbineConstants#LOGGING_ROOTparameter.
- The directory to write the log files to (relative to the
web application root), or
findInitParameter
protected static final java.lang.String findInitParameter(javax.servlet.ServletContext context, javax.servlet.ServletConfig config, java.lang.String name, java.lang.String defaultValue)
- Finds the specified servlet configuration/initialization
parameter, looking first for a servlet-specific parameter, then
for a global parameter, and using the provided default if not
found.
init
public final void init(org.apache.turbine.util.RunData data)
- Initializes the services which need
RunDatato initialize themselves (post startup).
getConfiguration
public static org.apache.commons.configuration.Configuration getConfiguration()
- Return the current configuration with all keys included
getServerName
public static java.lang.String getServerName()
- Return the server name.
getServerScheme
public static java.lang.String getServerScheme()
- Return the server scheme.
getServerPort
public static java.lang.String getServerPort()
- Return the server port.
getScriptName
public static java.lang.String getScriptName()
- Get the script name. This is the initial script name.
Actually this is probably not needed any more. I'll
check. jvz.
getContextPath
public static java.lang.String getContextPath()
- Return the context path.
getDefaultServerData
public static org.apache.turbine.util.ServerData getDefaultServerData()
- Return all the Turbine Servlet information (Server Name, Port,
Scheme in a ServerData structure. This is generated from the
values set when initializing the Turbine and may not be correct
if you're running in a clustered structure. This might be used
if you need a DataURI and have no RunData object handy-
setTurbineServletConfig
public static void setTurbineServletConfig(javax.servlet.ServletConfig config)
- Set the servlet config for this turbine webapp.
getTurbineServletConfig
public static javax.servlet.ServletConfig getTurbineServletConfig()
- Get the servlet config for this turbine webapp.
setTurbineServletContext
public static void setTurbineServletContext(javax.servlet.ServletContext context)
- Set the servlet context for this turbine webapp.
getTurbineServletContext
public static javax.servlet.ServletContext getTurbineServletContext()
- Get the servlet context for this turbine webapp.
destroy
public final void destroy()
- The
Servletdestroy method. InvokesServiceBrokertear down method.- Specified by:
destroyin interfacejavax.servlet.Servlet
doGet
public final void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws java.io.IOException, javax.servlet.ServletException
- The primary method invoked when the Turbine servlet is executed.
doPost
public final void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws java.io.IOException, javax.servlet.ServletException
- In this application doGet and doPost are the same thing.
loginAction
private void loginAction(org.apache.turbine.util.RunData data) throws java.lang.Exception
- This method is executed if the configured Login action should be
executed by Turbine.
This Action must be performed before the Session validation or we get sent in an endless loop back to the Login screen before the action can be performed
logoutAction
private void logoutAction(org.apache.turbine.util.RunData data) throws java.lang.Exception
- This method is executed if the configured Logout action should be
executed by Turbine.
This Action must be performed before the Session validation for the session validator to send us back to the Login screen.
The existing session is invalidated before the logout action is executed.
cleanupTemplateContext
private void cleanupTemplateContext(org.apache.turbine.util.RunData data) throws java.lang.Exception
- cleans the Velocity Context if available.
getServletInfo
public final java.lang.String getServletInfo()
- Return the servlet info.
- Specified by:
getServletInfoin interfacejavax.servlet.Servlet
handleException
private void handleException(org.apache.turbine.util.RunData data, javax.servlet.http.HttpServletResponse res, java.lang.Throwable t)
- This method is about making sure that we catch and display
errors to the screen in one fashion or another. What happens is
that it will attempt to show the error using your user defined
Error Screen. If that fails, then it will resort to just
displaying the error and logging it all over the place
including the servlet engine log file, the Turbine log file and
on the screen.
saveServletInfo
public static void saveServletInfo(org.apache.turbine.util.RunData data)
- Save some information about this servlet so that
it can be utilized by object instances that do not
have direct access to RunData.
setApplicationRoot
public static void setApplicationRoot(java.lang.String val)
- Set the application root for the webapp.
getApplicationRoot
public static java.lang.String getApplicationRoot()
- Get the application root for this Turbine webapp. This
concept was started in 3.0 and will allow an app to be
developed from a standard CVS layout. With a simple
switch the app will work fully within the servlet
container for deployment.
getRealPath
public static java.lang.String getRealPath(java.lang.String path)
- Used to get the real path of configuration and resource
information. This can be used by an app being
developed in a standard CVS layout.
getServiceManager
private org.apache.turbine.services.ServiceManager getServiceManager()
- Return an instance of the currently configured Service Manager
|
|||||||||
| Home >> All >> org >> apache >> [ turbine overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC