• 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

Clearing cache and getting request 's properties in webbrowser

 
Ranch Hand
Posts: 129
1
Oracle Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
Is there a good way to clear web browser's cache, history through JavaScript ? And also how can I fetch the parameters in the request Object like Header , JSessionID etc
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JavaScript isn't allowed to change browser settings. Which would rule out clearing the cache and history. Imagine if I tricked you into going to a malicious website and it deleted your history. Annoying isn't it!

Similarly, JavaScript can't access the request object. The request object is a server construct. By the time JavaScript runs, it is long gone.
 
Sheriff
Posts: 67746
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
Why would it feel it necessary to wipe out the history or cache?

With regards to the request; if what you are after are the request parameters, and the request is a GET where the params are part of the URL, you can get the entire request URL with window.location.href. But you'll need to parse out the request parameters yourself (or find a plugin to do it).

Or is what you are actually after the headers? It's hard to tell what you are after from your post.
 
karthik Suryanarayanan
Ranch Hand
Posts: 129
1
Oracle Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bear and Jeanne. Let me explain my problem. I have a website wherein when someone hits the URL , the request is passed on to the server and from the server , redirects to my authentication page. Sometimes when the request is passed on to the server , during redirection to my authentication page , some old history or cache is coming and it invalidates my session and hence my session object is not created. How do i avoid this. I am using weblogic 10.3.
 
karthik Suryanarayanan
Ranch Hand
Posts: 129
1
Oracle Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bear,
And it's really nice to have a chat with you after so long.
 
Bear Bibeault
Sheriff
Posts: 67746
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

karthik Suryanarayanan wrote:some old history or cache is coming and it invalidates my session and hence my session object is not created.


I'm not getting how history or cache can invalidate your session. Please explain why you have come to this conclusion.
 
karthik Suryanarayanan
Ranch Hand
Posts: 129
1
Oracle Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bear,
We are using Java Page Flow framework . As per the JPF framework, we are creating the HttpSession in the begin() method. Then we are setting a unique ID using setAttribute for that session. Then my request redirects to the preauth jsp page where I open a new window and set the below attributes for the authentication page and redirect to my authentication page.



When I try to submit my authentication page after entering the credentials , in my JPF Controller I'm validating the unique ID which i have already set in the begin() method.

Sometimes(out of 100% , 5 % it is failing), I am not able to get the unique ID (that i have set in the session) and my session Object is coming as null.

My Controller JPF class



Also, please note I'm creating the session in the begin method only and nowhere I'm modifying the session object.

After clearing the browser cache and session , it is working correctly.

So I thought of clearing the browser cache / history in some way!!!


 
author
Posts: 297
5
Android Firefox Browser Fedora
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Or just set your HTTP headers correctly so the authentication page isn't cached in the first place?
 
What are you saying? I thought you said that Santa gave you that. And this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic