• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

response.sendRedirect

 
Miran Cvenkel
Ranch Hand
Posts: 196
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The point beeing, I renamed a.jsp to b.jsp, and want google to find it anyway.

in jsp



in JspStart



1. If I said redirect, why there must be return after that ? (othervise programm goes down executing things)
2. The first redirect that occurs in that manner --> java emidiately starts eating 100% CPU and it does not let go, luckely multicore processor, so it does not hang ?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64620
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. If you are going to redirect, it doesn't make any sense to continue emitting output that will never be seen.

2. Use a profiler tool to find out where your performance issue is.
 
Paul Clapham
Sheriff
Pie
Posts: 20739
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. It's a basic rule of the Java language. Statements are executed one after the other. So when control returns from the sendRedirect() method, it continues on to the next statement.
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The first redirect that occurs in that manner --> java emidiately starts eating 100% CPU and it does not let go, luckely multicore processor, so it does not hang ?


It is only a matter of time before all cores are consumed.

It looks like what you want is to rather send a HTTP 301 / 302 response status code ? Have you looked into that ?
 
Miran Cvenkel
Ranch Hand
Posts: 196
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so if I go with last advice:

example: http://agrozoo.net/jsp/Tools.jsp?p0=Thesaurus&p3=67008d1cb23311df864f001cc081f832
is redirected to new adress with this code:



it works but this tester http://www.webconfs.com/redirect-check.php says it is not OK.
Is it bad tester or I'm doing something wrong ?

 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Miran Cvenkel wrote:so if I go with last advice:

example: http://agrozoo.net/jsp/Tools.jsp?p0=Thesaurus&p3=67008d1cb23311df864f001cc081f832
is redirected to new adress with this code:



it works but this tester http://www.webconfs.com/redirect-check.php says it is not OK.
Is it bad tester or I'm doing something wrong ?



The tester probably tries to use your relative URL in the Location header and fails. SEO wise, I am not sure if that is good or bad. You can research that and make a decision.
 
Miran Cvenkel
Ranch Hand
Posts: 196
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Missing return, now tester is happy. Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic