com.caucho.jsp
Class QServlet

java.lang.Object
  extended by com.caucho.jsp.QServlet
All Implemented Interfaces:
Servlet
Direct Known Subclasses:
JspServlet, XtpServlet

public abstract class QServlet
extends java.lang.Object
implements Servlet

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

Field Summary
protected  WebApp _webApp
           
 
Constructor Summary
QServlet()
           
 
Method Summary
 void destroy()
          Called when the servlet shuts down.
 java.lang.String getInitParameter(java.lang.String name)
          Returns the init parameter
protected  PageManager getManager()
           
 Page getPage(HttpServletRequest request, HttpServletResponse response)
          Creates and returns a new page.
 Page getPage(java.lang.String uri, java.lang.String pageURI, ServletConfig config)
           
 ServletConfig getServletConfig()
          Returns the config.
 ServletContext getServletContext()
          Override the Servlet method to return the generated application.
 void init(ServletConfig config)
          Initialize the servlet.
 void killPage(HttpServletRequest request, HttpServletResponse 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.Servlet
getServletInfo
 

Field Detail

_webApp

protected WebApp _webApp
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 CauchoWebApp. Also, read the configuration Registry it it hasn't been read yet.

Specified by:
init in interface Servlet
Parameters:
config - information from the configuration file.
Throws:
ServletException

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.


getServletConfig

public ServletConfig getServletConfig()
Returns the config.

Specified by:
getServletConfig in interface Servlet

getInitParameter

public java.lang.String getInitParameter(java.lang.String name)
Returns the init parameter


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.

Specified by:
service in interface Servlet
Parameters:
req - request information. Normally servlets will cast this to HttpServletRequest
res - response information. Normally servlets will cast this to HttpServletRequest
Throws:
ServletException
java.io.IOException

getPage

public Page getPage(HttpServletRequest request,
                    HttpServletResponse response)
             throws java.lang.Exception
Creates and returns a new page.

Parameters:
request - the servlet request
response - the servlet response
Returns:
the compiled page
Throws:
java.lang.Exception

getPage

public Page getPage(java.lang.String uri,
                    java.lang.String pageURI,
                    ServletConfig config)
             throws java.lang.Exception
Throws:
java.lang.Exception

killPage

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


destroy

public void destroy()
Description copied from interface: Servlet
Called when the servlet shuts down. Servlets can use this to close database connections, etc. Servlets generally only shutdown when the application closes.

Specified by:
destroy in interface Servlet