Class TomcatService

java.lang.Object
com.linecorp.armeria.server.tomcat.TomcatService
All Implemented Interfaces:
com.linecorp.armeria.common.util.Unwrappable, com.linecorp.armeria.server.HttpService, com.linecorp.armeria.server.Service<com.linecorp.armeria.common.HttpRequest,com.linecorp.armeria.common.HttpResponse>

public abstract class TomcatService extends Object implements com.linecorp.armeria.server.HttpService
An HttpService that dispatches its requests to a web application running in an embedded Tomcat.
See Also:
  • Method Details

    • of

      public static TomcatService of(File docBase)
      Creates a new TomcatService with the web application at the specified document base, which can be a directory or a JAR/WAR file.
    • of

      public static TomcatService of(Path docBase)
      Creates a new TomcatService with the web application at the specified document base, which can be a directory or a JAR/WAR file.
    • of

      public static TomcatService of(File rootDir, String relativeDocBase)
      Creates a new TomcatService with the web application at the specified document base, which can be a directory or a JAR/WAR file.
    • of

      public static TomcatService of(Path rootDir, String relativeDocBase)
      Creates a new TomcatService with the web application at the specified document base, which can be a directory or a JAR/WAR file.
    • of

      public static TomcatService of(Tomcat tomcat)
      Creates a new TomcatService from an existing Tomcat instance. If the specified Tomcat instance is not configured properly, the returned TomcatService may respond with '503 Service Not Available' error.
      Returns:
      a new TomcatService, which will not manage the provided Tomcat instance.
    • of

      public static TomcatService of(Connector connector)
      Creates a new TomcatService from an existing Tomcat Connector instance. If the specified Connector instance is not configured properly, the returned TomcatService may respond with '503 Service Not Available' error.
      Returns:
      a new TomcatService, which will not manage the provided Connector instance.
    • of

      public static TomcatService of(Connector connector, String hostname)
      Creates a new TomcatService from an existing Tomcat Connector instance. If the specified Connector instance is not configured properly, the returned TomcatService may respond with '503 Service Not Available' error.
      Returns:
      a new TomcatService, which will not manage the provided Connector instance.
    • builder

      public static TomcatServiceBuilder builder(File docBase)
      Creates a new TomcatServiceBuilder with the web application at the specified document base, which can be a directory or a JAR/WAR file.
    • builder

      public static TomcatServiceBuilder builder(Path docBase)
      Creates a new TomcatServiceBuilder with the web application at the specified document base, which can be a directory or a JAR/WAR file.
    • builder

      public static TomcatServiceBuilder builder(File rootDirOrDocBase, String relativePath)
      Creates a new TomcatServiceBuilder with the web application at the specified document base, which can be a directory or a JAR/WAR file.
    • builder

      public static TomcatServiceBuilder builder(Path rootDirOrDocBase, String relativePath)
      Creates a new TomcatServiceBuilder with the web application at the specified document base, which can be a directory or a JAR/WAR file.
    • connector

      @Nullable public abstract @Nullable Connector connector()
      Returns Tomcat Connector.
      Returns:
      the Tomcat Connector, or null if the Connector is not available yet.
    • serve

      public final com.linecorp.armeria.common.HttpResponse serve(com.linecorp.armeria.server.ServiceRequestContext ctx, com.linecorp.armeria.common.HttpRequest req) throws Exception
      Specified by:
      serve in interface com.linecorp.armeria.server.HttpService
      Specified by:
      serve in interface com.linecorp.armeria.server.Service<com.linecorp.armeria.common.HttpRequest,com.linecorp.armeria.common.HttpResponse>
      Throws:
      Exception