I ran into this problem yesterday and haven't been able to find a solution to it.
Once a user logs out how do I prevent them from hitting the back button and loading the cached, previous page?
I ran into this post and read the suggested article, but I'm unsure if any of these suggestions are the correct way to handle this problem.
I even ran the sample apps from Play! notably the Forms app and it has the same problem. I thought their apps would at least show how to handle this.
Any help would be appreciated. Thanks.
You can disable the cache in the response's header (no-cache or must revalidate) for every page that needs to check the credentials.
Related
I am trying to automate a login page which appears to be using Knockout.js.
HtmlUnit doesnt seem to load the full page, it is missing all the input fields which makes it impossible to actually login.
I have tried ensuring that the JavaScript timeouts are set and have also enabled NicelyResynchronizingAjaxController I am waiting after the page has loaded using:
waitForBackgroundJavaScript,
waitForBackgroundJavaScriptStartingBefore
Thread.sleep (just for
good measure)
I have even checked for additional windows (WebClient.getWebWindows), but there just seems to be the one.
It appears Knockout (assuming it is actually Knockout) is creating the inputs, is this just too much for htmlunit or have I missed something?
This is a know problem (see https://github.com/HtmlUnit/htmlunit/issues/37).
Hopefully i will find some time to figure out what is going wrong here.
I am totally confused over the twitter4j API and I think I could really use your help.
I am trying to build a desktop twitter client in java using the twitter4j API but somehow I am forced to used the OAuth method no matter what.
In the simplest of scenarios I only want my user to be able to login dynamically (like in tweekdeck) and post a tweet. However, using OAuth authentication my user will be forced to go through a number of steps to retrieve his tokens for no apparent reason.
To put it simply, I don't remember doing any of these when using tweekdeck for example. How can I go around this?
Thanks in advance.
Hey I am working on the same thing right now.
My solution : embed a browser and do the authentification from there.
I am using javafx which has a browser that is already ready, and I go through the whole thing like that, I don't think you will find a better solution.
I am trying to download the contents of a site. The site is a magneto site where one can filter results by selecting properties on the sidebar. See zennioptical.com for a good example.
I am trying to download the contents of a site. So if we are using zennioptical.com as an example i need to download all the rectangular glasses. Or all the plastic etc..
So how do is send a request to the server to display only the rectangular frames etc?
Thanks so much
You basic answer is you need to do a HTTP GET request with the correct query params. Not totally sure how you are trying to do this based on your question, so here are two options.
If you are trying to do this from javascript you can look at this question. It has a bunch of answers that show how to perform AJAX GETs with the built in XMLHttpRequest or with jQuery.
If you are trying to download the page from a java application, this really doesn't involve AJAX at all. You'll still need to do a GET request but now you can look at this other question for some ideas.
Whether you are using javascript or java, the hard part is going to be figuring out the right URLs to query. If you are trying to scrape someone else's site you will have to see what URLs your browser is requesting when you filter the results. One of the easiest ways to see that info is in Firefox with the Web Console found at Tools->Web Developer->Web Console. You could also download something like Wireshark which is a good tool to have around, but probably overkill for what you need.
EDIT
For example, when I clicked the "rectangle frames" option at zenni optical, this is the query that fired off in the Web Console:
[16:34:06.976] GET http://www.zennioptical.com/?prescription_type=single&frm_shape%5B%5D=724&nav_cat_id=2&isAjax=true&makeAjaxSearch=true [HTTP/1.1 200 OK 2328ms]
You'll have to do a sufficient number of these to figure out how to generate the URLs to get the results you want.
DISCLAIMER
If you are downloading someone's else data, it would be best to check with them first. The owner of the server may not appreciate what they might consider stealing their data/work. And then depending on how you use the data you pull down, you could be venturing into all sorts of ethical issues... Then again, if you are downloading from your own site, go for it.
Is there any script or code that solves this problem?
Simply I have an image player in my web site which does not work in IE9. I know there is a solution (Java Applet Not Working (Blank) in IE9) which remove the problem, but if a user have not sufficient knowledge of how Windows works, or the web site is just play on outdoor screens, it need to be fixed with code by developer. Here is my website: http://www.interactivity.com.au/
Do you know any solution on Windows?
Since in a nutshell, the reason they're not working is that they're being blocked by a security feature, by definition there's no way for your applet to get around it. If there was, then it'd be a bug in the filter, and if such a way was found, you'd expect the filter to then be fixed to prevent it.
Add a link on your site to a set of instructions on how to fix the problem.
I'm having trouble testing a web app with Safari. My app returns wave audio data. The problem happens when I change the application and hit it again from Safari. Safari caches the original response so no matter how many times I hit refresh it seems like I've not updated anything. I can almost get around this using force refresh with Firefox but because I'm having trouble generating the wave headers using the javax.sound API Firefox only plays the first second of audio returned. A few weeks ago I tried setting the HTTP header in my servlet to prevent caching but I don't think I was setting it correctly. (What is the header for browser cache control?) This is becoming a real pain and I'm looking for any ideas, comments, or alternative approaches. I'm getting ready to try again but I figured I'd ask here in the interim to see if someone can provide help.
I found my answer. I just added a combination of "Pragma: no-cache", "Cache-Control: no-cache", and "Expires: -1" to y response headers. Now it appears the caching is no more. I still need a solution for my broken wave headers. I really hate to engineer a wave/io package for something that should be straight forward.