EAF 7.4 Implementation

com.lutris.appserver.server.httpPresentation.servlet
Class HttpPresentationServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.lutris.appserver.server.httpPresentation.servlet.HttpPresentationServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
Direct Known Subclasses:
Servlet

public class HttpPresentationServlet
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:

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.25 $
Author:
Mark Diekhans, Damir Milovic, Strahinja Videnovic, Slobodan Vujasinovic
See Also:
Serialized Form

Field Summary
protected  javax.servlet.ServletContext context
          Servlet is started under this context
static java.lang.String XMLC_DOM_STATS_LOG_LEVEL
          Log level for DOM statistics.
 
Constructor Summary
HttpPresentationServlet()
          Create a new HttpPresentationServlet.
 
Method Summary
 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)
           
 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.
 
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
Servlet is started under this context

Constructor Detail

HttpPresentationServlet

public HttpPresentationServlet()
Create a new HttpPresentationServlet.

Method Detail

init

public void init(javax.servlet.ServletConfig config)
          throws javax.servlet.ServletException
Specified by:
init in interface javax.servlet.Servlet
Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException

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.

Parameters:
req - encapsulates the request to the servlet
resp - encapsulates the response from the servlet
Throws:
javax.servlet.ServletException - if the request could not be handled
java.io.IOException - if detected when handling the request

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().

Throws:
javax.servlet.ServletException - If any error occurs on startup.

getServletInfo

public java.lang.String getServletInfo()
Return information specific to this servlet.

Specified by:
getServletInfo in interface javax.servlet.Servlet
Overrides:
getServletInfo in class javax.servlet.GenericServlet

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.

Parameters:
req - The servlet request object.
resp - The servlet response object.
Returns:
The HttpPresentationRequest object used by the presentation manager.

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.

Parameters:
req - The servlet request object.
resp - The servlet response object.
Returns:
The HttpPresentationResponse object used by the presentation manager.

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.


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.

Overrides:
service in class javax.servlet.http.HttpServlet
Parameters:
request - The original servlet request object.
response - The original servlet response object.
Throws:
javax.servlet.ServletException
java.io.IOException

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.

Parameters:
request - The (raw) request that would be sent in to this application.
Returns:
The session object that would be associated with the request. Returns null if none is found; a new session is not created.

destroy

public void destroy()
Destroys the servlet. Called by the servlet manager when the servlet is shutdown.

Specified by:
destroy in interface javax.servlet.Servlet
Overrides:
destroy in class javax.servlet.GenericServlet

EAF 7.4 Implementation