Package io.dropwizard.core.server
Class AbstractServerFactory
java.lang.Object
io.dropwizard.core.server.AbstractServerFactory
- All Implemented Interfaces:
ServerFactory
,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. |
maxQueuedRequests |
1024 | The maximum number of requests to queue before blocking the acceptors. |
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.Handler
addGracefulHandler
(org.eclipse.jetty.server.Handler handler) protected void
addRequestLog
(org.eclipse.jetty.server.Server server, String name, MutableServletContextHandler servletContextHandler) protected org.eclipse.jetty.server.Handler
buildGzipHandler
(org.eclipse.jetty.server.Handler handler) protected org.eclipse.jetty.server.Server
buildServer
(LifecycleEnvironment lifecycle, org.eclipse.jetty.util.thread.ThreadPool threadPool) protected org.eclipse.jetty.setuid.SetUIDListener
protected org.eclipse.jetty.server.Handler
createAdminServlet
(org.eclipse.jetty.server.Server server, MutableServletContextHandler handler, com.codahale.metrics.MetricRegistry metrics, com.codahale.metrics.health.HealthCheckRegistry healthChecks, AdminEnvironment admin) protected org.eclipse.jetty.server.Handler
createAppServlet
(org.eclipse.jetty.server.Server server, JerseyEnvironment jersey, com.fasterxml.jackson.databind.ObjectMapper objectMapper, jakarta.validation.Validator validator, MutableServletContextHandler handler, @Nullable jakarta.servlet.Servlet jerseyContainer, com.codahale.metrics.MetricRegistry metricRegistry) protected org.eclipse.jetty.util.thread.ThreadPool
createThreadPool
(com.codahale.metrics.MetricRegistry metricRegistry) boolean
boolean
boolean
@Nullable Integer
getGid()
@Nullable String
getGroup()
int
int
@Nullable String
int
@Nullable Integer
@Nullable Integer
com.codahale.metrics.annotation.ResponseMeteredLevel
@Nullable Boolean
@Nullable Integer
getUid()
@Nullable String
getUmask()
@Nullable String
getUser()
protected ExecutorService
boolean
boolean
protected void
printBanner
(String name) void
setAllowedMethods
(Set<String> allowedMethods) void
setDetailedJsonProcessingExceptionMapper
(Boolean detailedJsonProcessingExceptionMapper) void
setDumpAfterStart
(boolean dumpAfterStart) void
setDumpBeforeStop
(boolean dumpBeforeStop) void
setEnableThreadNameFilter
(boolean enableThreadNameFilter) void
setEnableVirtualThreads
(boolean enableVirtualThreads) void
void
void
void
setIdleThreadTimeout
(Duration idleThreadTimeout) void
setJerseyRootPath
(String jerseyRootPath) void
setMaxQueuedRequests
(int maxQueuedRequests) void
setMaxThreads
(int count) void
setMinThreads
(int count) void
setNofileHardLimit
(Integer nofileHardLimit) void
setNofileSoftLimit
(Integer nofileSoftLimit) void
setRegisterDefaultExceptionMappers
(Boolean registerDefaultExceptionMappers) void
setRequestLogFactory
(RequestLogFactory<?> requestLog) void
setShutdownGracePeriod
(Duration shutdownGracePeriod) void
setStartsAsRoot
(Boolean startsAsRoot) void
void
void
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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
-
setRequestLogFactory
-
getGzipFilterFactory
-
setGzipFilterFactory
-
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) -
getMaxQueuedRequests
public int getMaxQueuedRequests() -
setMaxQueuedRequests
public void setMaxQueuedRequests(int maxQueuedRequests) -
getIdleThreadTimeout
-
setIdleThreadTimeout
-
getNofileSoftLimit
-
setNofileSoftLimit
-
getNofileHardLimit
-
setNofileHardLimit
-
getGid
-
setGid
-
getUid
-
setUid
-
getUser
-
setUser
-
getGroup
-
setGroup
-
getUmask
-
setUmask
-
getStartsAsRoot
-
setStartsAsRoot
-
getRegisterDefaultExceptionMappers
-
setRegisterDefaultExceptionMappers
-
getDetailedJsonProcessingExceptionMapper
-
setDetailedJsonProcessingExceptionMapper
-
getShutdownGracePeriod
-
setShutdownGracePeriod
-
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, 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, JerseyEnvironment jersey, com.fasterxml.jackson.databind.ObjectMapper objectMapper, jakarta.validation.Validator validator, 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) -
getVirtualThreadsExecutorService
-
buildServer
protected org.eclipse.jetty.server.Server buildServer(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, 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
-