Class AirlineServlet

java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
edu.pdx.cs410J.airlineweb.AirlineServlet
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class AirlineServlet extends javax.servlet.http.HttpServlet
This servlet ultimately provides a REST API for working with an Airline. 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

    Fields
    Modifier and Type
    Field
    Description
    (package private) static final String
     
    (package private) static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected 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
     

    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • 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 class javax.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 class javax.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 class javax.servlet.http.HttpServlet
      Throws:
      IOException
    • getDefinition