[
https://issues.apache.org/jira/browse/FILEUPLOAD-303?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17114593#comment-17114593
]
Mohamed edited comment on FILEUPLOAD-303 at 5/23/20, 7:33 AM:
--------------------------------------------------------------
I think I've been misunderstood.
In other words in the *{{FileUploadBase}}* class there's two *deprecated*
methods : *{{isMultipartContent}}* & *{{parseRequest}}* which they are
dependent to the {{javax.servlet}} by there parameters. Event If I use
UploadContext with FileUpload class I have to add the {{javax.servlet}}
dependency because {{FileUpload}} extends {{FileUploadBase}} with the two
deprecated methods.
All I want is a new version of {{FileUploadBase *without* the two deprecated
methods. Hence I can use FileUpload without being forced to add dependecy to
}}{{javax.servlet (I'm not in a servlet based webapp).}}
was (Author: cherb):
I think I've been misunderstood.
In other words in the *{{FileUploadBase}}* class there's two *deprecated*
methods : *{{isMultipartContent}}* & *{{parseRequest}}* which they are
dependent to the {{javax.servlet}} by there parameters\{{. }}Event If I use
UploadContext with FileUpload class I have to add the {{javax.servlet}}
dependency because {{FileUpload}} extends {{FileUploadBase}} with the two
deprecated methods.\{{}}
All I want is a new version of {{FileUploadBase *without* the two deprecated
methods. Hence I can use FileUpload without being forced to add dependecy to
}}{{javax.servlet (I'm not in a servlet based webapp).}}{{}}
> Do not have dependency on javax.servlet
> ---------------------------------------
>
> Key: FILEUPLOAD-303
> URL: https://issues.apache.org/jira/browse/FILEUPLOAD-303
> Project: Commons FileUpload
> Issue Type: Improvement
> Affects Versions: 1.4
> Reporter: Mohamed
> Priority: Major
>
> I'm trying to use FileUpload in my playframework projet to parse a
> multipart/mixed request. Every thing works well if I add the *javax.servlet*
> depency, which I do not use completely.
>
> I have created my own RequestContext like:
>
> {{public static class PlayRequestContext implements UploadContext {}}
> {{ private final Http.Request request;}}
> {{ private final ByteString bodyBuffer;}}
> {{ public PlayRequestContext(Http.Request request) {}}
> {{ this.request = request;}}
> {{ bodyBuffer = request.body().asBytes();}}
> {{ }}}
> {{ @Override}}
> {{ public String getCharacterEncoding() {}}
> {{ return StandardCharsets.ISO_8859_1.displayName();}}
> {{ }}}
> {{ @Override}}
> {{ public String getContentType() {}}
> {{ return
> request.getHeaders().get(Http.HeaderNames.CONTENT_TYPE).orElseThrow(unexpectedCase());}}
> {{ }}}
> {{ @Override}}
> {{ @Deprecated}}
> {{ public int getContentLength() {}}
> {{ return 0;}}
> {{ }}}
> {{ @Override}}
> {{ public InputStream getInputStream() {}}
> {{ return new ByteArrayInputStream(bodyBuffer.toArray());}}
> {{ }}}
> {{ @Override}}
> {{ public long contentLength() {}}
> {{ return bodyBuffer.length();}}
> {{ }}}
> {{}}}
>
> Is it possible to have another version without any dependecny to
> javax.servlet ?
>
> I thinks this is a great solution for every web application, not only servlet
> dependent projects.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)