Class DefaultJettyAtJettyHomeHelper


  • public class DefaultJettyAtJettyHomeHelper
    extends java.lang.Object
    DefaultJettyAtJettyHomeHelper

    Creates a default instance of Jetty, based on the values of the System properties "jetty.home" or "jetty.home.bundle", one of which must be specified in order to create the default instance.

    Called by the JettyBootstrapActivator during the starting of the bundle.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String DEFAULT_JETTY_ETC_FILES
      Set of config files to apply to a jetty Server instance if none are supplied by SYS_PROP_JETTY_ETC_FILES
      static java.lang.String DEFAULT_JETTYHOME
      Default location within bundle of a jetty home dir.
      static java.lang.String JETTY_ETC_FILES
      contains a comma separated list of paths to the etc/jetty-*.xml files
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Resource findDir​(org.osgi.framework.Bundle bundle, java.lang.String dir)
      Get a resource representing a directory inside a bundle.
      static Server startJettyAtJettyHome​(org.osgi.framework.BundleContext bundleContext)
      Called by the JettyBootStrapActivator.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • JETTY_ETC_FILES

        public static final java.lang.String JETTY_ETC_FILES
        contains a comma separated list of paths to the etc/jetty-*.xml files
        See Also:
        Constant Field Values
      • DEFAULT_JETTY_ETC_FILES

        public static final java.lang.String DEFAULT_JETTY_ETC_FILES
        Set of config files to apply to a jetty Server instance if none are supplied by SYS_PROP_JETTY_ETC_FILES
        See Also:
        Constant Field Values
      • DEFAULT_JETTYHOME

        public static final java.lang.String DEFAULT_JETTYHOME
        Default location within bundle of a jetty home dir.
        See Also:
        Constant Field Values
    • Constructor Detail

      • DefaultJettyAtJettyHomeHelper

        public DefaultJettyAtJettyHomeHelper()
    • Method Detail

      • startJettyAtJettyHome

        public static Server startJettyAtJettyHome​(org.osgi.framework.BundleContext bundleContext)
                                            throws java.lang.Exception
        Called by the JettyBootStrapActivator. If the system property jetty.home is defined and points to a folder, creates a corresponding jetty server.

        If the system property jetty.home.bundle is defined and points to a bundle, look for the configuration of jetty inside that bundle.

        In both cases reads the system property 'jetty.etc.config.urls' to locate the configuration files for the deployed jetty. It is a comma separated list of URLs or relative paths inside the bundle or folder to the config files.

        In both cases the system properties jetty.http.host, jetty.http.port and jetty.ssl.port are passed to the configuration files that might use them as part of their properties.

        Parameters:
        bundleContext - the bundle context
        Returns:
        the configured server
        Throws:
        java.lang.Exception - if unable to create / configure / or start the server
      • findDir

        public static Resource findDir​(org.osgi.framework.Bundle bundle,
                                       java.lang.String dir)
        Get a resource representing a directory inside a bundle. If the dir is null, return a resource representing the installation location of the bundle.
        Parameters:
        bundle - the bundle
        dir - the directory
        Returns:
        the resource found