This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Servlets and the fly likes sendRedirect method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "sendRedirect method" Watch "sendRedirect method" New topic
Author

sendRedirect method

Derek Nahabedian
Greenhorn

Joined: Jun 21, 2011
Posts: 3

I understand when a sendRedirect is executed, a 301 or 302 response is sent to the client, along with the desired URL. The browser then issues a new request for the desired URL.

My question is what HTTP method is generated under the hood? Get or Post?
Can a Get / Post be specified?

Thank you
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

The browser will generate a new Get request in response to your 300-sequence response. You don't have any choice about that.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61315
    
  66

And thank goodness. It's what enables the P-R-G pattern!


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Derek Nahabedian
Greenhorn

Joined: Jun 21, 2011
Posts: 3

Thank you both - I am reading up on the PRG pattern.
 
Consider Paul's rocket mass heater.
 
subject: sendRedirect method