SEC-790: DefaultLoginPageGeneratingFilter should be a better HTTP citizen

http://jira.springframework.org/browse/SEC-790. Applied submitted patch.
This commit is contained in:
Luke Taylor 2008-04-23 00:41:52 +00:00
parent 8ea7487ec3
commit 7e63fe7357
1 changed files with 7 additions and 3 deletions

View File

@ -23,6 +23,7 @@ import org.springframework.security.ui.rememberme.AbstractRememberMeServices;
*
* @author Luke Taylor
* @version $Id$
* @since 2.0
*/
public class DefaultLoginPageGeneratingFilter extends SpringSecurityFilter {
public static final String DEFAULT_LOGIN_PAGE_URL = "/spring_security_login";
@ -71,11 +72,14 @@ public class DefaultLoginPageGeneratingFilter extends SpringSecurityFilter {
}
}
}
protected void doFilterHttp(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException {
if (isLoginUrlRequest(request)) {
response.getOutputStream().print(generateLoginPageHtml(request));
String loginPageHtml = generateLoginPageHtml(request);
response.setCharacterEncoding("UTF-8");
response.setContentType("text/html");
response.setContentLength(loginPageHtml.length());
response.getOutputStream().print(loginPageHtml);
return;
}