Spring-webflow error popup tweak - popup

There is a link in a spring-webflow2 based application which start different flows. Flows are shown in popup (popup=true). If the session is expired or server is unavailable, the spring-webflow shows small empty popup with "Ajax Request Error" tooltip shown on mouse over. Is it possible to tweak the popup in order to give the user an ability to either re-login or to just close the popup and retry the request?
EDIT: Or maybe some ideas how to force Spring-Dojo to make a redirect to login page?

The problem is that the session is gone and so is the conversation/flow in it. So there's no easy way to make the popup work again, because the conversation or flow state must be restored. I think the best you could achieve would be to somehow convince Dojo to redirect back to the login url.

Related

Play Framework: clear Flash scope when going back

I'm using scala 2.11.8 and Play Framework 2.3. I am submitting a form and managing the result through a controller. The controller returns a Redirect to a page flashing a certain message, either a success or an error message:
Redirect(routes.MyController.page).flashing("success" -> "All went well")
I then manage this message using javascript, so it can be seen in a modal:
#flash.get("success").map { message =>
<script type="text/javascript">
modalSuccess('#message');
</script>
}
All goes well, the modal is shown. Next I navigate to another page and use the Back arrow to go back and the modal is shown again. This is, of course, very weird for the user: he has just clicked back, it makes no sense that he sees a "All went well" message.
Previously, I passed these messages as parametres to the pages and returned a 200 OK:
Ok(views.html.page(message = "All went well"))
But the exact same thing happened because the request was sent again. I switched to Flash to solve this, but I can't seem to prevent it from showing when returning to the previous page.
Should I clear the Flash scope, or should it clear by itself, once the redirect is executed?
When you click back, by default the browser will serve the page out of its cache, it won't reissue the request, and that is what is happening here, it has nothing to do with Play.
There is no standard for how the browser back button behaves, in particular with regards to caching, so solving it isn't straight forward because all the browsers behave differently. This SO question/answer covers it fairly comprehensively:
How to control web page caching, across all browsers?
But be aware of the drawbacks, if you tell the browser it must never cache pages, you can end up giving users a poor experience, for example, if they are filling out a form, and they accidentally navigate away, and then click back so they can continue filling out the form, if you force the browser now to cache the page they will lose everything that they entered into the form.
Also, what if the reason they are clicking back is that they want to see the rendered model again? When users click back, they expect to see the page that they were just on, just as it was. If you change that, you're breaking their expectations. I wouldn't be happy if that happened to me - I hate it when I click back and I get a different page, you're probably going to upset your users if you do it.

How to duplicate a application window in GWT/GXT?

we have a CRM-like application written in GWT/GXT with help of our library which wraps some GXT widgets like ComboBox or Grid from GXT to simplify interaction with relational database. When the application starts a user have to log in and after successfully login the user can see main horizontal menu and some welcome information. If the user want to do something (e. g. to find a customer) he/she has to click somewhere in the menu and a new GXT modal window appears. Now we want to give the user a possibility to open a new session (e. g. to handle a second customer and visually compare customer's data with the first customer) in a new browser window.
How to do it?
Best Regards,
Jacek
The best way I know to comunicate between browser tabs is to use HTML 5 localStorage. Here is a good tutorial. In GWT you can use gwt-storage to easily manipulate the localStorage.
If you want to open a new Window or browsertab you will need to solve two problems:
You will need to specify the session. This can be done by simply create some kind of session token-cookie. This should be flagged with http-only for security reasons). New windows will send the same cookie (and the user is logged in)
You need to specify the item, you want to show. This can be done by using the history API and store the token in the URL

How to find out browser back button click using gwt history

I m using history listener for forward and back browser button.But i m not able to find out history back button click.If any idea plz rply..urgent for me...Thank you..
Your code can use the tokens sent by History management system to determine what kind of action you want to take. Suppose you are at page1 and that page is identified by the token 'page1'. Now, you move to page2. If you click the back button, you will receive the token 'page1'. You can use this to set the state related to page1. See this Google doc for more info.

