aspose file tools*
The moose likes Servlets and the fly likes Problem while forwarding Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Problem while forwarding " Watch "Problem while forwarding " New topic
Author

Problem while forwarding

Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

Hey folks,
Im trying to implement role based user access in a system that Im building .Im plugged in some code into a filter that maps across all the secure pages , which is helping me do so.I just check whether a user has the required role to access a particular page , if not I redirect the person to a home page . However in pages , where Im already forwarding through a servlet during page load , I get an error saying that the response has already been committed.
Any ideas on how I could circumvent this ?

Learning and Learning!-- Java all the way!
amit punekar
Ranch Hand

Joined: May 14, 2004
Posts: 512
Hello,
This happens when you are trying to use the Response stream that has already been comitted.
For e.g when you are doing response.redirect(new html) , you should not have committed the response while doing this.
HttpServletResponse API will tell you which all methods if invoked on Response object commits the response.

Regards,
Amit
Shailesh Narkhede
Ranch Hand

Joined: Jul 10, 2008
Posts: 368
Thing you are going to implement is given by server implementation, just need to change some XML file according to server, you can use it for your requirment.
Which server you are using ?



Thanks,
Shailesh
Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

Apache Tomcat.
@amit , I really didnt get your answer.
amit punekar
Ranch Hand

Joined: May 14, 2004
Posts: 512
Hello,
Please check this.

regards,
amit
Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

Thanks!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem while forwarding