Upload control causes null request content type

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Upload control causes null request content type

Nathan Jones-2
When I submit a form which contains an upload control I get the exception:

org.apache.commons.fileupload.FileUploadBase$InvalidContentTypeException: the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is null

However, I have checked the tomcat logs and I see that the request contains:

header=content-type=multipart/form-data; boundary=---------------------------7d737e25ed0574

Somehow the content type is being set to null by Orbeon. Has anyone else experienced such an issue?

- Nathan




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Upload control causes null request content type

Alessandro Vernet
Administrator
Nathan,

On 8/15/07, Nathan Jones <[hidden email]> wrote:
> When I submit a form which contains an upload control I get the exception:
>
> org.apache.commons.fileupload.FileUploadBase$InvalidContentTypeException: the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is null
>
> However, I have checked the tomcat logs and I see that the request contains:
>
> header=content-type=multipart/form-data; boundary=---------------------------7d737e25ed0574
>
> Somehow the content type is being set to null by Orbeon. Has anyone else experienced such an issue?

I am using the xforms:upload but have never seen this. Would you have
a test case we can use to reproduce this? Maybe a stand-alone
directory we could deploy under apps could do the trick.

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Upload control causes null request content type

Nathan Jones-2
In reply to this post by Nathan Jones-2
I have debugged through orbeon to try to work out why the content type appears to be null.

org.orbeon.oxf.servlet.ServletExternalContext.getParameterMapMultipart() creates an anonymous inner instance of org.orbeon.oxf.util.HttpServletRequestStub (which returns null for every method) but does not override the getContentType method. This dummy wrapper is passed to org.apache.commons.fileupload.DiskFileUpload.parseRequest() which results in an exception when it checks to make sure the request has a multipart content type. This seems like a bug, although I can't understand why no one else gets this problem. We are using commons-fileupload 1.1.

- Nathan




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Upload control causes null request content type

Nathan Jones-2
I resolved the issue by putting  commons-fileupload 1.0 on the class path instead of 1.1.

Maybe the methods in HttpServletRequestStub should throw runtime exeptions instead of returning null.

- Nathan




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Upload control causes null request content type

Erik Bruchez
Administrator
Nathan Jones wrote:
> I resolved the issue by putting  commons-fileupload 1.0 on the class path instead of 1.1.
>
> Maybe the methods in HttpServletRequestStub should throw runtime exeptions instead of returning null.

Yes that's surprising. It may just be a matter of adding this to the
innter class:

public String getContentType() {
     return request.getContainerType();
}

Did you build the code yourself from CVS? If so you may want to try the
above with commons-fileupload 1.1.

-Erik

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Upload control causes null request content type

Alessandro Vernet
Administrator
In reply to this post by Nathan Jones-2
Nathan,

On 8/20/07, Nathan Jones <[hidden email]> wrote:
> I resolved the issue by putting  commons-fileupload 1.0 on the class path instead of 1.1.
>
> Maybe the methods in HttpServletRequestStub should throw runtime exeptions instead of returning null.

Yes, I guess this would make sense. I am adding a bug for this. And we
will definitely have to pay attention to this when upgrading to
commons-fileupload 1.1.

http://forge.objectweb.org/tracker/index.php?func=detail&aid=307473&group_id=168&atid=350207

Was there a specific reason why you were using 1.1 instead of the 1.0
that ships with Orbeon Forms? If you need to use 1.1 and can
contribute a patch to fix the issue, we will be happy put it in.

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Upload control causes null request content type

Alessandro Vernet
Administrator
Nathan,

On 8/24/07, Alessandro Vernet <[hidden email]> wrote:
> http://forge.objectweb.org/tracker/index.php?func=detail&aid=307473&group_id=168&atid=350207

Erik now has implemented getContentType() in the subclass used in
ServletExternalContext. So if this was the only problem that prevented
an upgrade to commons-fileupload 1.1, you might now be able to do the
upgrade. You'll let us know if you get a chance to try this.

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Upload control causes null request content type

Nathan Jones-2
Thanks guys. We did build the code ourselves, but it was actually just by accident that I had the wrong version of commons-fileupload on the classpath. We will continue to use 1.0.

- Nathan




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws