• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

sendRedirect(singlesignon)

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

 
Would you like to try a free sample? Today we are featuring tiny ads:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic