Bookmark Topic Watch Topic
  • New Topic

Java Strangeness...

 
Scott Batchelor
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Report post to moderator
Ok here is a scenario I am seeing. I am debugging my app and I am using this block of code to do a redirect:
try {
response.sendRedirect(url);
LOG.debug("Redirect URL = " + url);
} catch (IOException e) {
//
}
When I step throught his code it actually hit the line: response.sendRedirect(url);
And the url variable is correct in the logs.
But it doesnt send the app anywhere just continues on.
Any thoughts.
I hope this isnt to vague but I am stumped as to what could be causing this.
Scott
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
The app [servlet, yes?] "continues on" because you're allowing it to; you have to actually return from the method that calls sendRedirect() before the redirect happens.
 
Scott Batchelor
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Report post to moderator
I am sorry I should have been more clear. Here is the code that call the method to do the redirect.
if (blah, blah, blah){

this.redirectToPublicPeoplesoft(request, response);
return;
}
So it does hit a return but really doesnt do anything.
Thanks in advance.
SB
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65120
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
This question was posted twice; accidentally I am sure. Please make any further comments on the other instance (and could a bartender close this one?).
thanks,
bear
 
    Bookmark Topic Watch Topic
  • New Topic