• 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

response.senRedirect does not seem to be working in filter

 
Ranch Hand
Posts: 1374
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Code snippet from RequestFilter



Now, the interesting part, Please see the attached file.

Now, what happens when my session expires (due to inactivity) and I click on any of the tabs , it opens up the login page into that 'Main body part'. But I am actually redirecting the request, should not it change the browser URL and load the login page?
JSP_Setup.JPG
[Thumbnail for JSP_Setup.JPG]
JSP setup
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What leads you to believe that the right conditional part is being executed?
 
Vikas Kapoor
Ranch Hand
Posts: 1374
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Because I can see my login page into that Right conditional Part (which I referred as Main Body Part) as well as I can see from the log that it goes into that if condition and prints logger statement.
 
Marshal
Posts: 28225
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There's something about "Ajax" in that image you posted. If you see the login page appearing inside a frame in your browser, then that means that the request for the login page came from that frame.
 
Vikas Kapoor
Ranch Hand
Posts: 1374
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:There's something about "Ajax" in that image you posted. If you see the login page appearing inside a frame in your browser, then that means that the request for the login page came from that frame.



That images shows the JSP staructure. We have used AJAX there. When you click on any tab/link link on left portion of JSP , it updates (through AJAX) the right side portion of the JSP. Now I have implemented filter to make sure that when user session expires due to inactivity, and then user click on some link, she should be taken to login page. That happens right now. But rather doing *sendRedirect* it just loads the login page in that right side portion of the page. If you see my filter code, I have written sendRedirect and logs on server confirms that it goes into that method.
 
Vikas Kapoor
Ranch Hand
Posts: 1374
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok, nowadays AJAX is used in almost every app. Do you use that?
How do you manage if session expires automatically? Do you redirects to login page?
If you use ajax and do redirect then how did you implement that? (any way other than the way have implemnted?)
 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I use lots and lots of Ajax. Whenever the authentication filter detects that the user requires authentication, it returns a custom status code in the response (555 to be exact). The client detects this status code and initiates the login protocol.

This is incredibly easy to implement if you are using something like jQuery to do your Ajax, as you can establish a global event handler for all Ajax errors rather than testing it each and every time.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic