use of org.glassfish.api.container.Sniffer in project Payara by payara.
the class ApplicationLifecycle method getSniffersFromApp.
@Override
public List<Sniffer> getSniffersFromApp(Application app) {
List<String> snifferTypes = new ArrayList<String>();
for (com.sun.enterprise.config.serverbeans.Module module : app.getModule()) {
for (Engine engine : module.getEngines()) {
snifferTypes.add(engine.getSniffer());
}
}
if (snifferTypes.isEmpty()) {
// domain.xml, so we need to re-process it during deployment
return null;
}
List<Sniffer> sniffers = new ArrayList<Sniffer>();
if (app.isStandaloneModule()) {
for (String snifferType : snifferTypes) {
Sniffer sniffer = snifferManager.getSniffer(snifferType);
if (sniffer != null) {
sniffers.add(sniffer);
} else {
logger.log(Level.SEVERE, KernelLoggerInfo.cantFindSniffer, snifferType);
}
}
if (sniffers.isEmpty()) {
logger.log(Level.SEVERE, KernelLoggerInfo.cantFindSnifferForApp, app.getName());
return null;
}
} else {
// composite application.
return null;
}
return sniffers;
}
use of org.glassfish.api.container.Sniffer in project Payara by payara.
the class ContainerMapper method initializeFileURLPattern.
private void initializeFileURLPattern(String ext) {
for (Sniffer sniffer : grizzlyService.getHabitat().<Sniffer>getAllServices(Sniffer.class)) {
boolean match = false;
if (sniffer.getURLPatterns() != null) {
for (String pattern : sniffer.getURLPatterns()) {
if (pattern.equalsIgnoreCase(ext)) {
match = true;
break;
}
}
HttpHandler httpHandler;
if (match) {
httpHandler = grizzlyService.getHabitat().getService(SnifferAdapter.class);
((SnifferAdapter) httpHandler).initialize(sniffer, this);
ContextRootInfo c = new ContextRootInfo(httpHandler, null);
mapperLock.readLock().unlock();
mapperLock.writeLock().lock();
try {
for (String pattern : sniffer.getURLPatterns()) {
for (String host : grizzlyService.hosts) {
mapper.addWrapper(host, ROOT, pattern, c, "*.jsp".equals(pattern) || "*.jspx".equals(pattern));
}
}
} finally {
mapperLock.readLock().lock();
mapperLock.writeLock().unlock();
}
return;
}
}
}
}
Aggregations