use of org.glassfish.web.config.serverbeans.WebContainer in project Payara by payara.
the class GlassFishTldProvider method postConstruct.
public void postConstruct() {
/*
* Check whether JSP caching has been enabled
*/
Config cfg = serverContext.getDefaultServices().getService(Config.class, ServerEnvironment.DEFAULT_INSTANCE_NAME);
WebContainer webContainer = cfg.getExtensionByType(WebContainer.class);
if (webContainer == null) {
return;
}
if (!Boolean.valueOf(webContainer.getJspCachingEnabled())) {
return;
}
/*
* JSP caching has been enabled
*/
Class jspCachingImplClass = CacheTag.class;
URI[] uris = null;
Module m = null;
if (jspCachingImplClass != null) {
m = registry.find(jspCachingImplClass);
}
if (m != null) {
uris = m.getModuleDefinition().getLocations();
} else {
ClassLoader classLoader = getClass().getClassLoader();
if (classLoader instanceof URLClassLoader) {
URL[] urls = ((URLClassLoader) classLoader).getURLs();
if (urls != null && urls.length > 0) {
uris = new URI[urls.length];
for (int i = 0; i < urls.length; i++) {
try {
uris[i] = urls[i].toURI();
} catch (URISyntaxException e) {
String msg = rb.getString(LogFacade.TLD_PROVIDER_IGNORE_URL);
msg = MessageFormat.format(msg, urls[i]);
logger.log(Level.WARNING, msg, e);
}
}
}
} else {
logger.log(Level.WARNING, LogFacade.UNABLE_TO_DETERMINE_TLD_RESOURCES, new Object[] { "JSP Caching", classLoader, GlassFishTldProvider.class.getName() });
}
}
if (uris != null && uris.length > 0) {
Pattern pattern = Pattern.compile("META-INF/.*\\.tld");
for (URI uri : uris) {
List<String> entries = JarURIPattern.getJarEntries(uri, pattern);
if (entries != null && entries.size() > 0) {
tldMap.put(uri, entries);
}
}
}
}
use of org.glassfish.web.config.serverbeans.WebContainer in project Payara by payara.
the class ServerConfigLookup method getInstanceSessionManager.
/**
* Get the session manager bean from domain.xml
* return null if not defined or other problem
*/
public SessionManager getInstanceSessionManager() {
if (configBean == null) {
return null;
}
WebContainer webContainerBean = configBean.getExtensionByType(WebContainer.class);
if (webContainerBean == null) {
return null;
}
SessionConfig sessionConfigBean = webContainerBean.getSessionConfig();
if (sessionConfigBean == null) {
return null;
}
return sessionConfigBean.getSessionManager();
}
use of org.glassfish.web.config.serverbeans.WebContainer in project Payara by payara.
the class ServerConfigLookup method getInstanceSessionProperties.
/**
* Get the session properties bean from server.xml
* return null if not defined or other problem
*/
public SessionProperties getInstanceSessionProperties() {
if (configBean == null) {
return null;
}
WebContainer webContainerBean = configBean.getExtensionByType(WebContainer.class);
if (webContainerBean == null) {
return null;
}
SessionConfig sessionConfigBean = webContainerBean.getSessionConfig();
if (sessionConfigBean == null) {
return null;
}
return sessionConfigBean.getSessionProperties();
}
Aggregations