use of org.glassfish.internal.grizzly.V3Mapper in project Payara by payara.
the class GlassfishNetworkListener method configureHttpProtocol.
@Override
protected void configureHttpProtocol(final ServiceLocator habitat, final NetworkListener networkListener, final Http http, final FilterChainBuilder filterChainBuilder, boolean securityEnabled) {
if (httpAdapter == null) {
registerMonitoringStatsProviders();
final V3Mapper mapper = new V3Mapper(logger);
mapper.setPort(port);
mapper.setId(name);
final ContainerMapper containerMapper = new ContainerMapper(grizzlyService, this);
containerMapper.setMapper(mapper);
containerMapper.setDefaultHost(http.getDefaultVirtualServer());
containerMapper.setRequestURIEncoding(http.getUriEncoding());
containerMapper.configureMapper();
VirtualServer vs = null;
String webAppRootPath = null;
final Collection<VirtualServer> list = grizzlyService.getHabitat().getAllServices(VirtualServer.class);
final String vsName = http.getDefaultVirtualServer();
for (final VirtualServer virtualServer : list) {
if (virtualServer.getId().equals(vsName)) {
vs = virtualServer;
webAppRootPath = vs.getDocroot();
if (!grizzlyService.hasMapperUpdateListener() && vs.getProperty() != null && !vs.getProperty().isEmpty()) {
for (final Property p : vs.getProperty()) {
final String propertyName = p.getName();
if (propertyName.startsWith("alternatedocroot")) {
String value = p.getValue();
String[] mapping = value.split(" ");
if (mapping.length != 2) {
logger.log(Level.WARNING, "Invalid alternate_docroot {0}", value);
continue;
}
String docBase = mapping[1].substring("dir=".length());
String urlPattern = mapping[0].substring("from=".length());
containerMapper.addAlternateDocBase(urlPattern, docBase);
}
}
}
break;
}
}
httpAdapter = new HttpAdapterImpl(vs, containerMapper, webAppRootPath);
containerMapper.addDocRoot(webAppRootPath);
AbstractActiveDescriptor<V3Mapper> aad = BuilderHelper.createConstantDescriptor(mapper);
aad.addContractType(Mapper.class);
aad.setName(address.toString() + port);
ServiceLocatorUtilities.addOneDescriptor(grizzlyService.getHabitat(), aad);
super.configureHttpProtocol(habitat, networkListener, http, filterChainBuilder, securityEnabled);
final Protocol protocol = http.getParent();
for (NetworkListener listener : protocol.findNetworkListeners()) {
grizzlyService.notifyMapperUpdateListeners(listener, mapper);
}
} else {
super.configureHttpProtocol(habitat, networkListener, http, filterChainBuilder, securityEnabled);
}
}
use of org.glassfish.internal.grizzly.V3Mapper in project Payara by payara.
the class WebConnector method initialize.
@Override
public void initialize() throws LifecycleException {
V3Mapper v3Mapper = null;
if (mapper == null) {
v3Mapper = new V3Mapper();
mapper = v3Mapper;
}
super.initialize();
if (v3Mapper != null) {
v3Mapper.setHttpHandler(getHandler());
} else if (mapper instanceof V3Mapper) {
((V3Mapper) mapper).setHttpHandler(getHandler());
}
}
Aggregations