Uploading a File fails with Vaadin Spring PLupload-Addon

Hi,

If i want to upload a file with a specific widget/addon of Vaadin, im getting some warnings and the files does not be uploaded.

I don’t have any idea, why this warning occurres. I was checking the whole addon and saw some JavaScript usage, which using that POST but i don’t get why it throwing some warnings and doesn’t work at all.

I checked the Addon without Spring integration and everything worked well.

This are the warnings:

2015-08-16_15:44:53.777 WARN  o.s.web.servlet.PageNotFound - Request method 'POST' not supported
2015-08-16_15:44:53.777 WARN  o.s.w.s.m.s.DefaultHandlerExceptionResolver - Handler execution resulted in exception: Request method 'POST' not supported
2015-08-16_15:44:54.937 WARN  o.s.web.servlet.PageNotFound - Request method 'POST' not supported
2015-08-16_15:44:54.938 WARN  o.s.w.s.m.s.DefaultHandlerExceptionResolver - Handler execution resulted in exception: Request method 'POST' not supported
2015-08-16_15:44:55.977 WARN  o.s.web.servlet.PageNotFound - Request method 'POST' not supported
2015-08-16_15:44:55.977 WARN  o.s.w.s.m.s.DefaultHandlerExceptionResolver - Handler execution resulted in exception: Request method 'POST' not supported
2015-08-16_15:44:57.019 WARN  o.s.web.servlet.PageNotFound - Request method 'POST' not supported
2015-08-16_15:44:57.020 WARN  o.s.w.s.m.s.DefaultHandlerExceptionResolver - Handler execution resulted in exception: Request method 'POST' not supported

My Code is the following, a simple init() with minimum of functionallity:

protected void init (VaadinRequest request){
    HorizontalLayout root = new HorizontalLayout();
    root.setSizeFull();
    setContent(root);
    setSizeFull();

    PluploadManager manager = new PluploadManager();
    manager.getUploader().setMaxFileSize("10mb");
    manager.getUploader().addFileUploadedListener(new Plupload.FileUploadedListener() {
        public void onFileUploaded(PluploadFile file) {
            Notification.show("I've just uploaded file: " + file.getName());
        }
    });

    manager.getUploader().addErrorListener(new Plupload.ErrorListener() {
        public void onError(PluploadError error) {
            Notification.show("There was an error: " + error.getMessage() + " (" + error.getType() + ")",
                    Notification.Type.ERROR_MESSAGE);
        }
    });

    root.addComponent(manager);
}

Here are my dependencies inside the POM:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
    <groupId>com.vaadin</groupId>
    <artifactId>vaadin-spring-boot-starter</artifactId>
    <version>1.0.0.beta3</version>
</dependency>
<dependency>
    <groupId>pl.exsio</groupId>
    <artifactId>plupload-vaadin</artifactId>
    <version>2.0.0</version>
</dependency>

Current Technolgies:

I had the same problem (spring-boot + vaadin + plupload add-on). I registered vaadin servlet again (it is a brute force method :slight_smile: - I don’t know how to overwrite servlet paths):


@Bean
ServletRegistrationBean reg(VaadinServlet s) {
ServletRegistrationBean r = new ServletRegistrationBean(s,“/vaadinServlet/", "/VAADIN/”,“/pluploader-upload-action”); return r;
}

I had to add handler in my UI.init():


VaadinSession.getCurrent().addRequestHandler(PluploadReceiver.getInstance());

And it works. :slight_smile:

Thanks, that helped me a lot.