[ 
https://issues.apache.org/jira/browse/AXIS2-4756?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12883569#action_12883569
 ] 

Detelin Yordanov commented on AXIS2-4756:
-----------------------------------------

This can be solved by providing custom implementation of 
org.apache.commons.fileupload.RequestContext that supports handling of an 
AxisHttpRequest.

Afterwards, the following simple modifications will do the trick:

1. When serving a request, the HTTPWorker will need to set the AxisHttpRequest 
in the MC
2. The MultipartFormDataBuilder will check for an AxisHttpRequest if it does 
not find an HttpServletRequest and will use the custom "AxisHttpRequestContext" 
implementation to extract the multipart parameters.

I created a patch, but it was mean for Axis2 1.4.1 and it is not very 
appropriate for Axis2 1.5 since the http transport classes are moved to a 
separate module and the MultipartFormDataBuilder is not able to reference them 
anymore.
As a workaround I provided a new MultipartFormDataBuilder in the http transport 
module, which extends the one in axis2 kernel.

If running Axis2 standalone , users will need to specify that one in the 
axis2.xml, e.g.:

<messageBuilders>
   ...
    <messageBuilder contentType="multipart/form-data" 
class="org.apache.axis2.transport.http.MultipartFormDataBuilder"/>
</messageBuilders>

Is should be possible to use some factory mechanism to avoid having two 
MultipartFormDataBuilder implementations. But this would require some design 
changes which I will leave to you.





> Standalone Axis2 server cannot handle multipart http requests
> -------------------------------------------------------------
>
>                 Key: AXIS2-4756
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4756
>             Project: Axis2
>          Issue Type: Bug
>          Components: kernel, transports
>    Affects Versions: 1.5.1, nightly
>            Reporter: Detelin Yordanov
>         Attachments: FileUploadService.aar, MultiPartHttpTest.zip
>
>
> When running a standalone Axis2 server and a multipart Http request is 
> received, the org.apache.axis2.builder.MultipartFormDataBuilder will throw an 
> exception: "Cannot create DocumentElement without HttpServletRequest".
> Reason for this is that the Axis2 Http server wraps the incoming http request 
> into an AxisHttpRequest and there is no HttpServletRequest available.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to