Class ServerPagesAppExtensionBundle.AppExtensionBuilder

  • Enclosing class:
    ServerPagesAppExtensionBundle

    public static class ServerPagesAppExtensionBundle.AppExtensionBuilder
    extends java.lang.Object
    Extensions bundle builder.
    • Constructor Detail

      • AppExtensionBuilder

        public AppExtensionBuilder​(java.lang.String name,
                                   java.lang.ClassLoader loader)
    • Method Detail

      • mapViews

        public ServerPagesAppExtensionBundle.AppExtensionBuilder mapViews​(java.lang.String subUrl,
                                                                          java.lang.String prefix)
        Map view rest to sub url. May be used to map additional rest endpoints with different prefix.

        Only one mapping is allowed per url (otherwise error will be thrown)! But mappings for larger sub urls are always allowed (partial override).

        Normally, application configures root views mapping, but if not, then extension could register root mapping using "/" as url. Direct shortcut not provided because such usage case considered as very rare,

        Use delayed configuration if dropwizard configuration object is required delayedConfiguration(DelayedConfigurationCallback).

        Pay attention that additional asset locations may be required (attachAssets(String, String), because only templates relative to view class will be correctly resolved, but direct templates may fail to resolve.

        Parameters:
        subUrl - sub url to map views to
        prefix - rest prefix to map as root views
        Returns:
        builder instance for chained calls
        See Also:
        ServerPagesAppBundle.AppBuilder.mapViews(String, String)
      • delayedConfiguration

        public ServerPagesAppExtensionBundle.AppExtensionBuilder delayedConfiguration​(DelayedConfigurationCallback callback)
        Used to delay actual configuration till runtime phase, when dropwizard configuration will be available (or, in case of complex setup, other bundles will perform all required initializations). Called after guicey initialization (when guice injector created and extensions installed).

        Only one callback may be registered.

        WARNING: if extension bundle created with custom class loader, it will not be applied to callback configuration because callback is a low level configuration, and it supports custom class loader with an additional parameter.

        Parameters:
        callback - callback for extensions configuration under run phase
        Returns:
        builder instance for chained calls