|
|||||||||
| Home >> All >> com >> lutris >> appserver >> server >> httpPresentation >> [ servlet overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.lutris.appserver.server.httpPresentation.servlet
Class HttpPresentationServlet

java.lang.Objectjavax.servlet.GenericServlet
javax.servlet.http.HttpServlet
com.lutris.appserver.server.httpPresentation.servlet.HttpPresentationServlet
- All Implemented Interfaces:
- FilterableServlet, java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
- public class HttpPresentationServlet
- extends javax.servlet.http.HttpServlet
- implements FilterableServlet
- extends javax.servlet.http.HttpServlet
Presentation server implemented as a servlet. Translates servlet requests into HttpPresentationManager requests. There is a one to one correspondence between an instance of this servlet and an Enhydra application. An instance of the application is created by the servlet. The servlet requires a single init parameter `configFile', that contains the path to the application's configuration file. This file must define the following fields:
-
server.classPath- The class path for the application, as a comma seperated list. This should not contain the class path for the Java runtime classes or the Lutris classes. -
server.appClass- The full class name of the application class. This must implementcom.lutris.appserver.server.Application. -
server.presentationPrefix- This is the path that is used as a prefixed for all URL references withing the application. It must use a `/' seperator (as with URLs). -
server.autoReload- A flag to indicate whether or not the application should be automatically reloaded when any class or jar file changes in the application's classpath. NOTE: THIS IS A DEBUGGING OPTION AND MAY SLOW DOWN THE APPLICATION!
This servlet also implements the ListenableServlet
interface. This allows other objects to register with this servlet and
be notified every time service is called. These remote
listeners may ignore the notification, examine the request, or even
replace the request and/or response with extended versions. This is
used by the debugging and monitoring servlets.
- Since:
- 1.3
- Version:
- $Revision: 1.63.2.3.4.3 $
| Fields inherited from class javax.servlet.http.HttpServlet |
|
| Fields inherited from class javax.servlet.GenericServlet |
|
| Constructor Summary | |
HttpPresentationServlet()
Create a new HttpPresentationServlet. |
|
| Method Summary | |
void |
addFilter(org.enhydra.servlet.filter.Filter filter)
Add a filter to the end of the list of filters. |
private void |
changeToRunningState()
Attempt to change the application to the running state. |
private void |
checkAutoReload()
Check if the application should be automatically reloaded and, if so, call initApplication with a new instance of the class
loader. |
private void |
configureLogChannel(java.lang.String configFile)
|
void |
destroy()
Destroys the servlet. |
void |
ensureAppIsRunning()
This method is public for use by the ServletManager to run the application startup() method after init(). |
protected com.lutris.util.Config |
getAppConfigInitParam()
Returns the application configuration init parameter. |
protected java.lang.String |
getAppConfigInitParamName()
Returns the application configuration init parameter name. |
com.lutris.appserver.server.Application |
getApplication()
Returns the application being run by this instance of the servlet. |
protected com.lutris.appserver.server.httpPresentation.HttpPresentationRequest |
getHttpPresentationRequest(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
This method instantiates the HttpPresentationRequest object that the presentation manager expects when servicing a request. |
protected com.lutris.appserver.server.httpPresentation.HttpPresentationResponse |
getHttpPresentationResponse(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
This method instantiates the HttpPresentationResponse object that the presentation manager expects when servicing a request. |
java.lang.String |
getServletInfo()
Return information specific to this servlet. |
com.lutris.appserver.server.session.Session |
getSession(javax.servlet.ServletRequest request)
Looks up the session object (if any) that would be used to process the request. |
void |
init(javax.servlet.ServletConfig config)
Called by the servlet container to indicate to a servlet that the servlet is being placed into service. |
private void |
initApplication(javax.servlet.ServletConfig servletConfig,
com.lutris.classloader.MultiClassLoader appClassLoader)
Open and read the application's configuration file and initialize the application, but don't start it yet. |
private void |
missingConfField(java.lang.String field,
java.lang.String file)
Generate an error for a field not being specified in a config file. |
void |
removeFilter(org.enhydra.servlet.filter.Filter filter)
Remove a filter from the list of current filters. |
void |
service(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Handle a service request. |
void |
serviceDirect(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
This is an HTTP-specific version of the Servlet.service method that translates that request into a request to a presentation manager. |
private void |
setPresentationManager(javax.servlet.ServletContext context,
java.lang.ClassLoader appClassLoader)
Sets the presentation manager for the application. |
private void |
throwServletException(java.lang.String msg,
java.lang.Throwable cause)
Throw a servlet exceptionm logging the message if possible. |
| Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, 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 |
XMLC_DOM_STATS_LOG_LEVEL
public static final java.lang.String XMLC_DOM_STATS_LOG_LEVEL
- Log level for DOM statistics.
- See Also:
- Constant Field Values
context
protected javax.servlet.ServletContext context
APP_CONFIG_INIT_PARAM_NAME
private static final java.lang.String APP_CONFIG_INIT_PARAM_NAME
- See Also:
- Constant Field Values
APP_CLASS_PATH_FIELD
private static final java.lang.String APP_CLASS_PATH_FIELD
- See Also:
- Constant Field Values
APP_APP_CLASS_FIELD
private static final java.lang.String APP_APP_CLASS_FIELD
- See Also:
- Constant Field Values
APP_PRESENTATION_PREFIX_FIELD
private static final java.lang.String APP_PRESENTATION_PREFIX_FIELD
- See Also:
- Constant Field Values
APP_AUTO_RELOAD_FIELD
private static final java.lang.String APP_AUTO_RELOAD_FIELD
- See Also:
- Constant Field Values
APP_LOGFILE
private static final java.lang.String APP_LOGFILE
- See Also:
- Constant Field Values
APP_LOG_TO_FILE
private static final java.lang.String APP_LOG_TO_FILE
- See Also:
- Constant Field Values
APP_LOG_TO_STDERR
private static final java.lang.String APP_LOG_TO_STDERR
- See Also:
- Constant Field Values
logChannel
private com.lutris.logging.LogChannel logChannel
standardLogger
private com.lutris.logging.StandardLogger standardLogger
needToConfigureLogChannel
private boolean needToConfigureLogChannel
application
com.lutris.appserver.server.Application application
appConfig
com.lutris.util.Config appConfig
presentationPrefix
java.lang.String presentationPrefix
cacheClasses
boolean cacheClasses
cacheFiles
boolean cacheFiles
autoReload
boolean autoReload
presentationManager
com.lutris.appserver.server.httpPresentation.HttpPresentationManager presentationManager
domStatsLogWriter
private java.io.PrintWriter domStatsLogWriter
- If not null, log DOM statistics here after each DOM write.
filters
private java.util.Vector filters
| Constructor Detail |
HttpPresentationServlet
public HttpPresentationServlet()
- Create a new HttpPresentationServlet.
| Method Detail |
throwServletException
private void throwServletException(java.lang.String msg, java.lang.Throwable cause) throws javax.servlet.ServletException
- Throw a servlet exceptionm logging the message if possible.
missingConfField
private void missingConfField(java.lang.String field, java.lang.String file) throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
- Generate an error for a field not being specified in a config file.
initApplication
private void initApplication(javax.servlet.ServletConfig servletConfig, com.lutris.classloader.MultiClassLoader appClassLoader) throws javax.servlet.ServletException
- Open and read the application's configuration file and initialize the
application, but don't start it yet. This is done on in service so it
part of the standard state-change mechanism.
init
public void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException
- Description copied from class:
javax.servlet.GenericServlet - Called by the servlet container to indicate to a servlet that the
servlet is being placed into service. See Servlet.init(javax.servlet.ServletConfig)>
Servlet.init(javax.servlet.ServletConfig)55 .This implementation stores the javax.servlet.ServletConfig object it receives from the servlet container for later use. When overriding this form of the method, call
super.init(config).- Specified by:
initin interfacejavax.servlet.Servlet
setPresentationManager
private void setPresentationManager(javax.servlet.ServletContext context, java.lang.ClassLoader appClassLoader) throws javax.servlet.ServletException
- Sets the presentation manager for the application. First creates a
new presentation manager with the presentationPrefix, application,
cacheClasses and cacheFiles fields (so these parameters must already
be initialized). Then, the presentation manager is set in the
application.
changeToRunningState
private void changeToRunningState()
throws com.lutris.appserver.server.ApplicationException
- Attempt to change the application to the running state.
configureLogChannel
private void configureLogChannel(java.lang.String configFile) throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
serviceDirect
public void serviceDirect(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, java.io.IOException
- This is an HTTP-specific version of the Servlet.service method
that translates that request into a request to a presentation
manager. This object is method is not synchronized, the thread
is used to handle to entire request.
As part of implementing the FiterableServlet interface, the real work is done here in serviceDirect(), while calls to service() result in filters being applied and called. The end of the filter chain is a glue servlet that directly calls this method.
- Specified by:
serviceDirectin interfaceFilterableServlet
ensureAppIsRunning
public void ensureAppIsRunning()
throws javax.servlet.ServletException
- This method is public for use by the ServletManager
to run the application startup() method after init().
getServletInfo
public java.lang.String getServletInfo()
- Return information specific to this servlet.
- Specified by:
getServletInfoin interfacejavax.servlet.Servlet
getHttpPresentationRequest
protected com.lutris.appserver.server.httpPresentation.HttpPresentationRequest getHttpPresentationRequest(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
- This method instantiates the HttpPresentationRequest
object that the presentation manager expects when
servicing a request.
getHttpPresentationResponse
protected com.lutris.appserver.server.httpPresentation.HttpPresentationResponse getHttpPresentationResponse(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
- This method instantiates the HttpPresentationResponse
object that the presentation manager expects when
servicing a request.
getApplication
public com.lutris.appserver.server.Application getApplication()
- Returns the application being run by this instance of
the servlet.
getAppConfigInitParam
protected com.lutris.util.Config getAppConfigInitParam()
- Returns the application configuration init parameter.
getAppConfigInitParamName
protected java.lang.String getAppConfigInitParamName()
- Returns the application configuration init parameter name.
addFilter
public void addFilter(org.enhydra.servlet.filter.Filter filter)
- Add a filter to the end of the list of filters.
- Specified by:
addFilterin interfaceFilterableServlet
removeFilter
public void removeFilter(org.enhydra.servlet.filter.Filter filter)
- Remove a filter from the list of current filters.
Silently fails if the filter is not in the list.
- Specified by:
removeFilterin interfaceFilterableServlet
service
public void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException
- Handle a service request. Use the first filter to wrap the request,
response, and servlet (this) objects. This will return new objects.
Then use the second filter to wrap those, again returning new
objects. Then use the fourth filter to wrap those etc....
Then finally call
service()on the outermost results.
getSession
public com.lutris.appserver.server.session.Session getSession(javax.servlet.ServletRequest request)
- Looks up the session object (if any) that would be used to
process the request. This is will not used normally, because the
session is give to the application's preprocessor method and the
presentation objects. Also, it is not normal to have a raw
ServletRequest. The debugger uses this to examine the session data
before and after each request. Consider this an internal use only
method.
checkAutoReload
private void checkAutoReload()
throws javax.servlet.ServletException
- Check if the application should be automatically reloaded and, if so,
call
initApplicationwith a new instance of the class loader. The application should be reloaded if theautoReloadflag istrueand any class has changed in the application's classpath.
destroy
public void destroy()
- Destroys the servlet. Called by the servlet manager when the servlet
is shutdown.
- Specified by:
destroyin interfacejavax.servlet.Servlet
|
|||||||||
| Home >> All >> com >> lutris >> appserver >> server >> httpPresentation >> [ servlet overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC