Methods Summary |
---|
public org.apache.catalina.Connector | createConnector(java.lang.String address, int port, java.lang.String protocol)Create a customized version of the Tomcat's 5 Coyote Connector. This
connector is required in order to support PE Web Programmatic login
functionality.
if (address != null) {
/*
* InetAddress.toString() returns a string of the form
* "<hostname>/<literal_IP>". Get the latter part, so that the
* address can be parsed (back) into an InetAddress using
* InetAddress.getByName().
*/
int index = address.indexOf('/");
if (index != -1) {
address = address.substring(index + 1);
}
}
_logger.log(Level.FINE,"Creating connector for address='" +
((address == null) ? "ALL" : address) +
"' port='" + port + "' protocol='" + protocol + "'");
PECoyoteConnector connector = new PECoyoteConnector();
if (address != null) {
connector.setAddress(address);
}
connector.setPort(port);
if (protocol.equals("ajp")) {
connector.setProtocolHandlerClassName(
"org.apache.jk.server.JkCoyoteHandler");
} else if (protocol.equals("memory")) {
connector.setProtocolHandlerClassName(
"org.apache.coyote.memory.MemoryProtocolHandler");
} else if (protocol.equals("https")) {
connector.setScheme("https");
connector.setSecure(true);
}
return (connector);
|
public org.apache.catalina.Context | createContext(java.lang.String ctxPath, java.lang.String location, java.lang.String defaultContextXmlLocation, java.lang.String defaultWebXmlLocation, boolean useDOLforDeployment, com.sun.enterprise.deployment.WebBundleDescriptor wbd)Create a web module/application.
File configFile = new File(location, Constants.WEB_CONTEXT_XML);
WebModule context = new WebModule(webContainer);
context.setDebug(debug);
context.setPath(ctxPath);
context.setDocBase(location);
context.setCrossContext(true);
context.setUseNaming(isUseNaming());
context.setHasWebXml(wbd == null ? false : true);
context.setWebBundleDescriptor(wbd);
context.setManagerChecksFrequency(1);
if (configFile.exists()) {
context.setConfigFile(configFile.getAbsolutePath());
}
ContextConfig config;
if (useDOLforDeployment) {
config = new WebModuleContextConfig();
((WebModuleContextConfig)config).setDescriptor(wbd);
} else {
config = new ContextConfig();
}
config.setDefaultContextXml(defaultContextXmlLocation);
config.setDefaultWebXml(defaultWebXmlLocation);
((Lifecycle) context).addLifecycleListener(config);
context.addLifecycleListener(new WebModuleListener(
webContainer.getInstanceClassPath(), location, wbd));
context.addInstanceListener(Constants.J2EE_INSTANCE_LISTENER);
context.addContainerListener(new WebContainerListener());
context.addInstanceListener(
"com.sun.enterprise.admin.monitor.callflow.WebContainerListener");
return context;
|
public org.apache.catalina.Engine | createEngine()Create, configure, and return an Engine that will process all
HTTP requests received from one of the associated Connectors,
based on the specified properties.
Do not create the JAAS default realm since all children will
have their own.
StandardEngine engine = new WebEngine(webContainer, _logger);
engine.setDebug(debug);
// Default host will be set to the first host added
engine.setLogger(logger); // Inherited by all children
engine.setRealm(null); // Inherited by all children
ContainerListener listener = loadListener
("com.sun.enterprise.admin.monitor.callflow.WebContainerListener");
if ( listener != null ) {
engine.addContainerListener(listener);
}
return (engine);
|
public org.apache.catalina.Host | createHost(java.lang.String vsID, com.sun.enterprise.config.serverbeans.VirtualServer vsBean, java.lang.String vsDocroot, java.lang.String vsLogFile, MimeMap vsMimeMap)Creates a virtual server.
VirtualServer vs = webContainerFeatureFactory.getVirtualServer();
vs.setDebug(debug);
vs.setAppBase(vsDocroot);
vs.setName(vsID);
vs.setID(vsID);
vs.setBean(vsBean);
vs.setMimeMap(vsMimeMap);
String defaultContextXmlLocation = Constants.DEFAULT_CONTEXT_XML;
String defaultWebXmlLocation = Constants.DEFAULT_WEB_XML;
boolean allowLinking = false;
String state = null;
if (vsBean != null) {
state = vsBean.getState();
ElementProperty prop = null;
//Begin EE: 4920692 Make the default-web.xml be relocatable
prop = vsBean.getElementPropertyByName("default-web-xml");
if (prop != null) {
defaultWebXmlLocation = prop.getValue();
}
//End EE: 4920692 Make the default-web.xml be relocatable
// allowLinking
prop = vsBean.getElementPropertyByName("allowLinking");
if (prop != null) {
allowLinking = ConfigBean.toBoolean(prop.getValue());
}
prop = vsBean.getElementPropertyByName("contextXmlDefault");
if (prop != null) {
defaultContextXmlLocation = prop.getValue();
}
}
vs.setDefaultWebXmlLocation(defaultWebXmlLocation);
vs.setDefaultContextXmlLocation(defaultContextXmlLocation);
// Set vs state
if (state == null) {
state = VirtualServer.ON;
}
if (VirtualServer.DISABLED.equalsIgnoreCase(state)) {
vs.setIsActive(false);
} else {
vs.setIsActive(ConfigBean.toBoolean(state));
}
vs.setAllowLinking(allowLinking);
if (vsLogFile != null && !vsLogFile.equals(logServiceFile)) {
/*
* Configure separate logger for this virtual server only if
* 'log-file' attribute of this <virtual-server> and 'file'
* attribute of <log-service> are different (See 6189219).
*/
setLogFile(vs, vsLogFile);
}
ContainerListener listener = loadListener
("com.sun.enterprise.web.connector.extension.CatalinaListener");
if ( listener != null )
vs.addContainerListener(listener);
return vs;
|
public org.apache.catalina.Connector[] | getConnectors()Returns the list of Connector objects associated with this
EmbeddedWebContainer.
return connectors;
|
public org.apache.catalina.Engine[] | getEngines()Return the list of engines created (from Embedded API)
return engines;
|
private org.apache.catalina.ContainerListener | loadListener(java.lang.String className)Util method to load classes that might get compiled after this class is
compiled.
try{
Class clazz = Class.forName(className);
return (ContainerListener)clazz.newInstance();
} catch (Throwable ex){
_logger.log(Level.SEVERE,ex.getMessage() + ":" + className, ex);
}
return null;
|
protected void | setLogFile(org.apache.catalina.Host vs, java.lang.String logFile)
String logPrefix = logFile;
String logDir = null;
String logSuffix = null;
if (logPrefix == null || logPrefix.equals("")) {
return;
}
int index = logPrefix.lastIndexOf(File.separatorChar);
if (index != -1) {
logDir = logPrefix.substring(0, index);
logPrefix = logPrefix.substring(index+1);
}
index = logPrefix.indexOf('.");
if (index != -1) {
logSuffix = logPrefix.substring(index);
logPrefix = logPrefix.substring(0, index);
}
logPrefix += "_";
FileLogger contextLogger = new FileLogger();
if (logDir != null) {
contextLogger.setDirectory(logDir);
}
contextLogger.setPrefix(logPrefix);
if (logSuffix != null) {
contextLogger.setSuffix(logSuffix);
}
contextLogger.setTimestamp(true);
vs.setLogger(contextLogger);
|