Class EmbeddedPiranha

java.lang.Object
cloud.piranha.embedded.EmbeddedPiranha
Direct Known Subclasses:
MicroEmbeddedPiranha

public class EmbeddedPiranha extends Object
The embeddable servlet container version of Piranha.
Author:
Manfred Riem ([email protected])
  • Constructor Details

    • EmbeddedPiranha

      public EmbeddedPiranha()
      Constructor.
    • EmbeddedPiranha

      public EmbeddedPiranha(WebApplication webApplication)
      Another constructor.
      Parameters:
      webApplication - the web application to use.
  • Method Details

    • destroy

      public EmbeddedPiranha destroy()
      Destroy the web application.
      Returns:
      the instance.
    • getWebApplication

      public WebApplication getWebApplication()
      Returns the web application.
      Returns:
      the web application
    • initialize

      public EmbeddedPiranha initialize()
      Initialize the web application.
      Returns:
      the instance.
    • service

      public EmbeddedResponse service(String servletPath, String... parameters) throws IOException, ServletException
      This method services a request by dispatching it to the configured Servlet and/or Filters.

      This is a convenience method for simple cases. Use the other service methods for more control of the request.

      Parameters:
      servletPath - the request path, e.g. /foo/bar
      parameters - the request parameters, with each even parameter the name, and odd parameter the value. e.g. /foo, 1, bar, 2
      Returns:
      the response generated by the Servlet and/or Filters
      Throws:
      IOException - when an I/O error occurs.
      ServletException - when a Servlet error occurs.
    • service

      public EmbeddedResponse service(ServletRequest servletRequest) throws IOException, ServletException
      This method services a request by dispatching it to the configured Servlet and/or Filters.

      This is a convenience method uses

      Parameters:
      servletRequest - the request.
      Returns:
      the response generated by the Servlet and/or Filters
      Throws:
      IOException - when an I/O error occurs.
      ServletException - when a Servlet error occurs.
    • service

      public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws IOException, ServletException
      Service method.
      Parameters:
      servletRequest - the request.
      servletResponse - the response.
      Throws:
      IOException - when an I/O error occurs.
      ServletException - when a Servlet error occurs.
    • start

      public EmbeddedPiranha start()
      Start the web application.
      Returns:
      the instance.
    • stop

      public EmbeddedPiranha stop()
      Stop the web application.
      Returns:
      the instance.