Skip to content

Commit 0f7b946

Browse files
committed
Ensure request and response facades are used when firing application listeners.
git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc8.5.x/trunk@1785775 13f79535-47bb-0310-9956-ffa450edef68
1 parent 6188cf7 commit 0f7b946

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

java/org/apache/catalina/authenticator/FormAuthenticator.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -427,9 +427,9 @@ protected void forwardToLoginPage(Request request,
427427
RequestDispatcher disp =
428428
context.getServletContext().getRequestDispatcher(loginPage);
429429
try {
430-
if (context.fireRequestInitEvent(request)) {
430+
if (context.fireRequestInitEvent(request.getRequest())) {
431431
disp.forward(request.getRequest(), response);
432-
context.fireRequestDestroyEvent(request);
432+
context.fireRequestDestroyEvent(request.getRequest());
433433
}
434434
} catch (Throwable t) {
435435
ExceptionUtils.handleThrowable(t);
@@ -471,12 +471,11 @@ protected void forwardToErrorPage(Request request,
471471
}
472472

473473
RequestDispatcher disp =
474-
context.getServletContext().getRequestDispatcher
475-
(config.getErrorPage());
474+
context.getServletContext().getRequestDispatcher(config.getErrorPage());
476475
try {
477-
if (context.fireRequestInitEvent(request)) {
476+
if (context.fireRequestInitEvent(request.getRequest())) {
478477
disp.forward(request.getRequest(), response);
479-
context.fireRequestDestroyEvent(request);
478+
context.fireRequestDestroyEvent(request.getRequest());
480479
}
481480
} catch (Throwable t) {
482481
ExceptionUtils.handleThrowable(t);

java/org/apache/catalina/core/AsyncContextImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public void fireOnComplete() {
112112
}
113113
}
114114
} finally {
115-
context.fireRequestDestroyEvent(request);
115+
context.fireRequestDestroyEvent(request.getRequest());
116116
clearServletRequestResponse();
117117
context.unbind(Globals.IS_SECURITY_ENABLED, oldCL);
118118
}

java/org/apache/catalina/core/StandardHostValve.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public final void invoke(Request request, Response response)
123123
try {
124124
context.bind(Globals.IS_SECURITY_ENABLED, MY_CLASSLOADER);
125125

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

181181
if (!request.isAsync() && !asyncAtStart) {
182-
context.fireRequestDestroyEvent(request);
182+
context.fireRequestDestroyEvent(request.getRequest());
183183
}
184184
} finally {
185185
// Access a session (if present) to update last accessed time, based

webapps/docs/changelog.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@
157157
session - if there is a session - when running under a
158158
<code>SecurityManager</code>. Patch provided by Jan Engehausen. (markt)
159159
</fix>
160+
<fix>
161+
Ensure request and response facades are used when firing application
162+
listeners. (markt/remm)
163+
</fix>
160164
</changelog>
161165
</subsection>
162166
<subsection name="Coyote">

0 commit comments

Comments
 (0)