java - Uploading a File fails with Vaadin Spring PLupload-Addon -
if want upload file specific widget/addon of vaadin, im getting warnings , files not uploaded.
i don't have idea, why warning occurres. checking whole addon , saw javascript usage, using post don't why throwing warnings , doesn't work @ all.
i checked addon without spring integration , worked well.
this 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 following, simple init() 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 uploaded file: " + file.getname()); } }); manager.getuploader().adderrorlistener(new plupload.errorlistener() { public void onerror(pluploaderror error) { notification.show("there error: " + error.getmessage() + " (" + error.gettype() + ")", notification.type.error_message); } }); root.addcomponent(manager); }
here dependencies inside 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:
- java 1.8
- vaadin 7.5.3
- spring boot 1.3.0.m3 ( https://start.spring.io/ )
- maven pom
- vaadin widget / addon: plupload wrapper : ( https://vaadin.com/directory#!addon/plupload-wrapper-for-vaadin-7x )
that not supported out of box.
the reason url /pluploader-upload-action
not being processed vaadin's servlet. real url of vaadin's servlet /vaadinservlet
. vaadin registers simpleurlhandlermapping
servletforwardingcontroller
on root url (by default) , /vaadin. other urls, need register them yourself.
try workaround.
in application.properties:
multipart.enabled=false
add following configuration.
@configuration public class vaadinpluploadconfiguration { private static final string pluploader_url = "/pluploader-upload-action"; @inject private controller vaadinuiforwardingcontroller; @bean public simpleurlhandlermapping vaadinforwardinghandlermapping() { simpleurlhandlermapping mapping = new simpleurlhandlermapping(); mapping.setorder(integer.min_value + 1); map<string, object> urlmappings = new hashmap<string, object>(); urlmappings.put(pluploader_url, vaadinuiforwardingcontroller); mapping.seturlmap(urlmappings); return mapping; } }
the multipart disabled allow plupload add-on process multipart section otherwise processed spring , break add-on.
Comments
Post a Comment