Processes the given request by passing it to the ad-hoc servlet
associated with the request path (which has been determined, by the
associated web module, to be an ad-hoc path).
HttpServletRequest hreq = (HttpServletRequest) request.getRequest();
HttpServletResponse hres = (HttpServletResponse) response.getResponse();
String adHocServletName =
context.getAdHocServletName(hreq.getServletPath());
Wrapper adHocWrapper = (Wrapper) context.findChild(adHocServletName);
if (adHocWrapper != null) {
Servlet adHocServlet = null;
try {
adHocServlet = adHocWrapper.allocate();
adHocServlet.service(hreq, hres);
} catch (Throwable t) {
hres.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
String msg = LOGGER.getResourceBundle().getString(
"webmodule.adHocContextValve.adHocServletServiceError");
msg = MessageFormat.format(
msg,
new Object[] { hreq.getServletPath() });
response.setDetailMessage(msg);
return END_PIPELINE;
} finally {
if (adHocServlet != null) {
adHocWrapper.deallocate(adHocServlet);
}
}
} else {
hres.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
String msg = LOGGER.getResourceBundle().getString(
"webmodule.adHocContextValve.noAdHocServlet");
msg = MessageFormat.format(
msg,
new Object[] { hreq.getServletPath() });
response.setDetailMessage(msg);
return END_PIPELINE;
}
return END_PIPELINE;