Class WebContainerConfig


  • public class WebContainerConfig
    extends Object
    Class that is used for configuring WebContainer instances.

    Usage example:

          // Create and start Glassfish
          GlassFish glassfish = GlassFishRuntime.bootstrap().newGlassFish();
          glassfish.start();
    
          // Access WebContainer
          WebContainer container = glassfish.getService(WebContainer.class);
    
          WebContainerConfig config = new WebContainerConfig();
          config.setListings(true);
          config.setPort(9090);
          config.setHostNames("localhost");
          container.setConfiguration(config);
     
    See Also:
    WebContainer
    • Constructor Detail

      • WebContainerConfig

        public WebContainerConfig()
    • Method Detail

      • setDefaultWebXml

        public void setDefaultWebXml​(URL url)
        Sets the default web xml
        Parameters:
        url - the url of the default web xml
      • getDefaultWebXml

        public URL getDefaultWebXml()
        Gets the default web xml (default: org/glassfish/web/embed/default-web.xml).
      • setDocRootDir

        public void setDocRootDir​(File f)
        Sets the docroot directory
        Parameters:
        f - the docroot directory
      • getDocRootDir

        public File getDocRootDir()
        Gets the docroot directory
      • setHostNames

        public void setHostNames​(String hostNames)
        Sets the host names of the default VirtualServer (default: localhost).
        Parameters:
        hostNames - the host names of the default VirtualServer seprated by commas.
      • getHostNames

        public String getHostNames()
        Gets the host names of the default VirtualServer (default: localhost).
        Returns:
        the host names of the default VirtualServer
      • setListenerName

        public void setListenerName​(String name)
        Sets the default listener name
        Parameters:
        name - the name of the default listener
      • getListenerName

        public String getListenerName()
        Gets the default listener name
      • setListings

        public void setListings​(boolean directoryListing)
        Enables or disables directory listings
        Parameters:
        directoryListing - true if directory listings are to be enabled, false otherwise
      • getListings

        public boolean getListings()
        Return if directory listings is enabled
      • setPort

        public void setPort​(int port)
        Sets the port of the default WebListener (default: 8080).
        Parameters:
        port - the port of the default WebListener
      • getPort

        public int getPort()
        Gets the port of the default WebListener (default: 8080).
        Returns:
        the port of the default WebListener
      • setVirtualServerId

        public void setVirtualServerId​(String virtualServerId)
        Sets the id of the default VirtualServer (default: server).
        Parameters:
        virtualServerId - the id of the default VirtualServer
      • getVirtualServerId

        public String getVirtualServerId()
        Gets the id of the default VirtualServer (default: server).
        Returns:
        the id of the default VirtualServer