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

Servlet Chaining in an Application Server

Chris Mooring
Greenhorn

Joined: May 23, 2001
Posts: 10
Hi,
I am trying to set up a servlet chain within an application server (Websphere). Basically I want to be able to set up a chain that will pass the request through an Authorisation servlet of mine and then if successfull pass the request onto the second servlet in the chain. HOwever, if Authorisation fails, then I don't want the request to continue onto the second servlet in the chain.
I have already played around with it a little and I can get the chaining part working, but I can't the chain if the Authorisation fails in the first servlet. If Authorisation fails, then it displays some HTML output saying "Not logged on" or "Unauthorised access" but then goes onto the second servlet and displays the information anyway. I have tried using a return statement as well as System.exit(1) and System.exit(0) however these done work. In fact the System.exits stop the App Server completely !
Has anyone out there had similar experiences ? Can anyone shed some light on this issue ? Is it actually possible to break the chain at all ?
Regards,
Chris
Valery Anciaux
Ranch Hand

Joined: May 14, 2001
Posts: 45
I'm not sure I understand exactly your problem...
Why don't you manage the redirection in your Autorization servlet ?
You'd have something like that :
if (authorized)
{
res.sendRedirect("OKServlet");
return;
}
else
{
res.forward("anHTMLErrorPage");
return;
}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet Chaining in an Application Server