Enum InstallersOptions

    • Enum Constant Detail

      • DenyServletRegistrationWithClash

        public static final InstallersOptions DenyServletRegistrationWithClash
        Affects WebServletInstaller. During servlet registration, url patterns may clash with already installed servlets. By default, only warning will be printed in log. Set option to true to throw exception on registration if clash detected.

        Note: clash resolution depends on servlets registration order. Moreover, clash may appear on some 3rd party servlet registration (not managed by installer) and so be not affected by this option.

      • DenySessionListenersWithoutSession

        public static final InstallersOptions DenySessionListenersWithoutSession
        Affects WebListenerInstaller. By default, dropwizard does not have configured sessions support (to be stateless), so session listeners can't be installed. Because session listeners may be defined as part of 3rd party bundles and most likely will complement bundle functionality (aka optional part), listener installer will only log warning about not installed listeners. Set option to true to throw error instead (when session listeners can't be installed because of no sessions support enabled).
      • JerseyExtensionsManagedByGuice

        public static final InstallersOptions JerseyExtensionsManagedByGuice
        in the next version HK2 support will be removed
        By default, HK2 related extensions like resources or other jersey specific extensions are managed by guice (guice-managed instance is registered in HK2). This makes some HK2-specific features not possible (like context injection with @Context annotation). JerseyManaged annotation could switch annotated beans to be managed by HK2. But in some cases, it is more convenient to always use HK2 and this option is supposed to be used exactly for such cases.

        When false value set, all beans, managed by jersey installers (JerseyInstaller) should register beans for HK2 management. JerseyManaged become useless in this case, instead GuiceManaged annotation could be used.

        Note that even managed by HK2 beans will be singletons. Still this will not block you from using @Context annotation injections, because HK2 will proxy such injections and properly handle multi-threaded access (implicit provider).

        NOTE: guice aop is not applicable for beans managed by HK2 (because guice aop use class proxies and not instance proxies).

        Startup will fail if HK2 bridge is not enabled (see GuiceyOptions.UseHkBridge) because without it you can't inject any guice beans into HK2 managed instances (and if you don't need to then you don't need guice support at all).

      • ForceSingletonForJerseyExtensions

        public static final InstallersOptions ForceSingletonForJerseyExtensions
        Force singleton scope for jersey extensions (including resources). It is highly recommended using singletons to avoid redundant objects creation. Enabled by default.

        Note that forced singleton is not applied to beans with explicit scoping annotation set. Prototype annotation may be used to force default (prototype) scope instead of singleton.

        When switched off, extension scope will be driven only by scope annotation. Note that by default guice and HK2 use prototype scope (for example, for resources it means new instance for each request).

      • PrioritizeJerseyExtensions

        public static final InstallersOptions PrioritizeJerseyExtensions
        By default, when extension registered with environment.jersey().register(...) it's implicitly qualified with Custom, so registered extensions could override default extensions, including default dropwizard extensions (see Providers.getAllServiceHolders( org.glassfish.jersey.internal.inject.InjectionManager, java.lang.Class) to see that custom qualified providers are prioritized). For example, registered ExceptionMapper<Throwable> would override default dropwizard's one.

        When option disabled, qualifier could still be applied manually with Custom annotation on provider class. Or Priority might be used instead (see Priorities for default priority constants).

        Option is enabled by default to mimic default dropwizard behaviour (when extensions registered manually). But it MAY change application behaviour comparing to previous guicey versoins and so it might be desirable to revert previous guicey behavior (and this is the main reason for option to exist).

    • Method Detail

      • values

        public static InstallersOptions[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (InstallersOptions c : InstallersOptions.values())
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static InstallersOptions valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        name - the name of the enum constant to be returned.
        the enum constant with the specified name
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • getType

        public java.lang.Class<?> getType()
        Specified by:
        getType in interface Option
        option type
      • getDefaultValue

        public java.lang.Object getDefaultValue()
        Specified by:
        getDefaultValue in interface Option
        option default value or null