use of org.apache.catalina.core.StandardContext in project Payara by payara.
the class ReplicatedWebMethodSessionStrategyBuilder method initializePersistenceStrategy.
public void initializePersistenceStrategy(Context ctx, SessionManager smBean, ServerConfigLookup serverConfigLookup) {
super.initializePersistenceStrategy(ctx, smBean, serverConfigLookup);
// super.setPassedInPersistenceType("replicated");
if (this.getPersistenceScope().equals("session")) {
setupReplicationWebEventPersistentManager(SimpleMetadata.class, new FullSessionFactory(), new ReplicationStore(ioUtils), ctx, serverConfigLookup);
} else if (this.getPersistenceScope().equals("modified-session")) {
setupReplicationWebEventPersistentManager(SimpleMetadata.class, new ModifiedSessionFactory(), new ReplicationStore(ioUtils), ctx, serverConfigLookup);
} else if (this.getPersistenceScope().equals("modified-attribute")) {
setupReplicationWebEventPersistentManager(CompositeMetadata.class, new ModifiedAttributeSessionFactory(), new ReplicationAttributeStore(ioUtils), ctx, serverConfigLookup);
} else {
throw new IllegalArgumentException(this.getPersistenceScope());
}
HASessionStoreValve haValve = new HASessionStoreValve();
StandardContext stdCtx = (StandardContext) ctx;
stdCtx.addValve((GlassFishValve) haValve);
}
use of org.apache.catalina.core.StandardContext in project Payara by payara.
the class ReplicationStore method getUniqueId.
protected long getUniqueId() {
long uniqueId = 0L;
Container container = this.manager.getContainer();
if (container instanceof StandardContext) {
StandardContext ctx = (StandardContext) container;
uniqueId = ctx.getUniqueId();
}
return uniqueId;
}
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 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);
}
logger.log(Level.FINE, LogFacade.JVM_ROUTE_UPDATED, jvmRoute);
}
use of org.apache.catalina.core.StandardContext in project sonarqube by SonarSource.
the class TomcatContexts method addContext.
private static StandardContext addContext(Tomcat tomcat, String contextPath, File dir) {
try {
StandardContext context = (StandardContext) tomcat.addWebapp(contextPath, dir.getAbsolutePath());
context.setClearReferencesHttpClientKeepAliveThread(false);
context.setClearReferencesStopThreads(false);
context.setClearReferencesStopTimerThreads(false);
context.setClearReferencesStopTimerThreads(false);
context.setAntiResourceLocking(false);
context.setReloadable(false);
context.setUseHttpOnly(true);
context.setTldValidation(false);
context.setXmlValidation(false);
context.setXmlNamespaceAware(false);
context.setUseNaming(false);
context.setDelegate(true);
context.setJarScanner(new NullJarScanner());
context.setAllowCasualMultipartParsing(true);
context.setCookies(false);
// disable JSP and WebSocket support
context.setContainerSciFilter("org.apache.tomcat.websocket.server.WsSci|org.apache.jasper.servlet.JasperInitializer");
return context;
} catch (Exception e) {
throw new IllegalStateException("Fail to configure webapp from " + dir, e);
}
}
Aggregations