This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes JSF and the fly likes Redirecting to a Page outside the web project Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Redirecting to a Page outside the web project" Watch "Redirecting to a Page outside the web project" New topic
Author

Redirecting to a Page outside the web project

Gaurav Kushwaha
Greenhorn

Joined: May 20, 2009
Posts: 19
How do I redirect a JSF page to a page which is outside the web project (for eg. I have to redirect the a jsf page to a page
present in the workdir location)...... Is this possible ?
How about doing it through a JSP page ?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16158
    
  21

It would be a serious security problem if you could do that arbitrarily. I don't even want to think about the exploits that would open up.

Then again, as I like to point out, a WEB server is NOT a FILE server. The only reason any files get copied from a web app directory is that a web logic module decided to do so. So if you want to create a servlet that gets its page source from some external directory and copies it back to the requester, that's fine. Just be careful.

Note that when I say "copies", I mean just that. It's trivial to design a servlet/JSP that copies HTML, JavaScript, CSS, image or similar files to the client's response stream from any place in the server's filesystem. However, if you need processing (for example, trying to do an external JSF page file), that's a little trickier, since the default JSF servlet is expecting to find resources in its classpath (that is, inside the WAR). You'd actually have to extend the JSF servlet to handle that.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
Don't get me started about those stupid light bulbs.
 
subject: Redirecting to a Page outside the web project