Class TestWebServer

  • All Implemented Interfaces:
    AutoCloseable

    public class TestWebServer
    extends Object
    implements AutoCloseable
    Simple Web server for easily testing Servlets. This is a simplified version of org.opendaylight.aaa.web.jetty.JettyWebServer, and useful for web tests in infrautils. Other projects than infrautils are free to use this for their tests as well, but may prefer to use the full JettyWebServer instead.
    Author:
    Michael Vorburger.ch
    • Constructor Detail

      • TestWebServer

        public TestWebServer()
                      throws javax.servlet.ServletException
        Throws:
        javax.servlet.ServletException
      • TestWebServer

        public TestWebServer​(String host,
                             int httpPort,
                             String testContext)
                      throws javax.servlet.ServletException
        Throws:
        javax.servlet.ServletException
    • Method Detail

      • close

        public void close()
                   throws javax.servlet.ServletException
        Specified by:
        close in interface AutoCloseable
        Throws:
        javax.servlet.ServletException
      • getTestContextURL

        public String getTestContextURL()
      • registerServlet

        public void registerServlet​(javax.servlet.Servlet servlet,
                                    String urlPattern)
                             throws javax.servlet.ServletException
        Throws:
        javax.servlet.ServletException