{"action":"created","issue":{"url":"https://api.github.com/repos/vaadin/spring/issues/381","repository_url":"https://api.github.com/repos/vaadin/spring","labels_url":"https://api.github.com/repos/vaadin/spring/issues/381/labels{/name}","comments_url":"https://api.github.com/repos/vaadin/spring/issues/381/comments","events_url":"https://api.github.com/repos/vaadin/spring/issues/381/events","html_url":"https://github.com/vaadin/spring/issues/381","id":380615737,"node_id":"MDU6SXNzdWUzODA2MTU3Mzc=","number":381,"title":"Upload is broken for V12+Spring, and V10+SpringMVC","user":{"login":"pleku","id":1478381,"node_id":"MDQ6VXNlcjE0NzgzODE=","avatar_url":"https://avatars1.githubusercontent.com/u/1478381?v=4","gravatar_id":"","url":"https://api.github.com/users/pleku","html_url":"https://github.com/pleku","followers_url":"https://api.github.com/users/pleku/followers","following_url":"https://api.github.com/users/pleku/following{/other_user}","gists_url":"https://api.github.com/users/pleku/gists{/gist_id}","starred_url":"https://api.github.com/users/pleku/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pleku/subscriptions","organizations_url":"https://api.github.com/users/pleku/orgs","repos_url":"https://api.github.com/users/pleku/repos","events_url":"https://api.github.com/users/pleku/events{/privacy}","received_events_url":"https://api.github.com/users/pleku/received_events","type":"User","site_admin":false},"labels":[{"id":173567757,"node_id":"MDU6TGFiZWwxNzM1Njc3NTc=","url":"https://api.github.com/repos/vaadin/spring/labels/bug","name":"bug","color":"fc2929","default":true},{"id":1047481085,"node_id":"MDU6TGFiZWwxMDQ3NDgxMDg1","url":"https://api.github.com/repos/vaadin/spring/labels/spring","name":"spring","color":"5cd138","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2018-11-14T09:49:18Z","updated_at":"2018-11-22T08:03:42Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"@denis-anisimov commented on [Tue Sep 25 2018](https://github.com/vaadin/vaadin-upload-flow/issues/84)\n\nThe original issue was : #59.\r\n\r\n`Upload`  still doesn't work: at least its succeeded listener is not called when `@EnableWebMvc` is used in config.\r\nIt's called correctly and everything works fine if there is no `@EnableWebMvc` annotation.\r\n\r\nIt might be that this is similar to #24.\n\n---\n\n@denis-anisimov commented on [Tue Sep 25 2018](https://github.com/vaadin/vaadin-upload-flow/issues/84#issuecomment-424286425)\n\nApparently the problem is the multipart resolver.\r\nIf multipart resolver is configured via \r\n\r\n```\r\n@Bean(name = \"multipartResolver\")\r\n    public CommonsMultipartResolver multipartResolver() {\r\n        return new CommonsMultipartResolver();\r\n    }\r\n```\r\n\r\nthen upload doesn't work regardless of @EnableWebMvc annotation.\n\n---\n\n@denis-anisimov commented on [Tue Sep 25 2018](https://github.com/vaadin/vaadin-upload-flow/issues/84#issuecomment-424315874)\n\nIf there is no `@EnableWebMvc` annotation then Spring uses `StandardServletMutipartResolver` somehow configured by default.\r\n\r\nIt's tricky to configure this resolver by yourself.\r\n\r\nIt looks like the behavior of `CommonsMultipartResolver` is inconsistent with `commons-file-upload`.\n\n---\n\n@heruan commented on [Tue Sep 25 2018](https://github.com/vaadin/vaadin-upload-flow/issues/84#issuecomment-424323566)\n\nWhat if `vaadin-spring` module would provide the resolver? It could be annotated with `@ConditionalOnMissingBean` so it is used only if the user does not provide their own.\r\n\r\nThe resolver provided by Vaadin would then have reasonable defaults, possibly configurable via `application.properties`.\r\n\r\nI guess this is not only related to `Upload`, but also to other means of using `StreamReceiver` in Flow.\n\n---\n\n@denis-anisimov commented on [Tue Sep 25 2018](https://github.com/vaadin/vaadin-upload-flow/issues/84#issuecomment-424374280)\n\nI believe you are talking about `StandardServletMutipartResolver`.\r\n\r\nIt's not that easy. This resolver requires additional `MultipartConfigElement` which needs to be somehow provided.\r\nOne of the way of doing this is set it for `ServletRegistration.Dynamic` whose instance is available in the vaadin spring configuration only.\r\n\r\nJavadocs says that there is another way of doing this :  `AbstractAnnotationConfigDispatcherServletInitializer` subclass which set the element.\r\n\r\nIn the simplest way the developer won't be able to configure the resolver (such as maximum uploaded file size and so on).\r\n\r\nI've been thinking about this. If I find a good way to make it configurable then I will do it.\r\n\r\nBut it's still worth to understand why \"apache\" `CommonsMultipartResolver` doesn't want to work with apache `commons-file-upload`. This is nonsense.\n\n---\n\n@denis-anisimov commented on [Wed Sep 26 2018](https://github.com/vaadin/vaadin-upload-flow/issues/84#issuecomment-424636648)\n\nI think this is a bug in Spring.\r\nI've found similar issue https://github.com/spring-projects/spring-boot/issues/7735.\r\nBut :\r\n- it's fixed\r\n- I can't get it working with suggested workarounds which disables Servlet 3.x multipart support.\r\n\r\nAbout using `StandardServletMutipartResolver` by default if there is no custom multipart resolver defined.\r\n\r\nI'm not able to get it working at all if `@EnableWebMvc` annotation is used. It requires additional `MultipartConfigElement` set but it fails every time when I set it for any servlet registration.\r\nSo it's still a big issue.\n\n---\n\n@denis-anisimov commented on [Wed Sep 26 2018](https://github.com/vaadin/vaadin-upload-flow/issues/84#issuecomment-424686077)\n\nSo interesting thing....\r\n\r\nThe presence of `CommonsMultipartResolver` bean breaks upload totally.\r\n\r\n`StandardServletMutipartResolver` may be used explicitly declared as a multipart resolver bean (with additional `MultipartConfigElement`  config ). It works without `@EnableWebMvc` .\r\nBut it again throws an exception (another one) if there is `@EnableWebMvc`.\r\nWTH.\n\n---\n\n@heruan commented on [Wed Sep 26 2018](https://github.com/vaadin/vaadin-upload-flow/issues/84#issuecomment-424698666)\n\nThank you Denis for being into this! I'm following your updates and doing tests too on my side, and yeah this Spring behaviour is quite irritating…\r\n\r\nFor example I do not use `@EnableWebMvc` but still upload doesn't work, so I guess I have some dependency which enables that under the hood—one more reason to tackle this down once for all!\r\n\r\nSpring has also a bunch of configuration properties to set in `application.yml`, i.e.\r\n\r\n```yml\r\nspring:\r\n  servlet:\r\n    multipart:\r\n      enabled: true\r\n      file-size-threshold:\r\n      max-file-size:\r\n      max-request-size:\r\n      resolve-lazily: \r\n```\r\n\r\nbut what for is it doesn't work? I'm trying now to set them on a non-Vaadin project, to see if outside Vaadin context these properties work.\n\n---\n\n@heruan commented on [Wed Sep 26 2018](https://github.com/vaadin/vaadin-upload-flow/issues/84#issuecomment-424706149)\n\nTake for example this project: https://github.com/spring-guides/gs-uploading-files\r\n\r\nIf you run it as is, upload fails because there is `spring.servlet.multipart.enabled` set to `false` (https://github.com/spring-guides/gs-uploading-files/issues/47); but setting that to `true`, upload **works well** *without* the need of any explicit `MultipartResolver` bean.\r\n\r\n### BUT\r\n\r\nif you add `vaadin-spring-boot-starter` to the project, it stops working! So I'd say the Vaadin Spring module does *something* in the servlet initialization that breaks uploads.\r\n\r\nI have a feeling this might be related to https://github.com/vaadin/spring/issues/331 where @snicoll stated that Vaadin Spring module \"overrides a core piece of Spring Boot\" in the context of the dispatcher servlet.\n\n---\n\n@denis-anisimov commented on [Wed Sep 26 2018](https://github.com/vaadin/vaadin-upload-flow/issues/84#issuecomment-424761674)\n\nThat might be a consequence of transitive dependencies as well.\r\n\r\nBut let's check your assumption first. It's not a big deal. I will make a test for non root context Spring app.\n\n---\n\n@denis-anisimov commented on [Wed Sep 26 2018](https://github.com/vaadin/vaadin-upload-flow/issues/84#issuecomment-424785061)\n\nYou are right, @heruan .\r\n\r\nEverything works fine if servlet is not mapped to the root meaning there is no hack with the dispatcher servlet  (https://github.com/vaadin/spring/issues/331).\r\nSo this is just another aspect of https://github.com/vaadin/spring/issues/331.\r\nWhich means we need to look at it closer.\n\n---\n\n@heruan commented on [Tue Oct 02 2018](https://github.com/vaadin/vaadin-upload-flow/issues/84#issuecomment-426205593)\n\nAny update on this? Not sure if this will be resolved with https://github.com/vaadin/spring/issues/331 or before.\n\n---\n\n@denis-anisimov commented on [Tue Oct 02 2018](https://github.com/vaadin/vaadin-upload-flow/issues/84#issuecomment-426207340)\n\nNo any update.\r\n\r\nThis ticket technically is a duplicate of https://github.com/vaadin/spring/issues/331.\r\nBut it's not a duplicate, it's a consequence of the mapping done for the dispatcher servlet which also causes the https://github.com/vaadin/spring/issues/331.\r\nSo once we resolve https://github.com/vaadin/spring/issues/331 we will resolve this as well.\r\n\r\nBut since it's not exactly the same issue as https://github.com/vaadin/spring/issues/331 I have doubts to close it (as a duplicate).\r\n\r\nSo I keep it open for now.\r\n\r\nThe progress should be for https://github.com/vaadin/spring/issues/331. But I have no any idea how to fix it.\r\nI don't understand what's going on there. This issue requires deep Spring expertise which I don't have.\r\nSo please just track progress in https://github.com/vaadin/spring/issues/331 but it's not progressing, it's not prioritizes and I don't have any thoughts how to solve it.\n\n---\n\n@andrea-tomassi commented on [Tue Oct 02 2018](https://github.com/vaadin/vaadin-upload-flow/issues/84#issuecomment-426332595)\n\nNot sure you still have the problem.\r\nMy experience (vaadin Flow 10) is that the upload is not working if you use:\r\n```\r\n\r\n@Bean(name = \"multipartResolver\")\r\n    public CommonsMultipartResolver multipartResolver() {\r\n        return new CommonsMultipartResolver();\r\n    }\r\n```\r\nIf you delete the multipartResolver Bean from Spring @Configuration the upload works well out of the box! Just add the component and add the listener. Stop.\r\nIt seems that now the multipartResolver Bean declaration is part of the base Vaadin project, and adding your own declaration breaks the upload.\n\n---\n\n@denis-anisimov commented on [Wed Oct 03 2018](https://github.com/vaadin/vaadin-upload-flow/issues/84#issuecomment-426570719)\n\nThe reason why it doesn't work is described here: https://github.com/vaadin/vaadin-upload-flow/issues/84#issuecomment-424785061\r\n\r\nIt works fine with or without explicitly provided mutlipart resolver in case if you servlet is mapped to non root context.\n\n---\n\n@pleku commented on [Wed Oct 03 2018](https://github.com/vaadin/vaadin-upload-flow/issues/84#issuecomment-426607503)\n\n>So please just track progress in vaadin/spring#331 but it's not progressing, it's not prioritizes and I don't have any thoughts how to solve it.\r\n\r\n@heruan the Spring issue will move forward in the next four weeks. I'm sorry but that is all I can say at the moment, we have other priorities at the moment.\n\n---\n\n@heruan commented on [Wed Oct 03 2018](https://github.com/vaadin/vaadin-upload-flow/issues/84#issuecomment-426634773)\n\nThank you @pleku for the feedback. Does this mean it will be fixed in 12?\n\n---\n\n@pleku commented on [Wed Oct 03 2018](https://github.com/vaadin/vaadin-upload-flow/issues/84#issuecomment-426725376)\n\nYes, that is the target at the moment. \n\n---\n\n@denis-anisimov commented on [Fri Oct 05 2018](https://github.com/vaadin/vaadin-upload-flow/issues/84#issuecomment-427335772)\n\nThe test for usecase is provided and disabled at the moment.\r\nHere is the ticket for enabling it back once the ticket is fixed:\r\nhttps://github.com/vaadin/spring/issues/359\n\n---\n\n@heruan commented on [Tue Oct 30 2018](https://github.com/vaadin/vaadin-upload-flow/issues/84#issuecomment-427676016)\n\n~~I've got upload working updating to Spring Boot 2.1.0.M4 and Vaadin 12.0.0.alpha2!~~\r\n\r\n(Nevermind, I didn't have `@EnableWebMvc`, which still breaks uploads.)\n\n---\n\n@denis-anisimov commented on [Mon Oct 08 2018](https://github.com/vaadin/vaadin-upload-flow/issues/84#issuecomment-427723351)\n\n> (Nevermind, I didn't have `@EnableWebMvc`, which still breaks uploads.)\r\n\r\n:) Exactly.\n\n---\n\n@priyamalM commented on [Mon Oct 08 2018](https://github.com/vaadin/vaadin-upload-flow/issues/84#issuecomment-427759252)\n\nany updates on this issue ??\n\n---\n\n@heruan commented on [Tue Oct 09 2018](https://github.com/vaadin/vaadin-upload-flow/issues/84#issuecomment-428223572)\n\nWorth noting that on WildFly 14 it fails also *without* `@EnableWebMvc`:\r\n\r\n```\r\njava.lang.IllegalStateException: UT010057: multipart config was not present on Servlet\r\n\tat io.undertow.servlet.spec.HttpServletRequestImpl.verifyMultipartServlet(HttpServletRequestImpl.java:520)\r\n\tat io.undertow.servlet.spec.HttpServletRequestImpl.getParts(HttpServletRequestImpl.java:509)\r\n\tat javax.servlet.http.HttpServletRequestWrapper.getParts(HttpServletRequestWrapper.java:390)\r\n\tat org.springframework.web.multipart.support.StandardMultipartHttpServletRequest.parseRequest(StandardMultipartHttpServletRequest.java:94)\r\n```\n\n---\n\n@denis-anisimov commented on [Mon Nov 05 2018](https://github.com/vaadin/vaadin-upload-flow/issues/84#issuecomment-435817067)\n\nThe latest update:\r\n- we have removed a workaround in Flow core related to the dispatcher servlet.\r\n- now dispatcher servlet is not overridden\r\n- but the `Upload` issue is still there\r\n\r\nAs a result: it looks like the `Upload` issue is not related to the dispatcher servlet itself.\r\nThe issue is caused by the forwarding workaround which we have to apply in case of root mapping.\r\nI don't know how it affects the `Upload` exactly but apparently it does.\r\n\r\nI was thinking that it may be fixed by one more change which exists in FW8 and is related to the forwarding workaround : \r\nhttps://github.com/vaadin/spring/blob/3.0/vaadin-spring/src/main/java/com/vaadin/spring/server/SpringVaadinServletService.java#L69\r\n\r\n(Note that everything else perfectly works without this change so it's not clear whether it's needed or not).\r\n\r\nThe `\u001CserviceUrl` value in this code is `/vaadinServlet` the original mapping which is used in root mapping case (before forwarding is applied).\r\nI've changed the `getServiceUrl` method return value to `/vaadinServlet` and checked whether \r\n`Upload` works with this change (the method is used inside the `setupMetaAndTitle` method to set `base` href value).\r\n\r\nIt didn't help.\r\nMay be this info is irrelevant but I wanted to save it here just in case.\r\n\n\n---\n\n@heruan commented on [Wed Nov 14 2018](https://github.com/vaadin/vaadin-upload-flow/issues/84#issuecomment-438576407)\n\nWith the latest Spring add-on, `Upload` does not work even *without* `@EnableWebMvc` 😕\r\n\r\nSo now with 12.0.0.beta1 uploads simply don't work with Spring, which is not just a `Upload` issue but any `StreamReceiver` (which is Flow core).\r\n\r\nFeels like this should be moved (or open a new one) in the Spring add-on repo, as the title \"[Spring] Upload listeners are not called if multipart resolver is provided and `@EnableWebMvc` is used in config\" doesn't reflect much the current status:\r\n\r\n- it's not about upload listeners, but about the request handler;\r\n- the multipart resolver isn't relevent, as its presence doesn't make a difference;\r\n- nor is the annotation `@EnableWebMvc`, as uploads do not work regardless of it.\n\n"},"comment":{"url":"https://api.github.com/repos/vaadin/spring/issues/comments/440944793","html_url":"https://github.com/vaadin/spring/issues/381#issuecomment-440944793","issue_url":"https://api.github.com/repos/vaadin/spring/issues/381","id":440944793,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MDk0NDc5Mw==","user":{"login":"denis-anisimov","id":11425472,"node_id":"MDQ6VXNlcjExNDI1NDcy","avatar_url":"https://avatars0.githubusercontent.com/u/11425472?v=4","gravatar_id":"","url":"https://api.github.com/users/denis-anisimov","html_url":"https://github.com/denis-anisimov","followers_url":"https://api.github.com/users/denis-anisimov/followers","following_url":"https://api.github.com/users/denis-anisimov/following{/other_user}","gists_url":"https://api.github.com/users/denis-anisimov/gists{/gist_id}","starred_url":"https://api.github.com/users/denis-anisimov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/denis-anisimov/subscriptions","organizations_url":"https://api.github.com/users/denis-anisimov/orgs","repos_url":"https://api.github.com/users/denis-anisimov/repos","events_url":"https://api.github.com/users/denis-anisimov/events{/privacy}","received_events_url":"https://api.github.com/users/denis-anisimov/received_events","type":"User","site_admin":false},"created_at":"2018-11-22T08:03:42Z","updated_at":"2018-11-22T08:03:42Z","author_association":"CONTRIBUTOR","body":"OK, cool.\r\nThank you very much for the information."}}
{"actor":{"display_login":"denis-anisimov"}}