2004.04.29


com.jdc.http.mvc
Class HttpController

java.lang.Object
  |
  +--jdc.javax.servlet.http.HttpServlet
        |
        +--com.jdc.http.HttpServlet
              |
              +--com.jdc.http.mvc.HttpController

public abstract class HttpController
extends HttpServlet

HttpController implements servlet methods common to all web application servlets. All web application servlets should extend this servlet class.

Version:
1.0
Author:
Jay Damon
See Also:
Serialized Form

Field Summary
static String ERROR_PAGE
          The default error page.
protected  Logger log
          A logging object.
protected  StringHelper string
          A string helper object.
 
Constructor Summary
HttpController()
           
 
Method Summary
 void doGet(HttpServletRequest request, HttpServletResponse response)
          Handles HTTP GET requests.
 void doPost(HttpServletRequest request, HttpServletResponse response)
          Handles HTTP POST requests.
protected abstract  void doRequest(HttpServletRequest request, HttpServletResponse response)
          Processes web application servlet requests.
 String getFullHostName(HttpServletRequest request)
          Returns the full (complete) host name.
 String getRequestURI(HttpServletRequest request)
          Gets current request Uniform Resource Identifier (URI).
 HttpSession getSession(HttpServletRequest request)
          Returns the HTTP user session object.
 HttpUserProfile getUser(HttpServletRequest request)
          Returns the HTTP user profile object.
 void init(ServletConfig config)
          Initializes the web application servlet.
 
Methods inherited from class com.jdc.http.HttpServlet
getRequestDispatcher, getServletConfig, getServletContext, getServletName, getWebAppPathName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERROR_PAGE

public static final String ERROR_PAGE
The default error page.

See Also:
Constant Field Values

string

protected StringHelper string
A string helper object. The string helper object is used to simplify the manipulation of String objects in subclasses that extend this class.


log

protected Logger log
A logging object. The logging object is used to simplify the logging of output in servlet subclasses.

Constructor Detail

HttpController

public HttpController()
Method Detail

doGet

public void doGet(HttpServletRequest request,
                  HttpServletResponse response)
           throws ServletException,
                  IOException
Handles HTTP GET requests. By default, all HTTP GET requests are routed to the processRequest servlet method.

ServletException
IOException
See Also:
(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)

doPost

public void doPost(HttpServletRequest request,
                   HttpServletResponse response)
            throws ServletException,
                   IOException
Handles HTTP POST requests. By default, all HTTP POST requests are routed to the processRequest servlet method.

ServletException
IOException
See Also:
(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)

doRequest

protected abstract void doRequest(HttpServletRequest request,
                                  HttpServletResponse response)
                           throws ServletException,
                                  IOException
Processes web application servlet requests. This method must be implemented in all web application servlets that extend this servlet class.

ServletException
IOException

getFullHostName

public String getFullHostName(HttpServletRequest request)
Returns the full (complete) host name.

Returns:
String

getRequestURI

public String getRequestURI(HttpServletRequest request)
Gets current request Uniform Resource Identifier (URI). An example of a URL returned: /webappname/servlet/servletname?parameter=value

Returns:
String

getSession

public HttpSession getSession(HttpServletRequest request)
Returns the HTTP user session object. A new HTTP user session object is created if one does not exist.

Returns:
HttpSession The HTTP user session object.

getUser

public HttpUserProfile getUser(HttpServletRequest request)
Returns the HTTP user profile object. A new HTTP user profile object is created if one does not exist.

Returns:
HttpUserProfile The HTTP user profile object.

init

public void init(ServletConfig config)
          throws ServletException
Initializes the web application servlet.

Overrides:
init in class HttpServlet
ServletException

2004.04.29



Copyright © 2004 J. Damon & Co.; All Rights Reserved WorldWide.