Package edu.pdx.cs410J.apptbookweb
Class AppointmentBookServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
edu.pdx.cs410J.apptbookweb.AppointmentBookServlet
- All Implemented Interfaces:
Serializable
,javax.servlet.Servlet
,javax.servlet.ServletConfig
This servlet ultimately provides a REST API for working with an
AppointmentBook
. However, in its current state, it is an example
of how to use HTTP and Java servlets to store simple dictionary of words
and their definitions.- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
doDelete
(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Handles an HTTP DELETE request by removing all dictionary entries.protected void
doGet
(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Handles an HTTP GET request from a client by writing the definition of the word specified in the "word" HTTP parameter to the HTTP response.protected void
doPost
(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Handles an HTTP POST request by storing the dictionary entry for the "word" and "definition" request parameters.(package private) String
getDefinition
(String word) Methods inherited from class javax.servlet.http.HttpServlet
doHead, doOptions, doPut, doTrace, getLastModified, service, service
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
-
Field Details
-
WORD_PARAMETER
- See Also:
-
DEFINITION_PARAMETER
- See Also:
-
-
Constructor Details
-
AppointmentBookServlet
public AppointmentBookServlet()
-
-
Method Details
-
doGet
protected void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException Handles an HTTP GET request from a client by writing the definition of the word specified in the "word" HTTP parameter to the HTTP response. If the "word" parameter is not specified, all of the entries in the dictionary are written to the HTTP response.- Overrides:
doGet
in classjavax.servlet.http.HttpServlet
- Throws:
IOException
-
doPost
protected void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException Handles an HTTP POST request by storing the dictionary entry for the "word" and "definition" request parameters. It writes the dictionary entry to the HTTP response.- Overrides:
doPost
in classjavax.servlet.http.HttpServlet
- Throws:
IOException
-
doDelete
protected void doDelete(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException Handles an HTTP DELETE request by removing all dictionary entries. This behavior is exposed for testing purposes only. It's probably not something that you'd want a real application to expose.- Overrides:
doDelete
in classjavax.servlet.http.HttpServlet
- Throws:
IOException
-
getDefinition
-