com.caucho.jsp
Class QServlet

java.lang.Object
  |
  +--javax.servlet.GenericServlet
        |
        +--com.caucho.jsp.QServlet
All Implemented Interfaces:
java.io.Serializable, Servlet, ServletConfig
Direct Known Subclasses:
JspServlet, XtpServlet

public abstract class QServlet
extends GenericServlet

Base servlet for both JSP and XTP. It's primarily responsible for returning the proper error messages when things go wrong.

The manager create the compiled JSP and XTP pages. The manager returns a Page object which is actually executed.

See Also:
JspManager, XtpManager, Page, Serialized Form

Field Summary
protected  CauchoApplication application
           
 
Constructor Summary
QServlet()
           
 
Method Summary
 void destroy()
          Called by the servlet container to indicate to a servlet that the servlet is being taken out of service.
protected  PageManager getManager()
           
 Page getPage(CauchoRequest request, CauchoResponse response)
          Creates and returns a new page.
 ServletContext getServletContext()
          Override the Servlet method to return the generated application.
 void init(ServletConfig config)
          Initialize the servlet.
 void killPage(CauchoRequest request, CauchoResponse response, Page page)
          Remove the page from any cache.
 void service(ServletRequest req, ServletResponse res)
          The service method gets the JSP/XTP page and executes it.
protected  void setManager(PageManager manager)
          JspServlet and XtpServlet will set the PageManager with this method.
 
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

application

protected CauchoApplication application
Constructor Detail

QServlet

public QServlet()
Method Detail

init

public void init(ServletConfig config)
          throws ServletException
Initialize the servlet. If necessary, convert the ServletContext to a CauchoApplication. Also, read the configuration Registry it it hasn't been read yet.
Overrides:
init in class GenericServlet
Following copied from class: javax.servlet.GenericServlet
Parameters:
config - the ServletConfig object that contains configutation information for this servlet
Throws:
ServletException - if an exception occurs that interrupts the servlet's normal operation
See Also:
UnavailableException

setManager

protected void setManager(PageManager manager)
JspServlet and XtpServlet will set the PageManager with this method.

getManager

protected PageManager getManager()

getServletContext

public ServletContext getServletContext()
Override the Servlet method to return the generated application.
Overrides:
getServletContext in class GenericServlet
Following copied from class: javax.servlet.GenericServlet
Returns:
ServletContext the ServletContext object passed to this servlet by the init method

service

public void service(ServletRequest req,
                    ServletResponse res)
             throws ServletException,
                    java.io.IOException
The service method gets the JSP/XTP page and executes it. The request and response objects are converted to Caucho objects so other servlet runners will produce the same results as the Caucho servlet runner.
Overrides:
service in class GenericServlet
Following copied from class: javax.servlet.GenericServlet
Parameters:
req - the ServletRequest object that contains the client's request
res - the ServletResponse object that will contain the servlet's response
Throws:
ServletException - if an exception occurs that interferes with the servlet's normal operation occurred
java.io.IOException - if an input or output exception occurs

getPage

public Page getPage(CauchoRequest request,
                    CauchoResponse response)
             throws java.lang.Exception
Creates and returns a new page.
Parameters:
request - the servlet request
response - the servlet response
Returns:
the compiled page

killPage

public void killPage(CauchoRequest request,
                     CauchoResponse response,
                     Page page)
Remove the page from any cache.

destroy

public void destroy()
Description copied from class: GenericServlet
Called by the servlet container to indicate to a servlet that the servlet is being taken out of service. See Servlet.destroy().
Overrides:
destroy in class GenericServlet