Eclipse RAP - Firefox doesn't forget session - eclipse

We've got an Eclipse RAP application that's behaving a bit strangely in Firefox - two distinct problems.
When you browse around, you can click on a button in one part of the system. This opens a popup window like so:
IWorkbenchBrowserSupport bs;
bs = PlatformUI.getWorkbench().getBrowserSupport();
int style = IWorkbenchBrowserSupport.AS_EXTERNAL;
IWebBrowser b = bs.createBrowser(style, getRandomID(), "Hello world", "");
b.openURL(new URL(...));
where the URL is another servlet in the application. This servlet is in the same runtime, but has nothing to do with RAP - it takes a binary blob from in-memory storage and dumps it in the output stream.
Problem 1: This causes the HTTP session to die in firefox, and shows the "session expired" RAP error page with a link to restart the session.
Problem 2: Now, when you click on the link to restart the session, it shows the application's dialog again, but the session expired error is shown again the moment you do anything. This prevents the user from using the system again, unless Firefox is closed down completely and restarted. A quick peek with FireBug reveals that the JSESSIONID passed by Firefox does not change.
Has anyone seen this before?

How long is the dumping of the stream to the output? May it cause a timeout? As RAP uses Javascript calls, it might be much shorter than the normal timeout time.
For problem 2: Firefox caches a lot of things; and if the Javascript execution hangs, it might cause such problems.
Are these problems present in other browsers? It might be a good idea to check with the internal browser (or any other browser with a different rendering engine).

It turns out that if a RAP application opens a popup window pointing to a servlet in the application itself, inside the current HTTP servlet context, the session is killed. Fixed by creating a dummy HTTP context for the servlet in question.

If you need to deliver content from within the same application, you should use a service handler instead. See this FAQ:
http://wiki.eclipse.org/RAP/FAQ#How_to_provide_download_link.3F

Related

ModalPopupExtender doesn't show on some computers

I maintain a vb.net website. A button on a page shows an AjaxControlToolkit.dll ModalPopupExtender. When I click the button, the page reloads, but no popup appears.
My tests below cover the scenarios I can think of. Please help me diagnose and fix.
This ModalPopupExtender succeeded in the past. The error might have started when we moved to a new server, or when we implemented https, or a browser update, or at some other time since then.
Tried Chrome (latest) and Firefox.
I RDPed into the server and opened the page in Chrome there. ModalPopupExtender succeeded. Same Chrome version as my PC. So, unlikely to be a code issue.
A different page on the same site uses ModalPopupExtender successfully. So, unlikely to be local PC settings.
I put lines of test code immediately before and after ModalPopupExtender.Show(). Both succeed.
Aha - found it!
Solution
The ASPX/HTML referred to http://ajax.googleapis.com. Changing the references to https made ModalPopupExtender.Show() work correctly for me.
Explanation/Diagnosis (if you can clarify further, please comment)
When I checked the html served to my browser, I noticed it defined a javascript function called fn(). The definition for fn() didn't appear in the html served to the server's browser. After the https change, fn() no longer appears in the html I receive. The other page, where ModalPopupExtender worked, didn't have any reference to googleapis.com.
I assume that using http instead of https caused ajax.googleapis.com to provide fn() and that fn() in some way interfered with the normal operation of my ModalPopupExtender.
Here's the fn() definition: (function {var fn = function() {Sys.Extended.UI.ModalPopupBehavior.invokeViaServer('ctl00_cphContent_ModalPopupExtenderConfirm', true); Sys.Application.remove_load(fn);};Sys.Application.add_load(fn);})();
Note: the http also included another javascript function related to the ModalPopupExtender. But there was a similar one on the working page, and in the working version served to the server's browser, and in my fixed version. So, I assume that function is correct.

blank.html is downloaded multiple times