google analytics receiving data vs. redirecting that causes NS_BINDING_ABORTED

Okay so first off, sorry if the title doesn't make much sense...I'm not sure how else to summarize it!
So here's the issue:
I am using jQuery to attach a click event to my form's submit button. The jQuery click event triggers some GA code to track a virtual page view so I can use it as a step in a Goal funnel.
But what happens is that there's no delay between the GA code executing and the submit, so I'm concerned that GA isn't actually getting the data.
When I look at what's happening in firebug or httpfox (browser addons that look at the requests/response) vs. charles proxy (external sniffer, separate from browser) I am seeing two different things.
With firebug/httpfox I see the GET request to GA but status of 0 and it is showing up as
(Aborted) NS_BINDING_ABORTED
...though it does show bytes having been sent etc.. just nothing for response.
But with charles proxy, I am seeing the same GET request with a status of 200 and the 1x1 pixel response.
So my theory here is that GA is receiving the data, but that the browser is moving on before it gets the actual response - which I'm okay with, as long as GA is getting the data, I'm okay with this. But it is just my theory and I don't know...
I know I can write the code to simply delay the execution of the submit by 500ms or whatever as insurance, but I don't wanna have to do that if it's not necessary..
And I know if nothing else I can just see if the data is showing up in GA but GA has a 24-48 hour delay on data so it is hard to QA.
Does anybody know or have any suggestions from experience...has anybody else experienced this "abort" thing and can say one way or the other if it is necessary to delay the submit or whatever?
HTTPFox is not a real sniffer. It just tries to mimic one. So the data you see on it is not always what is really happening in the background. Charles should get you a better picture. If you're seeing the 200 code in Charles. So the chances are that the hit is going through.
The bad news is that when you fire hits at the time the page unloads. (Outbound clicks, insite link clicks, form submissions, window.unload, etc) they won't go through every now and then. This happens because the Google Analytics JS Call basically appends a GIF to the page. And it returns after that. Than the browser will load the gif. When the code returns the browser is free to go, and if it goes away from the page it will cancel any pending requests that it may have, including that small GIF image. So the browser might haven't sent the tracking code, or might have sent it, but the TCP connection didn't go through and the browser would need to resend the package, but he's not willing to do it anymore.
So if accuracy is a need for you, you should add a 200-500 ms delay to it. But remember that Google analytics is not an Accuracy Tool, and if some events don't go through it won't probably affect the final outcome of your analysis.
According to the informatin on this page: Sending Data to Google Analytics there is a possibility that your data is not really being sent (the bad news, as Eduardo said). Transcribing the most important information of that page, related to your doubts:
Many browsers stop executing JavaScript as soon as the page starts
unloading, which means your analytics.js commands to send hits may
never run.
An example of this is when you want to send an event to Google
Analytics to record that a user clicked on a form's submit button. In
most cases, clicking the submit button will immediately start loading
the next page, and any ga('send', ...) commands will not run.
The solution to this is to intercept the event to stop the page from
unloading. You can then send your hit to Google Analytics as usual,
and once the hit is done being sent, you can resubmit the form
programmatically.

XULRunner Busy/Loading indicator

I have an XULRunner based application in which I need to (a) ask for user input using a custom dialog, and when the user clicks "OK", (b) perform the requested operation. This operation is an asynchronous operation on a server, and can take some time, so I would like to show a "loading" dialog or some form of busy indicator. I have tried to create a custom modal dialog that has a single label with "Please wait..." message, and close the dialog upon server reply; but server reply seems to be getting blocked while this modal dialog is open. Should I open the modal dialog in a certain way or run the operation in some kind of a thread so that the reply can be processed even while the modal dialog is open? I have tried to look up documentation, but couldn't find anything useful. Appreciate any help from the stackoverflow community.
Thanks in advance for your help.
server reply seems to be getting blocked while this modal dialog is open
This is not supposed to happen.
What XULRunner on what OS are you trying to use? How do you open a modal dialog? How do you interact with the server?
It would be best if you produced a simple testcase that can be used to reproduce the problem.