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

sendRedirect(singlesignon)

raj guntupalli
Greenhorn

Joined: Dec 16, 2002
Posts: 27
I will be getting a request from a secured site like https://www.x.com?id=12&value=1234.
I have written a servlet to map the keys id and value to different values
and formed a query string like id1=12&value1=1234.
Then I have to post the data to another servlet which accepts this id1 and value1.I have done it using sendRedirect.This servlet does the client verification etc and calls another servlet which creates a session and my servlet has to recieve the session ID and pass it back to the client(Single signon)
My quetion is
1)Is it safe to use sendRedirect and is there any other way to post the data to that servlet.
2)How will make my servlet receive the session Id.Do the servlet which handles the session has to post the session Id back to me.
Thanx
Steve Leach
Ranch Hand

Joined: Sep 24, 2003
Posts: 46
sendRedirect tells the user's web browser to request a different page. Your servlet then has nothing more to do with it. There is no way you can get at the results of that request.
If you want your servlet to log onto another web site on behalf of a user then it will need to act as if it was a web browser. You could investigate the Apache httpclient package for that.
Single sign-on (involving multiple sites) is quite a complex issue, and there really no easy solution.
Gayan Balasooriya
Ranch Hand

Joined: Jul 31, 2002
Posts: 51
You can use javax.servlet.RequestDispatcher to add parameters to the request
and forwad it to another servlet for processing.
Ex:
// Set attributes
req.setAttribute("id1", new Integer(12));
// Get dispatcher with a relative URL
RequestDispatcher dis = req.getRequestDispatcher("../AnotherServlet");
// or forward
dis.forward(req, res);
Gayan Balasooriya
SCJP,SCWCD
http://www.gayanb.com - Free Java/J2EE/J2ME books and mock exams


SCJP, SCWCD
istiaque shaikh
Greenhorn

Joined: Oct 21, 2003
Posts: 2
Use RequestDispatcher instead, for example http://www.ideas2work.com

Originally posted by raj guntupalli:
I will be getting a request from a secured site like https://www.x.com?id=12&value=1234.
I have written a servlet to map the keys id and value to different values
and formed a query string like id1=12&value1=1234.
Then I have to post the data to another servlet which accepts this id1 and value1.I have done it using sendRedirect.This servlet does the client verification etc and calls another servlet which creates a session and my servlet has to recieve the session ID and pass it back to the client(Single signon)
My quetion is
1)Is it safe to use sendRedirect and is there any other way to post the data to that servlet.
2)How will make my servlet receive the session Id.Do the servlet which handles the session has to post the session Id back to me.
Thanx
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: sendRedirect(singlesignon)