Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@WebServlet registered with ServletComponentScan does not honor @MultipartConfig annotation #6680

Closed
torerefsnes opened this issue Aug 17, 2016 · 5 comments
Assignees
Labels
type: bug A general bug
Milestone

Comments

@torerefsnes
Copy link

I have recently migrated an war-application to Spring Boot 1.4. The servlets are registered using ServletComponentScan.

The servlets that are annotated with @MultipartConfig do not decode multipart data. It seems the @MultipartConfig annotation is not honored for servlets registered through ServletComponentScan.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 17, 2016
@wilkinsona
Copy link
Member

That sounds more than likely. What behaviour have you observed that made you realise that @MultipartConfig isn't being honoured?

@wilkinsona wilkinsona added status: waiting-for-feedback We need additional information before we can continue and removed status: waiting-for-triage An issue we've not yet triaged labels Aug 18, 2016
@torerefsnes
Copy link
Author

HttpServletRequest.getParts() returns null, and
HttpServletRequest.getParameter() return null when multipart-data is
posted, and the servlet has been added through ServletComponentScan.

If I remove the @WebServlet and @MultipartConfig annotation and add the
servlet as a @bean in my Application class, it works as expected.

tor. 18. aug. 2016 kl. 10.45 skrev Andy Wilkinson <notifications@github.com

:

That sounds more than likely. What behaviour have you observed that made
you realise that @MultipartConfig isn't being honoured?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#6680 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFmdJ4bv63pG8jbtwgOXj4oXAkBz7p31ks5qhBu_gaJpZM4Jm5tX
.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Aug 18, 2016
@wilkinsona
Copy link
Member

Interesting. That's not what I expected. In both cases the Servlet is registered using a ServletRegistrationBean so I would have guessed that only things configured via the @MultipartConfig attributes would not be honoured. Can you please create a small sample that shows the two different behaviours that you're seeing?

@wilkinsona wilkinsona added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Aug 18, 2016
@torerefsnes
Copy link
Author

Yes, but I have to add this line when registering the servlet in the
Application class to make it work:

    servletRegistrationBean.setMultipartConfig(new

MultipartConfigElement((String) null));

I suspect the annotation on the servlet class does not cause this
MultipartConfig to be added to the ServletRegistrationBean..

I'll provide a test case if you can't see any obvious errors in the code.
Thanks!

tor. 18. aug. 2016 kl. 11.47 skrev Andy Wilkinson <notifications@github.com

:

Interesting. That's not what I expected. In both cases the Servlet is
registered using a ServletRegistrationBean so I would have guessed that
only things configured via the @MultipartConfig attributes would not be
honoured. Can you please create a small sample that shows the two different
behaviours that you're seeing?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#6680 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFmdJ1h3dwKgf3z-UC2ZwIvEcZF3Awyvks5qhCosgaJpZM4Jm5tX
.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Aug 18, 2016
@wilkinsona
Copy link
Member

No, that's fine. Thanks. I think I have all the info I need now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants