This discussion is archived
6 Replies Latest reply: Jun 28, 2011 12:20 AM by gimbal2 RSS

Cannot forward after response has been committed

822899 Newbie
Currently Being Moderated
hi everybody,


first of all thank you for your help!!

SO, i am struggling with a exception generated when, I try to forward a redirect to a page i get the next exception, i know it can be caused, cus there other redirect performed.

java.lang.IllegalStateException: Cannot forward after response has been committed
     controller.ControllerServlet.doPost(ControllerServlet.java:92)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
     org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)

my application tries to connect with a Openid service provider to authenticate using openid4java lib it works as follow:

my servlet receive the request from a form, after the servelet take the parameters (Open Id identifier), after i generate the discovery, association, authetication, process and when i perfomr the redirect or forward i get the exception above mentioned.

i have use the next option to do the redirect

resp.sendRedirect(authRequest.getDestinationUrl(true));
or

req.getRequestDispatcher(authRequest.getDestinationUrl(true)).include(req, resp);
or

req.getRequestDispatcher(authRequest.getDestinationUrl(true)).forward(req, resp);

any ideas to know what is happening?

thanks in advanced

regards!!

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points