[ 
https://issues.apache.org/jira/browse/FILEUPLOAD-303?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17114356#comment-17114356
 ] 

Jochen Wiedmann commented on FILEUPLOAD-303:
--------------------------------------------

Removing the javax.servlet dependency is out of the question. Commons 
Fileupload has been made with the intent to use it with as little effort as 
possible in a webapp, and that won't change. On the other hand, the separation 
between the FileUpload class, and the UploadContext has clearly been 
implemented with the intention to make your aim possible. And, knowing the 
sources, as I do, I don't see any reason, why a properly implemented 
UploadContext shouldn't do the trick. So, my first guess would be, that there 
is a problem in your {{PlayRequestContext.}}

 

 

On the other hand 

> 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)

Reply via email to