• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Possible to change status code sent by response.sendRedirect

 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm using Tomcat 6.0.26 (Java 1.6). By default, the "response.sendRedirect" method sends a 302 (Moved Temporarily) status code to the client. Is it possible to set the default behavior to have this command send a "301" (Moved Permanently) instead, or do I just need to avoid using response.sendRedirect altogether?

Thanks, - Dave
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65122
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No "by default" about it. That's what a redirect is. If you don't want a redirect, don't use sendRedirect(). You can set the response headers as you wish using the other methods.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65122
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not Tomcat-specific, so moved to the Servlets forum.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic