-
Notifications
You must be signed in to change notification settings - Fork 140
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
[http] extract Multipart code into new ServletRequestMultipartWrapper #367
Conversation
Mostly in the usage of felix-jetty-light there is the cases where you do not need the multipart support and can remove the dependencies of common-fileupload and common-io. To be able to do this we could not load a instantiate a class that imports common-fileupload classes. So we have to free the old class ServletRequestWrapper of this imports and add a ServletRequestMultipartWrapper that still have the multipart support. Signed-off-by: Stefan Bischof <stbischof@bipolis.org>
I haven't checked the whole PR yet, but i would expect |
yes the imports are is marked as optional. this way it could resolve and start without But the class But in any case the |
I see, but wouldn't it make sense to mark the dependencies as optional as well, in Line 504 in f572bd8
|
Please note that "optional" means something totally different to maven, see https://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html Optional is similar to "provided" but should not be included into runtime collections e.g. Optional in OSGi mean it could work with or without this dependency, is really hard to get correct and almost never useful if not carefully crafted and tested. Especially in this case it might lead to hard to track runtime errors, so |
Thanks for clarifying @laeubi, that makes sense 👍 It's already optional in the jetty12 bundle, is that considered a bug then? felix-dev/http/jetty12/pom.xml Line 738 in f572bd8
|
http/base/src/main/java/org/apache/felix/http/base/internal/dispatch/ServletRequestWrapper.java
Outdated
Show resolved
Hide resolved
http/base/src/main/java/org/apache/felix/http/base/internal/dispatch/ServletRequestWrapper.java
Show resolved
Hide resolved
According to the servlet spec, this method either throws a ServletException if the request is not a multipart request or always returns a collection. It never returns null. Throwing an exception seems to be the right thing. (Karsten Ziegeler) Signed-off-by: Stefan Bischof <stbischof@bipolis.org>
@cziegeler I now throw an ServletException on the 2 Messages. see my last commit. |
Thanks, looks good |
also tested in my application. @paulrutter okay with a merge? |
@stbischof Yes 👍🏻 felix-dev/http/jetty12/pom.xml Line 738 in f572bd8
From what i understood from @laeubi, that optional should not be there, right?
|
@paulrutter I think "optional" is sued semantically wrong here from maven point of view, but as the artifact is most likely never used as a maven dependency (but only as OSGi artifact it might not really matter, I would just remove all |
I will make that change to the jetty12 bundle then. |
Mostly in the usage of felix-jetty-light there is the cases where you do not need the multipart support and can remove the dependencies of common-fileupload and common-io. To be able to do this we could not load a instantiate a class that imports common-fileupload classes. So we have to free the old class ServletRequestWrapper of this imports and add a ServletRequestMultipartWrapper that still have the multipart support.