If you simply want to download the file in the same page without opening tabs or windows you can try to use a form panel to submit the request.
In your index.html add an empty div to handle the content:
<div id="content"></div>
Then just create a form panel to submit to the download servlet:
formPanel = new FormPanel();
RootPanel.get("content").add(formPanel);
formPanel.setSize("0px", "0px");
formPanel.setVisible(false);
formPanel.setAction(servletUrl);
formPanel.setEncoding(FormPanel.ENCODING_URLENCODED);
formPanel.setMethod(FormPanel.METHOD_POST);
//Set parameters if needed on hidden field - I use this to set the file name retrieved on a previous request
VerticalPanel verticalPanel = new VerticalPanel();
if (parameters != null) {
for (String key : parameters.keySet()) {
verticalPanel.add(new Hidden(key, parameters.get(key)));
}
}
formPanel.add(verticalPanel);
formPanel.submit();
On the server side you can try to set these headers so the browser gets the proper filename and content-type:
//Set response headers
response.setHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"");
response.setContentTypeIfNotSet("application/pdf");
Like this it should work in all browsers as a regular file download.