Class JettyServer.Builder

java.lang.Object
org.apache.jena.fuseki.main.JettyServer.Builder
Enclosing class:
JettyServer

public static class JettyServer.Builder extends Object
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • port

      public JettyServer.Builder port(int port)
      Set the port to run on.
    • jettyServerConfig

      public JettyServer.Builder jettyServerConfig(String filename)
      Build the server using a Jetty configuration file. See Jetty/Reference/jetty.xml_syntax This is instead of any other server settings such as port or https.
    • contextPath

      public JettyServer.Builder contextPath(String path)
      Context path. If it's "/" then Server URL will look like "http://host:port/" else "http://host:port/path/" (or no port if :80).
    • servletContextName

      public JettyServer.Builder servletContextName(String name)
      ServletContextName.
    • loopback

      public JettyServer.Builder loopback(boolean loopback)
      Restrict the server to only responding to the localhost interface.
    • staticFileBase

      public JettyServer.Builder staticFileBase(String directory)
      Set the location (filing system directory) to serve static file from.
    • securityHandler

      public JettyServer.Builder securityHandler(org.eclipse.jetty.security.SecurityHandler securityHandler)
      Set a Jetty SecurityHandler.

      By default, the server runs with no security. This is more for using the basic server for testing. The full Fuseki server provides security with Apache Shiro and a defensive reverse proxy (e.g. Apache httpd) in front of the Jetty server can also be used, which provides a wide varity of proven security options.

    • errorHandler

      public JettyServer.Builder errorHandler(org.eclipse.jetty.server.handler.ErrorHandler errorHandler)
      Set an ErrorHandler.

      By default, the server runs with error handle that prints the code and message.

    • verbose

      public JettyServer.Builder verbose(boolean verbose)
      Set verbose logging
    • numServerThreads

      public JettyServer.Builder numServerThreads(int minThreads, int maxThreads)
      Set the number threads used by Jetty. This uses a org.eclipse.jetty.util.thread.QueuedThreadPool provided by Jetty.

      Argument order is (minThreads, maxThreads).

      • Use (-1,-1) for Jetty "default". The Jetty 9.4 defaults are (min=8,max=200).
      • If (min != -1, max is -1) then the default max is 20.
      • If (min is -1, max != -1) then the default min is 2.
    • maxServerThreads

      public JettyServer.Builder maxServerThreads(int maxThreads)
      Set the maximum number threads used by Jetty. This is equivalent to numServerThreads(-1, maxThreads) and overrides any previous setting of the maximum number of threads. In development or in embedded use, limiting the maximum threads can be useful.
    • addServlet

      public JettyServer.Builder addServlet(String pathSpec, jakarta.servlet.http.HttpServlet servlet)
      Add the given servlet with the pathSpec. These are added so that they are before the static content handler (which is the last servlet) used for staticFileBase(String).
    • addServletAttribute

      public JettyServer.Builder addServletAttribute(String attrName, Object value)
      Add a servlet attribute. Pass a value of null to remove any existing binding.
    • addFilter

      public JettyServer.Builder addFilter(String pathSpec, jakarta.servlet.Filter filter)
      Add the given filter with the pathSpec. It is applied to all dispatch types.
    • build

      public JettyServer build()
      Build a server according to the current description.