<commit_before>.. _man-configuration:

###################################
Dropwizard Configuration Reference
###################################

.. highlight:: text

.. rubric:: The ``dropwizard-configuration`` module provides you with a polymorphic configuration
            mechanism, meaning that a particular section of your configuration file can be implemented
            using one or more configuration classes.

To use this capability for your own configuration classes, create a top-level configuration interface or class that
implements ``Discoverable`` and add the name of that class to ``META-INF/services/io.dropwizard.jackson.Discoverable``.
Make sure to use `Jackson polymorphic deserialization`_ annotations appropriately.

.. _Jackson polymorphic deserialization: http://wiki.fasterxml.com/JacksonPolymorphicDeserialization

.. code-block:: java

    @JsonTypeInfo(use = Id.NAME, include = As.PROPERTY, property = "type")
    interface WidgetFactory extends Discoverable {
        Widget createWidget();
    }

Then create subtypes of the top-level type corresponding to each alternative, and add their names to
``META-INF/services/WidgetFactory``.

.. code-block:: java

    @JsonTypeName("hammer")
    public class HammerFactory implements WidgetFactory {
        @JsonProperty
        private int weight = 10;

        @Override
        public Hammer createWidget() {
            return new Hammer(weight);
        }
    }

    @JsonTypeName("chisel")
    public class ChiselFactory implements WidgetFactory {
        @JsonProperty
        private float radius = 1;

        @Override
        public Chisel createWidget() {
            return new Chisel(weight);
        }
    }

Now you can use ``WidgetFactory`` objects in your application's configuration.

.. code-block:: java

    public class MyConfiguration extends Configuration {
        @JsonProperty
        @NotNull
        @Valid
        private List<WidgetFactory> widgets;
    }

.. code-block:: yaml

    widgets:
      - type: hammer
        weight: 20
      - type: chisel
        radius: 0.4

.. _man-configuration-servers:

Servers
========

.. code-block:: yaml

    server:
      type: default
      maxThreads: 1024


.. _man-configuration-all:

All
----

=================================== ===============================================  =============================================================================
Name                                Default                                          Description
=================================== ===============================================  =============================================================================
type                                default                                          - default
                                                                                     - simple
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``.
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``,          The set of allowed HTTP methods. Others will be rejected with a
                                    ``HEAD``, ``OPTIONS``, ``PATCH``                 405 Method Not Allowed response.
rootPath                            ``/``                                            The URL pattern relative to ``applicationContextPath`` from which
                                                                                     the JAX-RS resources will be served.
registerDefaultExceptionMappers     true                                             Whether or not the default Jersey ExceptionMappers should be registered.
                                                                                     Set this to false if you want to register your own.
======================              ===============================================  =============================================================================


.. _man-configuration-gzip:

GZip
.....

.. code-block:: yaml

    server:
      gzip: 
        bufferSize: 8KiB


+----------------------+------------+---------------------------------------------------------------------------------------------------+ 
|     Name             | Default    | Description                                                                                       | <commit_msg>Fix a layout of the default server configuration table<commit_after>.. _man-configuration:

###################################
Dropwizard Configuration Reference
###################################

.. highlight:: text

.. rubric:: The ``dropwizard-configuration`` module provides you with a polymorphic configuration
            mechanism, meaning that a particular section of your configuration file can be implemented
            using one or more configuration classes.

To use this capability for your own configuration classes, create a top-level configuration interface or class that
implements ``Discoverable`` and add the name of that class to ``META-INF/services/io.dropwizard.jackson.Discoverable``.
Make sure to use `Jackson polymorphic deserialization`_ annotations appropriately.

.. _Jackson polymorphic deserialization: http://wiki.fasterxml.com/JacksonPolymorphicDeserialization

.. code-block:: java

    @JsonTypeInfo(use = Id.NAME, include = As.PROPERTY, property = "type")
    interface WidgetFactory extends Discoverable {
        Widget createWidget();
    }

Then create subtypes of the top-level type corresponding to each alternative, and add their names to
``META-INF/services/WidgetFactory``.

.. code-block:: java

    @JsonTypeName("hammer")
    public class HammerFactory implements WidgetFactory {
        @JsonProperty
        private int weight = 10;

        @Override
        public Hammer createWidget() {
            return new Hammer(weight);
        }
    }

    @JsonTypeName("chisel")
    public class ChiselFactory implements WidgetFactory {
        @JsonProperty
        private float radius = 1;

        @Override
        public Chisel createWidget() {
            return new Chisel(weight);
        }
    }

Now you can use ``WidgetFactory`` objects in your application's configuration.

.. code-block:: java

    public class MyConfiguration extends Configuration {
        @JsonProperty
        @NotNull
        @Valid
        private List<WidgetFactory> widgets;
    }

.. code-block:: yaml

    widgets:
      - type: hammer
        weight: 20
      - type: chisel
        radius: 0.4

.. _man-configuration-servers:

Servers
========

.. code-block:: yaml

    server:
      type: default
      maxThreads: 1024


.. _man-configuration-all:

All
----

=================================== ===============================================  =============================================================================
Name                                Default                                          Description
=================================== ===============================================  =============================================================================
type                                default                                          - default
                                                                                     - simple
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``.
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``,          The set of allowed HTTP methods. Others will be rejected with a
                                    ``HEAD``, ``OPTIONS``, ``PATCH``                 405 Method Not Allowed response.
rootPath                            ``/``                                            The URL pattern relative to ``applicationContextPath`` from which
                                                                                     the JAX-RS resources will be served.
registerDefaultExceptionMappers     true                                             Whether or not the default Jersey ExceptionMappers should be registered.
                                                                                     Set this to false if you want to register your own.
=================================== ===============================================  =============================================================================


.. _man-configuration-gzip:

GZip
.....

.. code-block:: yaml

    server:
      gzip: 
        bufferSize: 8KiB


+----------------------+------------+---------------------------------------------------------------------------------------------------+ 
|     Name             | Default    | Description                                                                                       | 
{'fraction_non_alphanumeric': 0.13981862073465126, 'fraction_numerical': 0.0035231943628890195, 'mean_word_length': 1.1066520065970313, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 178, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7374008', 'n_tokens_mistral': 2711, 'n_tokens_neox': 2476, 'n_words': 984}