Class EmbeddedPiranhaBuilder

java.lang.Object
cloud.piranha.embedded.EmbeddedPiranhaBuilder

public class EmbeddedPiranhaBuilder extends Object
The builder so you can easily build instances of EmbeddedPiranha.
Author:
Manfred Riem ([email protected])
See Also:
  • Constructor Details

    • EmbeddedPiranhaBuilder

      public EmbeddedPiranhaBuilder()
      Constructor.
  • Method Details

    • aliasedDirectoryResource

      public EmbeddedPiranhaBuilder aliasedDirectoryResource(String path, String alias)
      Add an aliased directory resource.
      Parameters:
      path - the path.
      alias - the alias.
      Returns:
      the builder.
    • attribute

      public EmbeddedPiranhaBuilder attribute(String name, Object value)
      Add an attribute.
      Parameters:
      name - the name.
      value - the value.
      Returns:
      the builder.
    • build

      public EmbeddedPiranha build()
      Build the Piranha Embedded instance.
      Returns:
      the instance.
    • buildAndStart

      public EmbeddedPiranha buildAndStart()
      Build and starts the Piranha Embedded instance.
      Returns:
      the instance.
    • classLoader

      public EmbeddedPiranhaBuilder classLoader(ClassLoader classLoader)
      Set the class loader.
      Parameters:
      classLoader - the class loader.
      Returns:
      the builder.
    • directoryResource

      public EmbeddedPiranhaBuilder directoryResource(String path)
      Add a directory resource.
      Parameters:
      path - the path.
      Returns:
      the builder.
    • extension

      public EmbeddedPiranhaBuilder extension(Class<? extends WebApplicationExtension> extensionClass)
      Set the web application extension.
      Parameters:
      extensionClass - the extension class.
      Returns:
      the builder.
    • extensions

      @SafeVarargs public final EmbeddedPiranhaBuilder extensions(Class<? extends WebApplicationExtension>... extensionClasses)
      Set the web application extensions.
      Parameters:
      extensionClasses - the extension classes.
      Returns:
      the builder.
    • filter

      public EmbeddedPiranhaBuilder filter(String filterName, Class<?> filterClass)
      Add a filter.
      Parameters:
      filterName - the filter name.
      filterClass - the filter class.
      Returns:
      the builder.
    • filter

      public EmbeddedPiranhaBuilder filter(String filterName, String className)
      Add a filter.
      Parameters:
      filterName - the filter name.
      className - the class name.
      Returns:
      the builder.
    • filterInitParam

      public EmbeddedPiranhaBuilder filterInitParam(String filterName, String name, String value)
      Set a filter init parameter.
      Parameters:
      filterName - the filter name.
      name - the name.
      value - the value.
      Returns:
      the builder.
    • filterMapping

      public EmbeddedPiranhaBuilder filterMapping(String filterName, String... urlPatterns)
      Add a filter mapping.
      Parameters:
      filterName - the filter name.
      urlPatterns - the URL patterns.
      Returns:
      the builder.
    • httpSessionManager

      public EmbeddedPiranhaBuilder httpSessionManager(HttpSessionManager httpSessionManager)
      Set the HTTP session manager.
      Parameters:
      httpSessionManager - the HTTP session manager.
      Returns:
      the builder.
    • initializer

      public EmbeddedPiranhaBuilder initializer(Class<?> initializerClass)
      Add an initializer.
      Parameters:
      initializerClass - the class name.
      Returns:
      the builder.
    • initializer

      public EmbeddedPiranhaBuilder initializer(String className)
      Add an initializer.
      Parameters:
      className - the class name.
      Returns:
      the builder.
    • initializers

      public EmbeddedPiranhaBuilder initializers(Class<?>... initializerClasses)
      Add initializers.
      Parameters:
      initializerClasses - the classes
      Returns:
      the builder.
    • listener

      public EmbeddedPiranhaBuilder listener(String className)
      Add a listeners.
      Parameters:
      className - the class name.
      Returns:
      the builder.
    • servlet

      public EmbeddedPiranhaBuilder servlet(String servletName, Class<?> servletClass)
      Add a servlet
      Parameters:
      servletName - the servlet name.
      servletClass - the servlet class.
      Returns:
      the builder.
    • servlet

      public EmbeddedPiranhaBuilder servlet(String servletName, String className)
      Add a servlet.
      Parameters:
      servletName - the servlet name.
      className - the class name.
      Returns:
      the builder.
    • servlet

      public EmbeddedPiranhaBuilder servlet(String servletName, Class<?> servletClass, boolean asyncSupported)
      Add a servlet.
      Parameters:
      servletName - the servlet name.
      servletClass - the servlet class.
      asyncSupported - the async supported flag.
      Returns:
      the builder.
    • servlet

      public EmbeddedPiranhaBuilder servlet(String servletName, String className, boolean asyncSupported)
      Add a servlet.
      Parameters:
      servletName - the servlet name.
      className - the class name.
      asyncSupported - the async supported flag.
      Returns:
      the builder.
    • servletInitParam

      public EmbeddedPiranhaBuilder servletInitParam(String servletName, String name, String value)
      Set a servlet init parameter.
      Parameters:
      servletName - the servlet name.
      name - the name.
      value - the value.
      Returns:
      the builder.
    • servletMapped

      public EmbeddedPiranhaBuilder servletMapped(Class<?> servletClass, String... urlPatterns)
      Add a servlet and a servlet mapping.
      Parameters:
      servletClass - the servlet class.
      urlPatterns - the URL patterns
      Returns:
      the builder.
    • servletMapped

      public EmbeddedPiranhaBuilder servletMapped(Class<?> servletClass, boolean asyncSupported, String... urlPatterns)
      Add a servlet and a servlet mapping.
      Parameters:
      servletClass - the servlet class.
      asyncSupported - the async supported flag.
      urlPatterns - the URL patterns
      Returns:
      the builder.
    • servletMapping

      public EmbeddedPiranhaBuilder servletMapping(String servletName, String... urlPatterns)
      Add a servlet mapping.
      Parameters:
      servletName - the servlet name.
      urlPatterns - the URL patterns.
      Returns:
      the builder.
    • servletsMapped

      public EmbeddedPiranhaBuilder servletsMapped(Class<?> servletClass1, String urlPattern1)
      Add servlets and their servlet mapping.
      Parameters:
      servletClass1 - the first servlet class.
      urlPattern1 - the first URL pattern.
      Returns:
      the builder.
    • servletsMapped

      public EmbeddedPiranhaBuilder servletsMapped(Class<?> servletClass1, String urlPattern1, Class<?> servletClass2, String urlPattern2)
      Add servlets and their servlet mapping.
      Parameters:
      servletClass1 - the first servlet class.
      urlPattern1 - the first URL pattern.
      servletClass2 - the second servlet class.
      urlPattern2 - the second URL pattern.
      Returns:
      the builder.
    • servletsMapped

      public EmbeddedPiranhaBuilder servletsMapped(Class<?> servletClass1, String urlPattern1, Class<?> servletClass2, String urlPattern2, Class<?> servletClass3, String urlPattern3)
      Add servlets and their servlet mapping.
      Parameters:
      servletClass1 - the first servlet class.
      urlPattern1 - the first URL pattern.
      servletClass2 - the second servlet class.
      urlPattern2 - the second URL pattern.
      servletClass3 - the third servlet class.
      urlPattern3 - the third URL pattern.
      Returns:
      the builder.
    • servletsMapped

      public EmbeddedPiranhaBuilder servletsMapped(Class<?> servletClass1, String urlPattern1, Class<?> servletClass2, String urlPattern2, Class<?> servletClass3, String urlPattern3, Class<?> servletClass4, String urlPattern4)
      Add servlets and their servlet mapping.
      Parameters:
      servletClass1 - the first servlet class.
      urlPattern1 - the first URL pattern.
      servletClass2 - the second servlet class.
      urlPattern2 - the second URL pattern.
      servletClass3 - the third servlet class.
      urlPattern3 - the third URL pattern.
      servletClass4 - the fourth servlet class.
      urlPattern4 - the fourth URL pattern.
      Returns:
      the builder.
    • servletsMapped

      public EmbeddedPiranhaBuilder servletsMapped(Class<?> servletClass1, String urlPattern1, Class<?> servletClass2, String urlPattern2, Class<?> servletClass3, String urlPattern3, Class<?> servletClass4, String urlPattern4, Class<?> servletClass5, String urlPattern5)
      Add servlets and their servlet mapping.
      Parameters:
      servletClass1 - the first servlet class.
      urlPattern1 - the first URL pattern.
      servletClass2 - the second servlet class.
      urlPattern2 - the second URL pattern.
      servletClass3 - the third servlet class.
      urlPattern3 - the third URL pattern.
      servletClass4 - the fourth servlet class.
      urlPattern4 - the fourth URL pattern.
      servletClass5 - the fifth servlet class.
      urlPattern5 - the fifth URL pattern.
      Returns:
      the builder.
    • stringResource

      public EmbeddedPiranhaBuilder stringResource(String path, String value)
      Add a string resource.
      Parameters:
      path - the path.
      value - the string value added under the given path.
      Returns:
      the builder.
    • webApplication

      public EmbeddedPiranhaBuilder webApplication(WebApplication webApplication)
      Set the web application.
      Parameters:
      webApplication - the web application.
      Returns:
      the builder.