public class WebContainerConfig extends Object
// 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);
WebContainer| Constructor and Description |
|---|
WebContainerConfig() |
| Modifier and Type | Method and Description |
|---|---|
URL |
getDefaultWebXml()
Gets the default web xml
(default: org/glassfish/web/embed/default-web.xml).
|
File |
getDocRootDir()
Gets the docroot directory
|
String |
getHostNames()
Gets the host names of the default VirtualServer
(default: localhost).
|
String |
getListenerName()
Gets the default listener name
|
boolean |
getListings()
Return if directory listings is enabled
|
int |
getPort()
Gets the port of the default WebListener (default: 8080).
|
String |
getVirtualServerId()
Gets the id of the default VirtualServer
(default: server).
|
void |
setDefaultWebXml(URL url)
Sets the default web xml
|
void |
setDocRootDir(File f)
Sets the docroot directory
|
void |
setHostNames(String hostNames)
Sets the host names of the default VirtualServer
(default: localhost).
|
void |
setListenerName(String name)
Sets the default listener name
|
void |
setListings(boolean directoryListing)
Enables or disables directory listings
|
void |
setPort(int port)
Sets the port of the default WebListener (default: 8080).
|
void |
setVirtualServerId(String virtualServerId)
Sets the id of the default VirtualServer
(default: server).
|
public void setDefaultWebXml(URL url)
url - the url of the default web xmlpublic URL getDefaultWebXml()
public void setDocRootDir(File f)
f - the docroot directorypublic File getDocRootDir()
public void setHostNames(String hostNames)
hostNames - the host names of the default VirtualServer seprated by commas.public String getHostNames()
public void setListenerName(String name)
name - the name of the default listenerpublic String getListenerName()
public void setListings(boolean directoryListing)
directoryListing - true if directory listings are to be
enabled, false otherwisepublic boolean getListings()
public void setPort(int port)
port - the port of the default WebListenerpublic int getPort()
public void setVirtualServerId(String virtualServerId)
virtualServerId - the id of the default VirtualServerpublic String getVirtualServerId()
Copyright © 2019. All rights reserved.