// START IASRI 4665318
void service(ServletRequest request, ServletResponse response,
Servlet serv, RequestFacade requestFacade)
throws IOException, ServletException {
InstanceSupport supp = getInstanceSupport();
try {
supp.fireInstanceEvent(BEFORE_SERVICE_EVENT,
serv, request, response);
if (!isAsyncSupported()) {
requestFacade.disableAsyncSupport();
}
if ((request instanceof HttpServletRequest) &&
(response instanceof HttpServletResponse)) {
if ( SecurityUtil.executeUnderSubjectDoAs() ){
final ServletRequest req = request;
final ServletResponse res = response;
Principal principal =
((HttpServletRequest) req).getUserPrincipal();
Object[] serviceType = new Object[2];
serviceType[0] = req;
serviceType[1] = res;
SecurityUtil.doAsPrivilege("service",
serv,
classTypeUsedInService,
serviceType,
principal);
serviceType = null;
} else {
serv.service((HttpServletRequest) request,
(HttpServletResponse) response);
}
} else {
serv.service(request, response);
}
supp.fireInstanceEvent(AFTER_SERVICE_EVENT,
serv, request, response);
} catch (IOException e) {
// Set response status before firing event, see IT 10022
if (response instanceof HttpServletResponse) {
((HttpServletResponse)response).setStatus(
HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
}
supp.fireInstanceEvent(AFTER_SERVICE_EVENT,
serv, request, response, e);
throw e;
} catch (ServletException e) {
// Set response status before firing event, see IT 10022
if (response instanceof HttpServletResponse) {
((HttpServletResponse)response).setStatus(
HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
}
supp.fireInstanceEvent(AFTER_SERVICE_EVENT,
serv, request, response, e);
throw e;
} catch (RuntimeException e) {
// Set response status before firing event, see IT 10022
if (response instanceof HttpServletResponse) {
((HttpServletResponse)response).setStatus(
HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
}
supp.fireInstanceEvent(AFTER_SERVICE_EVENT,
serv, request, response, e);
throw e;
} catch (Error e) {
// Set response status before firing event, see IT 10022
if (response instanceof HttpServletResponse) {
((HttpServletResponse)response).setStatus(
HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
}
supp.fireInstanceEvent(AFTER_SERVICE_EVENT,
serv, request, response, e);
throw e;
} catch (Throwable e) {
// Set response status before firing event, see IT 10022
if (response instanceof HttpServletResponse) {
((HttpServletResponse)response).setStatus(
HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
}
supp.fireInstanceEvent(AFTER_SERVICE_EVENT,
serv, request, response, e);
throw new ServletException
(sm.getString("filterChain.servlet"), e);
}