|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.apache.turbine.Turbine
public class Turbine
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.
properties the path to TurbineResources.properties file
used by the default implementation of ResourceService, relative
to the application root.basedir this parameter is used only if your
application server does not support web applications, or the or does not
support ServletContext.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.
| Field Summary | |
|---|---|
static String |
BASEDIR_KEY
The base directory key |
static String |
REDIRECTED_PATHINFO_NAME
Name of path info parameter used to indicate the redirected stage of a given user's initial Turbine request |
| Constructor Summary | |
|---|---|
Turbine()
|
|
| Method Summary | |
|---|---|
protected void |
configure(ServletConfig config,
ServletContext context)
Read the master configuration file in, configure logging and start up any early services. |
protected void |
configureLogging()
Configure the logging facilities of Turbine |
protected void |
createRuntimeDirectories(ServletContext context,
ServletConfig config)
Create any directories that might be needed during runtime. |
void |
destroy()
The Servlet destroy method. |
void |
doGet(HttpServletRequest req,
HttpServletResponse res)
The primary method invoked when the Turbine servlet is executed. |
void |
doPost(HttpServletRequest req,
HttpServletResponse res)
In this application doGet and doPost are the same thing. |
protected String |
findInitParameter(ServletContext context,
ServletConfig config,
String name,
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 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 String |
getContextPath()
Return the context path. |
String |
getDefaultInputEncoding()
Returns the default input encoding for the servlet. |
static ServerData |
getDefaultServerData()
Return all the Turbine Servlet information (Server Name, Port, Scheme in a ServerData structure. |
static String |
getRealPath(String path)
Used to get the real path of configuration and resource information. |
static String |
getScriptName()
Get the script name. |
static String |
getServerName()
Return the server name. |
static String |
getServerPort()
Return the server port. |
static String |
getServerScheme()
Return the server scheme. |
String |
getServletInfo()
Return the servlet info. |
static ServletConfig |
getTurbineServletConfig()
Get the servlet config for this turbine webapp. |
static ServletContext |
getTurbineServletContext()
Get the servlet context for this turbine webapp. |
protected void |
handleException(PipelineData pipelineData,
HttpServletResponse res,
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(PipelineData data)
Initializes the services which need PipelineData to
initialize themselves (post startup). |
static void |
saveServletInfo(PipelineData 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(String val)
Set the application root for the webapp. |
static void |
setTurbineServletConfig(ServletConfig config)
Set the servlet config for this turbine webapp. |
static void |
setTurbineServletContext(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 |
|---|
public static final String REDIRECTED_PATHINFO_NAME
public static final String BASEDIR_KEY
| Constructor Detail |
|---|
public Turbine()
| Method Detail |
|---|
public void init()
throws ServletException
init in class GenericServletServletException - a servlet exception.
protected void configure(ServletConfig config,
ServletContext context)
throws Exception
config - The Servlet Configuration supplied by the containercontext - The Servlet Context supplied by the container
Exception - A problem occurred while reading the configuration or performing early startup
protected void configureLogging()
throws IOException
IOException - if the configuration file handling fails.
protected void createRuntimeDirectories(ServletContext context,
ServletConfig config)
null for the default of
/logs. The directory is specified via the TurbineConstants#LOGGING_ROOT parameter.
context - Global initialization parameters.config - Initialization parameters specific to the Turbine
servlet.
protected String findInitParameter(ServletContext context,
ServletConfig config,
String name,
String defaultValue)
public void init(PipelineData data)
PipelineData to
initialize themselves (post startup).
data - The first GET request.public static org.apache.commons.configuration.Configuration getConfiguration()
public static String getServerName()
public static String getServerScheme()
public static String getServerPort()
public static String getScriptName()
public static String getContextPath()
public static ServerData getDefaultServerData()
public static void setTurbineServletConfig(ServletConfig config)
config - New servlet configpublic static ServletConfig getTurbineServletConfig()
public static void setTurbineServletContext(ServletContext context)
context - New servlet context.public static ServletContext getTurbineServletContext()
public void destroy()
Servlet destroy method. Invokes
ServiceBroker tear down method.
destroy in interface Servletdestroy in class GenericServlet
public void doGet(HttpServletRequest req,
HttpServletResponse res)
throws IOException,
ServletException
doGet in class HttpServletreq - Servlet request.res - Servlet response.
IOException - a servlet exception.
ServletException - a servlet exception.
public void doPost(HttpServletRequest req,
HttpServletResponse res)
throws IOException,
ServletException
doPost in class HttpServletreq - Servlet request.res - Servlet response.
IOException - a servlet exception.
ServletException - a servlet exception.public String getServletInfo()
getServletInfo in interface ServletgetServletInfo in class GenericServlet
protected void handleException(PipelineData pipelineData,
HttpServletResponse res,
Throwable t)
data - A Turbine PipelineData object.res - Servlet response.t - The exception to report.public static void saveServletInfo(PipelineData data)
data - Turbine request datapublic static void setApplicationRoot(String val)
val - New app root.public static String getApplicationRoot()
public static String getRealPath(String path)
path - path translated to the application root
public String getDefaultInputEncoding()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||