Class MockGatewayServlet

  • All Implemented Interfaces:
    Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

    public class MockGatewayServlet
    extends javax.servlet.http.HttpServlet
    A simple servlet that pretends to be an API Management Gateway REST endpoint. But really all it does is record information about what requests it handled so that we can do assertions in the tests.
    Author:
    eric.wittmann@redhat.com
    See Also:
    Serialized Form
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void doDelete​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)  
      protected void doGet​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)  
      protected void doPost​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)  
      protected void doPut​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)  
      static List<String> getPayloads()  
      static String getRequestLog()  
      static void reset()  
      • Methods inherited from class javax.servlet.http.HttpServlet

        doHead, doOptions, doTrace, getLastModified, service, service
      • Methods inherited from class javax.servlet.GenericServlet

        destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
    • Constructor Detail

      • MockGatewayServlet

        public MockGatewayServlet()
        Constructor.
    • Method Detail

      • reset

        public static void reset()
      • getRequestLog

        public static String getRequestLog()
      • getPayloads

        public static List<String> getPayloads()
      • doGet

        protected void doGet​(javax.servlet.http.HttpServletRequest req,
                             javax.servlet.http.HttpServletResponse resp)
                      throws javax.servlet.ServletException,
                             IOException
        Overrides:
        doGet in class javax.servlet.http.HttpServlet
        Throws:
        javax.servlet.ServletException
        IOException
        See Also:
        HttpServlet.doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
      • doPost

        protected void doPost​(javax.servlet.http.HttpServletRequest req,
                              javax.servlet.http.HttpServletResponse resp)
                       throws javax.servlet.ServletException,
                              IOException
        Overrides:
        doPost in class javax.servlet.http.HttpServlet
        Throws:
        javax.servlet.ServletException
        IOException
        See Also:
        HttpServlet.doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
      • doPut

        protected void doPut​(javax.servlet.http.HttpServletRequest req,
                             javax.servlet.http.HttpServletResponse resp)
                      throws javax.servlet.ServletException,
                             IOException
        Overrides:
        doPut in class javax.servlet.http.HttpServlet
        Throws:
        javax.servlet.ServletException
        IOException
        See Also:
        HttpServlet.doPut(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
      • doDelete

        protected void doDelete​(javax.servlet.http.HttpServletRequest req,
                                javax.servlet.http.HttpServletResponse resp)
                         throws javax.servlet.ServletException,
                                IOException
        Overrides:
        doDelete in class javax.servlet.http.HttpServlet
        Throws:
        javax.servlet.ServletException
        IOException
        See Also:
        HttpServlet.doDelete(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)