GWT is used and the application is deployed on WebLogic using HTTPS.
The performance is poor and with F12 Developer Tools, we could see that blank.html is downloaded multiple times. This is clearly related to GWT but we have not been able to figure out why.
The following is from javascript:
defineSeed(2613, 2614, makeCastMap([Q$BaseModelData, Q$ModelData, Q$Theme, Q$Serializable]), Slate_0);
var SLATE;
function $clinit_GXT(){
$clinit_GXT = nullMethod;
IMAGES = new XImages_generatedBundle_0;
MESSAGES = new XMessages__0;
SSL_SECURE_URL = getModuleBaseURL() + 'blank.html';
}
This is from GWT.java:
/**
* URL to a blank file used by GXT when in secure mode for iframe src to
* prevent the IE insecure content. Default value is 'blank.html'.
*/
public static String SSL_SECURE_URL = GWT.getModuleBaseURL() + "blank.html";
Does anyone know under what circumstances blank.html is called?
Thanks!
This is from GWT.java:
This is actually from GXT.java.
This is used in a few cases when creating an <iframe> element, so that IE won't give errors if your site is hosted from SSL. I can actually only find one case (as of GXT 3.1.1) which uses this, in Layer.java. Only IE pages loaded from https urls will make use of this.
The Layer class uses this as a "shim", a way to prop up some DOM elements above overs, and work around some browser bugs (typically plugin or iframe related). Menus and popup dialogs use this to ensure that they don't appear "underneath" content that they should be "above".
This file is very small - just enough HTML to convince IE than the iframe has correctly loaded, and no more. It never changes, and should load nearly instantly.
As far as performance goes, this should only happen when a Menu or Window/Dialog/Tooltip is shown - these shouldn't be happening on app startup usually, at least not more than a window or two. Additionally, the browser should recognize that it is loading the same element and cache it correctly, and not load it multiple times (though it might be listed several times as hitting the cache). If the server has instructed the browser to never cache the file, that is something you should look at changing.
In short, this is very unlikely to be the cause of any performance issues, at least in GXT itself. If somehow you have the shim enabled on every single widget in your project, this should not be required. If the file is loading slowly, something may be very wrong with your server configuration.
For reference, here is the entire file:
<html></html>

Java webstart replaces jnlp with wifi login page html

My webstart runs fine whenever there is internet connection. It also runs fine when I disconnect from wifi. But it does not work if my computer is connected to public wifi (ie. coffeeshop, airport, etc) such that if I open a browser it forwards me to a html page that asks me to click on a button to connect to internet.
Basically Java webstart thinks that the html welcome page is the new update to my jnlp file so it replaces my jnlp with the welcome page html. Of course that will fail to parse, so I get a parse error and I cannot recover from it unless I completely remove my webstart application from cache and re-download and re-install it.
Has anyone else experienced this? Is there a way to prevent this issue?
I submitted a bug report to OpenJDK:
https://bugs.openjdk.java.net/browse/JDK-8079874
Unfortunately it's marked as incomplete. Evidently I wasn't clear about what the problem is. I'll try to get in touch with them to see which part is not clear.

Run web project on Server Tomcat 7 with Eclipse

I have big web application that uses GWT. When it starts a dialog window is openning on client side for logging. LogDialog consists of two textfields (password and name). Why when I use option Run on Server from Eclipse I can see only loading picture(it appears from beginnig). But then the LogDialog and main menu dont appear. As I know there is one jscript that Browser have to load to show Logdialog. I tried to view web app from GooGle Chrome and I discovered that it doesnt load Cashier.js (jscript file) and shows to me loading picture. What am I doing wrong? How can I catch the error?
As I know GWT compiler generate the client side Javascript code. The web app uses database for storing logname and pass.

GWT Frame not working in Mozilla Firefox or in Google chrome, but working fine in IE

I am trying to download a file from server. The normal GWT RPC call doesnot allow me to do that, and hence I wrote a servlet to do that job for me. From the client side, I am creating a Frame object, and I set the servlet URL in it, and add that frame Object in my root panel.
When I execute this in IE, a window pops up asking for Save/Open file.
But when I execute the same in a Firefox or a Google Chrome browser, nothing is happing.
I am not getting any request on my servlet/server side.
Here is a slice of the code :-
String servletUrl = "http://localhost:13080/Browser/ui/dataExportServlet?level=ZERO";
Frame frame = new Frame(servletUrl);
frame.setVisible(false);
RootPanel.get().add(frame);
So, can someone please help me out.
This might be related to same origin policy.
Are both servlet and webapp running on port 13080?
If they differ, SOP might fail this.
If I understand correctly, IE has a more relaxed policy so it might work there but not in chrome.
See http://en.wikipedia.org/wiki/Same_origin_policy and Can I disable SOP (Same Origin Policy) on any browser for development?
In Chrome, you can use the Developer Tools (CTRL + SHIFT + I) to check if the IFrame is being added to the HTML, and if the frame's source is being set properly. You should also be able to see what content has been loaded into the iframe.
Alternately, set a breakpoint in your servlet to see if the iframe is being hit at all from Chrome.
I got the solution for this issue.
I removed the frames and added the following code :-
com.google.gwt.user.client.Window.open(url, "CSVDownload", "");
Now, this opens a new browser window, and then I get the pop-up to open/save the server side file in all 3 web-browsers. (IE, Mozilla FireFox, Chrome).
Thanks a lot!!!