File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using forward or include in a filter

 
Faisal Khan
Ranch Hand
Posts: 285
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have come across some security access filters which are using request.getRequestDispatcher(...).forward() and .include() from within the filter. If the user is not authorised, they get forwarded to an error page from within the filter.

Does this seem an acceptable technique to use or should we consider other options such as writing the html page from the filter?

The .include() is being used in one place to call in a servlet that does a bunch of checks and being used for other things too.

Regards

Faisal
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Forwarding from a filter is fine.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64185
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Writing HTML in it is not.
 
Faisal Khan
Ranch Hand
Posts: 285
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just to clarify guys, technique explained in the following article is not good way to go then:
http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Servlets8.html#103101

Any views on using the .include()?

Thanks for the feedback thus far.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic