// TODO: Not sure that will works with JRuby.
if (!mapMultipleAdapter && mapper instanceof V3Mapper){
// Remove the MappingData as we might delegate the request
// to be serviced directly by the WebContainer
req.setNote(MAPPING_DATA, null);
Adapter a = ((V3Mapper)mapper).getAdapter();
if (a != null){
req.setNote(MAPPED_ADAPTER, a);
a.service(req, res);
return;
}
}
MessageBytes decodedURI = req.decodedURI();
decodedURI.duplicate(req.requestURI());
mappingData = (MappingData) req.getNote(MAPPING_DATA);
if (mappingData == null) {
mappingData = new MappingData();
req.setNote(MAPPING_DATA, mappingData);
}
Adapter adapter = null;
String uriEncoding = (String) grizzlyEmbeddedHttp.getProperty("uriEncoding");
HttpRequestURIDecoder.decode(decodedURI, urlDecoder, uriEncoding, null);
final CharChunk decodedURICC = decodedURI.getCharChunk();
final int semicolon = decodedURICC.indexOf(';', 0);
// Map the request without any trailling.
adapter = mapUriWithSemicolon(req, decodedURI, semicolon, mappingData);
if (adapter == null || adapter instanceof ContainerMapper) {
String ext = decodedURI.toString();
String type = "";
if (ext.indexOf(".") > 0) {
ext = "*" + ext.substring(ext.lastIndexOf("."));
type = ext.substring(ext.lastIndexOf(".") + 1);
}
if (!MimeType.contains(type) && !ext.equals("/")){
initializeFileURLPattern(ext);
mappingData.recycle();
adapter = mapUriWithSemicolon(req, decodedURI, semicolon, mappingData);
} else {
super.service(req, res);
return;
}
}
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, "Request: {0} was mapped to Adapter: {1}",
new Object[]{decodedURI.toString(), adapter});
}
// The Adapter used for servicing static pages doesn't decode the
// request by default, hence do not pass the undecoded request.
if (adapter == null || adapter instanceof ContainerMapper) {
super.service(req, res);
} else {
req.setNote(MAPPED_ADAPTER, adapter);
ContextRootInfo contextRootInfo = null;
if (mappingData.context != null && mappingData.context instanceof ContextRootInfo) {
contextRootInfo = (ContextRootInfo) mappingData.context;
}
if (contextRootInfo == null){
adapter.service(req, res);
} else {
ClassLoader cl = null;
if (contextRootInfo.getContainer() instanceof ApplicationContainer){
cl = ((ApplicationContainer)contextRootInfo.getContainer()).getClassLoader();
}