[Geoserver-users] Problem with multipart request in OWS service

I write a OWS service to take the files transferred from remote client. I
have tried the below 4 combination of codes at client & OWS service:

                                   'commons-httpclient:3.1'
'org.apache.httpcomponents:httpclient:4.3.1'

Springframework Works Not
works

commons fileupload V-1.3 Not works Not works

I would want to avoid using httpclient V3.1 as it is pretty old, but other
combinations do not seem to work. Just for test, I keep the client code
same(i.e. using commons-httpclient:3.1) & use the below 2 codes at OWS
service.

// Using springframework's MultipartHttpServletRequest works:

public void transfer(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
    if (req instanceof MultipartHttpServletRequest) {
        Map<String, MultipartFile> files =
((MultipartHttpServletRequest)request).getFileMap();
        Iterator<Map.Entry&lt;String, MultipartFile>> entries =
files.entrySet().iterator();
        while (entries.hasNext()) {
            // Does come inside while loop. So I can save my file to disk.
        }
    }
}

// Using 'commons-fileupload:1.3' does not work:
public void transfer(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
    if (ServletFileUpload.isMultipartContent(request)){
        FileItemIterator iter =
ServletFileUpload().getItemIterator(request);
        while (iter.hasNext()) {
            // Doesnt come inside while loop. "iter" is empty. So I cant
save my file to disk.
        }
    }
}

I am not too good at Java. Ideally I want to upgrade my httpclient to the
latest one & also avoid springframework... Should i add anything in
applicationContext.xml ??... Could anyone please help me with this ?

Regards,
Sunil

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Problem-with-multipart-request-in-OWS-service-tp5094174.html
Sent from the GeoServer - User mailing list archive at Nabble.com.