use of org.apache.catalina.core.StandardContext in project Payara by payara.
the class WebContainer method updateJvmRoute.
public void updateJvmRoute(HttpService httpService, String jvmOption) {
String jvmRoute = null;
if (jvmOption.contains("{") && jvmOption.contains("}")) {
// Look up system-property
jvmOption = jvmOption.substring(jvmOption.indexOf("{") + 1, jvmOption.indexOf("}"));
jvmRoute = server.getSystemPropertyValue(jvmOption);
if (jvmRoute == null) {
// Try to get it from System property if it exists
jvmRoute = System.getProperty(jvmOption);
}
} else if (jvmOption.contains("=")) {
jvmRoute = jvmOption.substring(jvmOption.indexOf("=") + 1);
}
engine.setJvmRoute(jvmRoute);
for (com.sun.enterprise.config.serverbeans.VirtualServer vsBean : httpService.getVirtualServer()) {
VirtualServer vs = (VirtualServer) engine.findChild(vsBean.getId());
for (Container context : vs.findChildren()) {
if (context instanceof StandardContext) {
((StandardContext) context).setJvmRoute(jvmRoute);
}
}
}
for (Connector connector : _embedded.getConnectors()) {
connector.setJvmRoute(jvmRoute);
}
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, LogFacade.JVM_ROUTE_UPDATED, jvmRoute);
}
}
use of org.apache.catalina.core.StandardContext in project Payara by payara.
the class WebappLoader method init.
public void init() {
initialized = true;
if (oname == null) {
// not registered yet - standalone or API
if (container instanceof StandardContext) {
// Register ourself. The container must be a webapp
try {
StandardContext ctx = (StandardContext) container;
String path = ctx.getEncodedPath();
if (path.equals("")) {
path = "/";
}
oname = new ObjectName(ctx.getEngineName() + ":type=Loader,path=" + path + ",host=" + ctx.getParent().getName());
controller = oname;
} catch (Exception e) {
log.log(Level.SEVERE, LogFacade.REGISTERING_LOADER_EXCEPTION, e);
}
}
}
/*
if( container == null ) {
// JMX created the loader
// TODO
}
*/
}
use of org.apache.catalina.core.StandardContext in project Payara by payara.
the class LoggerBase method createObjectName.
public ObjectName createObjectName() {
if (log.isLoggable(Level.FINE)) {
log.log(Level.FINE, "createObjectName with " + container);
}
// register
try {
StandardEngine engine = null;
String suffix = "";
if (container instanceof StandardEngine) {
engine = (StandardEngine) container;
} else if (container instanceof StandardHost) {
engine = (StandardEngine) container.getParent();
suffix = ",host=" + container.getName();
} else if (container instanceof StandardContext) {
String path = ((StandardContext) container).getPath();
// add "/" to avoid MalformedObjectName Exception
if (path.equals("")) {
path = "/";
}
engine = (StandardEngine) container.getParent().getParent();
suffix = ",path=" + path + ",host=" + container.getParent().getName();
} else {
log.log(Level.SEVERE, LogFacade.UNKNOWN_CONTAINER_EXCEPTION);
}
if (engine != null) {
oname = new ObjectName(engine.getDomain() + ":type=Logger" + suffix);
} else {
log.log(Level.SEVERE, LogFacade.NULL_ENGINE_EXCEPTION, container);
}
} catch (Throwable e) {
log.log(Level.WARNING, LogFacade.UNABLE_CREATE_OBJECT_NAME_FOR_LOGGER_EXCEPTION, e);
}
return oname;
}
use of org.apache.catalina.core.StandardContext in project Payara by payara.
the class ManagerBase method init.
public void init() {
if (initialized)
return;
initialized = true;
if (oname == null) {
try {
StandardContext ctx = (StandardContext) this.getContainer();
domain = ctx.getEngineName();
distributable = ctx.getDistributable();
StandardHost hst = (StandardHost) ctx.getParent();
String path = ctx.getEncodedPath();
if (path.equals("")) {
path = "/";
}
oname = new ObjectName(domain + ":type=Manager,path=" + path + ",host=" + hst.getName());
} catch (Exception e) {
log.log(Level.SEVERE, LogFacade.ERROR_REGISTERING_EXCEPTION_SEVERE, e);
}
}
if (log.isLoggable(Level.FINE)) {
log.log(Level.FINE, "Registering " + oname);
}
}
use of org.apache.catalina.core.StandardContext in project Payara by payara.
the class BaseHASession method sync.
public void sync() {
HttpSessionBindingEvent event = null;
event = new HttpSessionBindingEvent((HttpSession) this, null, null);
// Notify special event listeners on sync()
Manager manager = this.getManager();
StandardContext stdContext = (StandardContext) manager.getContainer();
// fire container event
stdContext.fireContainerEvent("sessionSync", event);
}
Aggregations