• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

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: 67753
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.
 
Sheriff
Posts: 28368
99
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: 67753
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.
 
The overall mission is to change the world. When you've done that, then you can read this tiny ad:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic