Class JettyEmulator

java.lang.Object
org.zkoss.zats.mimic.impl.emulator.JettyEmulator
All Implemented Interfaces:
Closeable, AutoCloseable, Emulator

public class JettyEmulator extends Object implements Emulator
The emulator implementation in Jetty Server.
Author:
pao
  • Constructor Details

    • JettyEmulator

      public JettyEmulator(org.eclipse.jetty.util.resource.Resource contentRoot, String descriptor, String contextPath)
    • JettyEmulator

      public JettyEmulator(org.eclipse.jetty.util.resource.Resource[] contentRoots, String descriptor, String contextPath)
      new a jetty emulator
      Parameters:
      contentRoots - the content roots.
      descriptor - specify the web.xml, if null then use /WEB-INF/web.xml that in contentRoots
      contextPath - specify the context, if null then use "/"
  • Method Details

    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface Emulator
    • getHost

      public String getHost()
      Description copied from interface: Emulator
      get the host address the emulator bound. normally, it should be "127.0.0.1".
      Specified by:
      getHost in interface Emulator
      Returns:
      host address
    • getPort

      public int getPort()
      Description copied from interface: Emulator
      get the port number the emulator bound.
      Specified by:
      getPort in interface Emulator
      Returns:
      port number
    • getContextPath

      public String getContextPath()
      Description copied from interface: Emulator
      get the context path of the application
      Specified by:
      getContextPath in interface Emulator
      Returns:
      the context path
    • getAddress

      public String getAddress()
      Description copied from interface: Emulator
      get the URL address.
      Specified by:
      getAddress in interface Emulator
      Returns:
      URL.
    • getServletContext

      public jakarta.servlet.ServletContext getServletContext()
      Description copied from interface: Emulator
      get the reference of servlet context in the emulator.
      Specified by:
      getServletContext in interface Emulator
      Returns:
      servlet context
    • getRequestAttributes

      public Map<String,Object> getRequestAttributes()
      Description copied from interface: Emulator
      get the attributes of last request.
      Specified by:
      getRequestAttributes in interface Emulator
      Returns:
      attributes.
    • getRequestParameters

      public Map<String,String[]> getRequestParameters()
      Description copied from interface: Emulator
      get the parameters of last request.
      Specified by:
      getRequestParameters in interface Emulator
      Returns:
      parameters.
    • getSessionAttributes

      public Map<String,Object> getSessionAttributes()
      Description copied from interface: Emulator
      get the session's attributes of last request.
      Specified by:
      getSessionAttributes in interface Emulator
      Returns:
      attributes.
    • getSessionId

      public String getSessionId()
      Description copied from interface: Emulator
      get the session ID of last request.
      Specified by:
      getSessionId in interface Emulator
      Returns:
      ID or null if no session created.