Author: kkolinko Date: Thu Oct 20 10:18:40 2011 New Revision: 1186712 URL: http://svn.apache.org/viewvc?rev=1186712&view=rev Log: https://issues.apache.org/bugzilla/show_bug.cgi?id=51940#c9 Restore original method name when forward to the login page returns
Modified: tomcat/trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java Modified: tomcat/trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java?rev=1186712&r1=1186711&r2=1186712&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java (original) +++ tomcat/trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java Thu Oct 20 10:18:40 2011 @@ -391,9 +391,6 @@ public class FormAuthenticator config.getLoginPage(), context.getName())); } - // Always use GET for the login page, regardless of the method used - request.getCoyoteRequest().method().setString("GET"); - String loginPage = config.getLoginPage(); if (loginPage == null || loginPage.length() == 0) { String msg = sm.getString("formAuthenticator.noLoginPage", @@ -404,6 +401,10 @@ public class FormAuthenticator return; } + // Always use GET for the login page, regardless of the method used + String oldMethod = request.getMethod(); + request.getCoyoteRequest().method().setString("GET"); + RequestDispatcher disp = context.getServletContext().getRequestDispatcher(loginPage); try { @@ -418,6 +419,9 @@ public class FormAuthenticator request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, t); response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg); + } finally { + // Restore original method so that it is written into access log + request.getCoyoteRequest().method().setString(oldMethod); } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org