Package io.dropwizard.core.server
Class AbstractServerFactory
java.lang.Object
io.dropwizard.core.server.AbstractServerFactory
- All Implemented Interfaces:
ServerFactory,io.dropwizard.jackson.Discoverable
- Direct Known Subclasses:
DefaultServerFactory,SimpleServerFactory
A base class for
ServerFactory implementations.
Configuration Parameters:
| Name | Default | Description |
requestLog |
The request log configuration. |
|
gzip |
The GZIP configuration. |
|
responseMeteredLevel |
COARSE | The response metered level to decide what response code meters are included. |
metricPrefix |
The metricPrefix to use in the metric name for jetty metrics. | |
maxThreads |
1024 | The maximum number of threads to use for requests. |
minThreads |
8 | The minimum number of threads to use for requests. |
idleThreadTimeout |
1 minute | The amount of time a worker thread can be idle before being stopped. |
nofileSoftLimit |
(none) |
The number of open file descriptors before a soft error is issued. Requires Jetty's
libsetuid.so on java.library.path.
|
nofileHardLimit |
(none) |
The number of open file descriptors before a hard error is issued. Requires Jetty's
libsetuid.so on java.library.path.
|
gid |
(none) |
The group ID to switch to once the connectors have started. Requires Jetty's
libsetuid.so on java.library.path.
|
uid |
(none) |
The user ID to switch to once the connectors have started. Requires Jetty's
libsetuid.so on java.library.path.
|
user |
(none) |
The username to switch to once the connectors have started. Requires Jetty's
libsetuid.so on java.library.path.
|
group |
(none) |
The group to switch to once the connectors have started. Requires Jetty's
libsetuid.so on java.library.path.
|
umask |
(none) |
The umask to switch to once the connectors have started. Requires Jetty's
libsetuid.so on java.library.path.
|
startsAsRoot |
(none) |
Whether or not the Dropwizard application is started as a root user. Requires
Jetty's libsetuid.so on java.library.path.
|
registerDefaultExceptionMappers |
true | Whether or not the default Jersey ExceptionMappers should be registered. Set this to false if you want to register your own. |
shutdownGracePeriod |
30 seconds | The maximum time to wait for Jetty, and all Managed instances, to cleanly shutdown before forcibly terminating them. |
allowedMethods |
GET, POST, PUT, DELETE, HEAD, OPTIONS, PATCH | The set of allowed HTTP methods. Others will be rejected with a 405 Method Not Allowed response. |
rootPath |
/* |
The URL pattern relative to applicationContextPath from which the JAX-RS resources will be served.
|
enableThreadNameFilter |
true |
Whether or not to apply the ThreadNameFilter that adjusts thread names to include the request
method and request URI.
|
dumpAfterStart |
true | Whether or not to dump jetty diagnostics after start. |
dumpBeforeStop |
true | Whether or not to dump jetty diagnostics before stop. |
enableVirtualThreads |
false | Whether to use virtual threads for Jetty's thread pool. |
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.eclipse.jetty.server.HandleraddGracefulHandler(org.eclipse.jetty.server.Handler handler) protected voidaddRequestLog(org.eclipse.jetty.server.Server server, String name, io.dropwizard.jetty.MutableServletContextHandler servletContextHandler) protected org.eclipse.jetty.server.HandlerbuildGzipHandler(org.eclipse.jetty.server.Handler handler) protected org.eclipse.jetty.server.ServerbuildServer(io.dropwizard.lifecycle.setup.LifecycleEnvironment lifecycle, org.eclipse.jetty.util.thread.ThreadPool threadPool) protected org.eclipse.jetty.setuid.SetUIDListenerprotected org.eclipse.jetty.server.HandlercreateAdminServlet(org.eclipse.jetty.server.Server server, io.dropwizard.jetty.MutableServletContextHandler handler, com.codahale.metrics.MetricRegistry metrics, com.codahale.metrics.health.HealthCheckRegistry healthChecks, AdminEnvironment admin) protected org.eclipse.jetty.server.HandlercreateAppServlet(org.eclipse.jetty.server.Server server, io.dropwizard.jersey.setup.JerseyEnvironment jersey, com.fasterxml.jackson.databind.ObjectMapper objectMapper, jakarta.validation.Validator validator, io.dropwizard.jetty.MutableServletContextHandler handler, @Nullable jakarta.servlet.Servlet jerseyContainer, com.codahale.metrics.MetricRegistry metricRegistry) protected org.eclipse.jetty.util.thread.ThreadPoolcreateThreadPool(com.codahale.metrics.MetricRegistry metricRegistry) booleanbooleanboolean@Nullable IntegergetGid()@Nullable StringgetGroup()io.dropwizard.jetty.GzipHandlerFactoryio.dropwizard.util.Durationint@Nullable Stringint@Nullable Integer@Nullable Integerio.dropwizard.request.logging.RequestLogFactory<?>com.codahale.metrics.annotation.ResponseMeteredLevelio.dropwizard.util.Duration@Nullable Boolean@Nullable IntegergetUid()@Nullable StringgetUmask()@Nullable StringgetUser()booleanbooleanprotected voidprintBanner(String name) voidsetAllowedMethods(Set<String> allowedMethods) voidsetDetailedJsonProcessingExceptionMapper(Boolean detailedJsonProcessingExceptionMapper) voidsetDumpAfterStart(boolean dumpAfterStart) voidsetDumpBeforeStop(boolean dumpBeforeStop) voidsetEnableThreadNameFilter(boolean enableThreadNameFilter) voidsetEnableVirtualThreads(boolean enableVirtualThreads) voidvoidvoidsetGzipFilterFactory(io.dropwizard.jetty.GzipHandlerFactory gzip) voidsetIdleThreadTimeout(io.dropwizard.util.Duration idleThreadTimeout) voidsetJerseyRootPath(String jerseyRootPath) voidsetMaxThreads(int count) voidsetMinThreads(int count) voidsetNofileHardLimit(Integer nofileHardLimit) voidsetNofileSoftLimit(Integer nofileSoftLimit) voidsetRegisterDefaultExceptionMappers(Boolean registerDefaultExceptionMappers) voidsetRequestLogFactory(io.dropwizard.request.logging.RequestLogFactory<?> requestLog) voidsetShutdownGracePeriod(io.dropwizard.util.Duration shutdownGracePeriod) voidsetStartsAsRoot(Boolean startsAsRoot) voidvoidvoidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.dropwizard.core.server.ServerFactory
build, configure
-
Constructor Details
-
AbstractServerFactory
public AbstractServerFactory()
-
-
Method Details
-
isThreadPoolSizedCorrectly
@ValidationMethod(message="must have a smaller minThreads than maxThreads") public boolean isThreadPoolSizedCorrectly() -
getRequestLogFactory
public io.dropwizard.request.logging.RequestLogFactory<?> getRequestLogFactory() -
setRequestLogFactory
public void setRequestLogFactory(io.dropwizard.request.logging.RequestLogFactory<?> requestLog) -
getGzipFilterFactory
public io.dropwizard.jetty.GzipHandlerFactory getGzipFilterFactory() -
setGzipFilterFactory
public void setGzipFilterFactory(io.dropwizard.jetty.GzipHandlerFactory gzip) -
getResponseMeteredLevel
public com.codahale.metrics.annotation.ResponseMeteredLevel getResponseMeteredLevel() -
getMetricPrefix
-
getMaxThreads
public int getMaxThreads() -
setMaxThreads
public void setMaxThreads(int count) -
getMinThreads
public int getMinThreads() -
setMinThreads
public void setMinThreads(int count) -
getIdleThreadTimeout
public io.dropwizard.util.Duration getIdleThreadTimeout() -
setIdleThreadTimeout
public void setIdleThreadTimeout(io.dropwizard.util.Duration idleThreadTimeout) -
getNofileSoftLimit
-
setNofileSoftLimit
-
getNofileHardLimit
-
setNofileHardLimit
-
getGid
-
setGid
-
getUid
-
setUid
-
getUser
-
setUser
-
getGroup
-
setGroup
-
getUmask
-
setUmask
-
getStartsAsRoot
-
setStartsAsRoot
-
getRegisterDefaultExceptionMappers
-
setRegisterDefaultExceptionMappers
-
getDetailedJsonProcessingExceptionMapper
-
setDetailedJsonProcessingExceptionMapper
-
getShutdownGracePeriod
public io.dropwizard.util.Duration getShutdownGracePeriod() -
setShutdownGracePeriod
public void setShutdownGracePeriod(io.dropwizard.util.Duration shutdownGracePeriod) -
getAllowedMethods
-
setAllowedMethods
-
getJerseyRootPath
-
setJerseyRootPath
-
getEnableThreadNameFilter
public boolean getEnableThreadNameFilter() -
setEnableThreadNameFilter
public void setEnableThreadNameFilter(boolean enableThreadNameFilter) -
getDumpAfterStart
public boolean getDumpAfterStart()- Since:
- 2.0
-
setDumpAfterStart
public void setDumpAfterStart(boolean dumpAfterStart) - Since:
- 2.0
-
getDumpBeforeStop
public boolean getDumpBeforeStop()- Since:
- 2.0
-
setDumpBeforeStop
public void setDumpBeforeStop(boolean dumpBeforeStop) - Since:
- 2.0
-
isEnableVirtualThreads
public boolean isEnableVirtualThreads() -
setEnableVirtualThreads
public void setEnableVirtualThreads(boolean enableVirtualThreads) -
createAdminServlet
protected org.eclipse.jetty.server.Handler createAdminServlet(org.eclipse.jetty.server.Server server, io.dropwizard.jetty.MutableServletContextHandler handler, com.codahale.metrics.MetricRegistry metrics, com.codahale.metrics.health.HealthCheckRegistry healthChecks, AdminEnvironment admin) -
createAppServlet
protected org.eclipse.jetty.server.Handler createAppServlet(org.eclipse.jetty.server.Server server, io.dropwizard.jersey.setup.JerseyEnvironment jersey, com.fasterxml.jackson.databind.ObjectMapper objectMapper, jakarta.validation.Validator validator, io.dropwizard.jetty.MutableServletContextHandler handler, @Nullable jakarta.servlet.Servlet jerseyContainer, com.codahale.metrics.MetricRegistry metricRegistry) -
createThreadPool
protected org.eclipse.jetty.util.thread.ThreadPool createThreadPool(com.codahale.metrics.MetricRegistry metricRegistry) -
buildServer
protected org.eclipse.jetty.server.Server buildServer(io.dropwizard.lifecycle.setup.LifecycleEnvironment lifecycle, org.eclipse.jetty.util.thread.ThreadPool threadPool) -
buildSetUIDListener
protected org.eclipse.jetty.setuid.SetUIDListener buildSetUIDListener() -
addRequestLog
protected void addRequestLog(org.eclipse.jetty.server.Server server, String name, io.dropwizard.jetty.MutableServletContextHandler servletContextHandler) -
addGracefulHandler
protected org.eclipse.jetty.server.Handler addGracefulHandler(org.eclipse.jetty.server.Handler handler) -
buildGzipHandler
protected org.eclipse.jetty.server.Handler buildGzipHandler(org.eclipse.jetty.server.Handler handler) -
printBanner
-