• 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

why we need send redirect?

 
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I know what send redirect means, it is used to redirect the request to some other resource. One more thing is client can see the different URL on browser.

What I want to know is, why we need this? In which situation we can use send redirect?

Can't we use forward in all situation, I suppose, it is always better to hide such thing from client.

Please comments.
Thanks.
[ November 08, 2005: Message edited by: rathi ji ]
 
Ranch Hand
Posts: 783
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi rathi ,

sendRedirect must be used when redirecting to a page outside the current context. for instance, I could not forward a request from my domain to a page inside www.javaranch.com.

Also, you should use sendRedirect when you want to ensure that the url is exposed to the user. For instance, if the client needs the ability to bookmark the page, you should use sendRedirect.

Also, when switching protocalls, like from http to https, I believe you need to use a sendRedirect as well.
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If i want something in my application should be handaled by some other web-application may be built by somebody else, for which i am not responsible in those cases I should use send redirect.
For example say my application wants currency coversion from USD to EURO then calling the yahoo finance with my currency amount may solve my problem
using send redirect.
[ October 21, 2005: Message edited by: subho saha ]
 
ankur rathi
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot Paul and Subho.

Paul, I think you are prepared to strike SCWCD. All the best.

 
Paul Bourdeaux
Ranch Hand
Posts: 783
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Paul, I think you are prepared to strike SCWCD. All the best.
thanks rathi! I've been "preparing" for a while, but right when I was ready to take it, I change jobs and moved across country... so I've been putting it off. I need to get my butt in gear again though!
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's also a way to make the browser to a GET. The POST-redirect-GET pattern has the browser POST an update then GET a fresh view of the changed data. The user can bookmark the view page or refresh it without repeating the POST. I think this is more consistent with the REST view of web architecture; POST should update the resource and GET should show it to you.
 
Tick check! Okay, I guess that was just an itch. Oh wait! Just a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic