Skip to content
This repository has been archived by the owner on Dec 4, 2018. It is now read-only.

Commit

Permalink
Ensure request and response facades are used when firing application …
Browse files Browse the repository at this point in the history
…listeners.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc8.0.x/trunk@1785776 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
markt-asf committed Mar 6, 2017
1 parent 3a27ccd commit 6d73b07
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
11 changes: 5 additions & 6 deletions java/org/apache/catalina/authenticator/FormAuthenticator.java
Expand Up @@ -394,9 +394,9 @@ protected void forwardToLoginPage(Request request,
RequestDispatcher disp =
context.getServletContext().getRequestDispatcher(loginPage);
try {
if (context.fireRequestInitEvent(request)) {
if (context.fireRequestInitEvent(request.getRequest())) {
disp.forward(request.getRequest(), response);
context.fireRequestDestroyEvent(request);
context.fireRequestDestroyEvent(request.getRequest());
}
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
Expand Down Expand Up @@ -438,12 +438,11 @@ protected void forwardToErrorPage(Request request,
}

RequestDispatcher disp =
context.getServletContext().getRequestDispatcher
(config.getErrorPage());
context.getServletContext().getRequestDispatcher(config.getErrorPage());
try {
if (context.fireRequestInitEvent(request)) {
if (context.fireRequestInitEvent(request.getRequest())) {
disp.forward(request.getRequest(), response);
context.fireRequestDestroyEvent(request);
context.fireRequestDestroyEvent(request.getRequest());
}
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
Expand Down
2 changes: 1 addition & 1 deletion java/org/apache/catalina/core/AsyncContextImpl.java
Expand Up @@ -113,7 +113,7 @@ public void fireOnComplete() {
}
}
} finally {
context.fireRequestDestroyEvent(request);
context.fireRequestDestroyEvent(request.getRequest());
clearServletRequestResponse();
context.unbind(Globals.IS_SECURITY_ENABLED, oldCL);
}
Expand Down
4 changes: 2 additions & 2 deletions java/org/apache/catalina/core/StandardHostValve.java
Expand Up @@ -124,7 +124,7 @@ public final void invoke(Request request, Response response)
try {
context.bind(Globals.IS_SECURITY_ENABLED, MY_CLASSLOADER);

if (!asyncAtStart && !context.fireRequestInitEvent(request)) {
if (!asyncAtStart && !context.fireRequestInitEvent(request.getRequest())) {
// Don't fire listeners during async processing (the listener
// fired for the request that called startAsync()).
// If a request init listener throws an exception, the request
Expand Down Expand Up @@ -180,7 +180,7 @@ public final void invoke(Request request, Response response)
}

if (!request.isAsync() && !asyncAtStart) {
context.fireRequestDestroyEvent(request);
context.fireRequestDestroyEvent(request.getRequest());
}
} finally {
// Access a session (if present) to update last accessed time, based
Expand Down
4 changes: 4 additions & 0 deletions webapps/docs/changelog.xml
Expand Up @@ -113,6 +113,10 @@
session - if there is a session - when running under a
<code>SecurityManager</code>. Patch provided by Jan Engehausen. (markt)
</fix>
<fix>
Ensure request and response facades are used when firing application
listeners. (markt/remm)
</fix>
</changelog>
</subsection>
<subsection name="Coyote">
Expand Down

0 comments on commit 6d73b07

Please sign in to comment.