These are just the redesign changes related to how the user is redirected after logging in. This has no bearing on why the response has committed. That has nothing to do with "modifying the request in a filter".
Hello Luke.
I think that that the user case presented by cirorezende was exactly the some that I exposed.
And I got exactly the some error when I try something like him, by example using the:
when extending SimpleUrlAuthenticationSuccessHandler.Code:MyTargetUrl = "/xxx.html" getRedirectStrategy().sendRedirect(request, response, MyTargetUrl);
But if there is a better way to obtain the desired result...
You said
The exception comes from a call to response.sendRedirect(). If you check the servlet spec or Javadoc (or as above, the Tomcat source) you will see that this raises an IllegalStateException "If the response has already been committed".That state illegal exception appear in my opinion from the some reason that we can't modify the request in a filter, without a wrapper.
So the issue is not related to accessing the request object.
Hi guys,
I get the same error with tomcat, but that works when I use jetty.
Any update on that stuff?
Thanks.
If you are getting the same error - i.e. because the response is committed - then you'll need to debug the difference between the two containers to work out why one thinks it has and the other doesn't. It could be due to differences in response buffering or something. But it is a normal issue when dealing with the serlvet API - it isn't a Spring Security question.
So, why with the same container, that works with Spring Security 2, but that doesn't with Spring Security 3?
I don't know. Only you have access to your application so you'll have to work out at what point the response is committed and why. That happens before the redirect is called, once the server starts writing the output back to the client, so you have to use a debugger and track the response throughout the request.
I get the same error in the same situation on TC 5 with SS 3.0. In the onAuthenticationSuccess method of the SimpleUrlAuthenticationSuccessHandler class,
The exception no longer occurs after removing the invoking the same method in its super class and getting out the method, that is "return", right after invoking the sendRedirect.Code:public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { super.onAuthenticationSuccess(request, response, authentication); ... }
Last edited by vw729; Sep 16th, 2010 at 06:33 PM.
[URL="http://vicina.info"] 新闻,社区新闻,分类广告