Hi to all, I am using vaadin 7.7.8 and what I am trying to do is this:
I need to send an HTTP Post with parameters to a url and open the returning page in a new browser window.
I have tried Risto Yrjänä’s FormSender add-on but it is always opening this new page in a new tab and I don’t have the control of this tab.
I have also tried to get response of my request as a StreamResource and opened it in a BrowserFrame.
StreamResource.StreamSource secure3DSource = new StreamResource.StreamSource() {
public InputStream getStream() {
try {
// my response is an html page which is inside this input stream
return secure3DCon.getInputStream();
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
};
StreamResource secure3DResource = new StreamResource(secure3DSource, "");
secure3DResource.setMIMEType("text/html");
BrowserFrame secure3DBrowserFrame = new BrowserFrame("", secure3DResource);
secure3DBrowserFrame.setSizeFull();
// window for the new page
Window secure3DWindow = new Window();
secure3DWindow.setModal(true);
secure3DWindow.setResizable(false);
secure3DWindow.setHeight(600, Unit.PIXELS);
secure3DWindow.setWidth(400, Unit.PIXELS);
// layout for this new window
VerticalLayout secure3DSablon = new VerticalLayout();
secure3DSablon.setSizeFull();
secure3DSablon.addComponent(secure3DBrowserFrame);
secure3DWindow.setContent(secure3DSablon);
UI.getCurrent().addWindow(secure3DWindow);
At first the solution looked promising but resources like css, image or javascript couldn’t be reached by the BrowserFrame and it gave so many errors like:
Kas 11, 2018 1:32:06 AM com.vaadin.server.ConnectorResourceHandler error
WARNING: BrowserFrame (170) did not handle connector request for content/140/style.css
Kas 11, 2018 1:32:06 AM com.vaadin.server.ConnectorResourceHandler error
WARNING: BrowserFrame (170) did not handle connector request for content/scripts/auths.js
Kas 11, 2018 1:32:06 AM com.vaadin.server.ConnectorResourceHandler error
WARNING: BrowserFrame (170) did not handle connector request for graphics/schema_000000002.gif
Kas 11, 2018 1:32:06 AM com.vaadin.server.ConnectorResourceHandler error
WARNING: BrowserFrame (170) did not handle connector request for content/140/default_help.gif
what can I do to make this work?
I mean is there a way to open this page in a new BrowserFrame like this with having all the external sources are reachable and javascript codes are working?
Any help will be appreciated.
Thanks in advance.