com.strangelight.servlet
Class UserServlet
java.lang.Object
|
+--javax.servlet.GenericServlet
|
+--javax.servlet.http.HttpServlet
|
+--com.strangelight.servlet.HtmlServlet
|
+--com.strangelight.servlet.UserServlet
- All Implemented Interfaces:
- java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
- public abstract class UserServlet
- extends HtmlServlet
An extension of HtmlServlet
for creating servlets which can
be run only by authenticated users. UserServlet
works
identically to HtmlServlet
, with the additional
guarantee that HtmlServlet.doGetOrPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, javax.servlet.http.HttpSession, java.util.Map, java.io.PrintWriter)
will be called
only if a session exists and is owned by an authenticated
user.
- See Also:
User
,
Serialized Form
Field Summary |
protected User |
user
The already-authenticated user who owns this http session. |
Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doOptions, doPut, doTrace, getLastModified, service, service |
Methods inherited from class javax.servlet.GenericServlet |
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, init, log |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
user
protected User user
- The already-authenticated user who owns this http session.
UserServlet
public UserServlet()
doGet
public void doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException,
java.io.IOException
- Description copied from class:
HtmlServlet
- Handles the HTTP GET request by calling
HtmlServlet.doGetOrPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, javax.servlet.http.HttpSession, java.util.Map, java.io.PrintWriter)
.
Also displays any exceptions that may be thrown by
doGetOrPost
.
(This method is called by the server, and should not be called
by servlet code. Most servlets can leave this method as-is, but
some may need to override it.)
- Overrides:
doGet
in class HtmlServlet
- Parameters:
request
- a HttpServletRequest
object encapsulating this
browser request.response
- a HttpServletResponse
object encapsulating the
servlet's response.
javax.servlet.ServletException
java.io.IOException
doPost
public void doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException,
java.io.IOException
- Handles the HTTP POST request by calling
doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
, thus
ensuring that GET requests are handled identically to POST
requests.
(This method is called by the server, and should not be called
by servlet code. Most servlets can leave this method as-is, but
some may need to override it.)
- Overrides:
doPost
in class HtmlServlet
- Parameters:
request
- a HttpServletRequest
object encapsulating this
browser request.response
- a HttpServletResponse
object encapsulating the
servlet's response.
javax.servlet.ServletException
java.io.IOException