Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
java.net.SocketException: Connection reset when opening an embedded pdf
I get a java.net.SocketException: Connection reset when trying to open a pdf this only happens in FireFox, when tested in Chrome and Opera it works perfect.
Below is my code can anyone give me some advice on it please?
Window pdfWindow = new Window(); ((VerticalLayout) pdfWindow.getContent()).setSizeFull(); pdfWindow.setResizable(true); pdfWindow.setWidth("800"); pdfWindow.setHeight("600"); pdfWindow.center(); Embedded e = new Embedded(); e.setSizeFull(); e.setType(Embedded.TYPE_BROWSER); StreamResource source = null; source = new StreamResource(new Pdf() //omitted for brevity source.setMIMEType("application/pdf"); source.setCacheTime(5000); e.setSource(source); pdfWindow.addComponent(e); pdfWindow.setStyleName(Reindeer.WINDOW_LIGHT); pdfWindow.setCaption("EULA"); main.addWindow(pdfWindow);
I hope someone can help me out with this because I'm really stuck atm
Well, I can't claim I totally sure what's going on, but... Firefox requires a plugin to display PDFs, maybe that is not installed? Try browsing directly to the PDF url (as seen in the html source) - does FF open it or try to download it?
have a look in this thread. It has a different topic but deals also with displaying generated pdf files in a separate window. I hope you can use some of the code snippets in your application. Btw: I'm using Firefox too and had never such error messages.
Hey thanks for the help,
problem wasn't anything vaadin related but on the test-box I was using,
after it went on a live server this problem didn't happen again.