You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "K. Rumman Akhter" <ka...@sputnik7.com> on 2000/03/07 00:36:08 UTC

multi part mime requests

i am trying to set up file uploads using

<form ENCTYPE="multipart/form-data" method="POST" action="addfile.xml">

and in addfile.xml, am using xsp's to break apart the httprequest object,
but so far, my multipart request only have the headers but when i start
reading the multipart boundaries, i start getting null, which means that the
multi-parts are not getting sent. is the request object on xsp's a standard
request object, or is the xsp processor striping down/adding to the request?

thanks,
RUm

***
K h o n d k e r RUmman A k h t e r
Programmer
sputnik7.com

kakhter@sputnik7.com


RE: multi part mime requests

Posted by "K. Rumman Akhter" <ka...@sputnik7.com>.
Gabor,

I also am trying to use the o'reilly package. This is what i have in my
xml/xsl form:

<form ENCTYPE="multipart/form-data" method="POST" action="addfile.xml">
 <input type="file">
   <xsl:attribute name="name">
    <xsl:value-of select="@name"/>
   </xsl:attribute>
 </input>
</form>

and here is my addfile.xml:
********************************************************************
<xsp:page
   language="java"
   xmlns:request="http://www.apache.org/1999/XSP/Request"
   xmlns:util="http://www.apache.org/1999/XSP/Util"
   xmlns:xsp="http://www.apache.org/1999/XSP/Core"
>

<xsp:structure>
 <xsp:include>com.oreilly.servlet.MultipartRequest</xsp:include>
</xsp:structure>
 <page>
  <files>
   <xsp:logic>
    session = request.getSession(false);
    MultipartRequest multi = new MultipartRequest(request, ".");
    String name ="";
    String filename = "";
    String type = "";

    Enumeration files = multi.getFileNames();
    while (files.hasMoreElements())
    {
     <file>
      String name = (String)files.nextElement();
      <xsp:expr>name</xsp:expr>
      String filename = multi.getFilesystemName(name);
      <xsp:expr>filename</xsp:expr>
      String type = multi.getContentType(name);
      <xsp:expr>type</xsp:expr>
      File f = multi.getFile(name);
     </file>
    }
   </xsp:logic>
  </files>
 </page>
</xsp:page>
******************************************************************

i haven't done anything with the file yet, but you get the idea. i cannot
understand what i am doing wrong. any help would be appreciated



-----Original Message-----
From: Gabor Dolla [mailto:
Sent: Tuesday, March 07, 2000 4:58 AM
To: cocoon-users@xml.apache.org
Cc: cocoon-dev@xml.apache.org
Subject: Re: multi part mime requests


I handle multipart/form-data with my producer and o'reilly's servlet tool

Gabor



RE: multi part mime requests

Posted by "K. Rumman Akhter" <ka...@sputnik7.com>.
i should also mention that this is the error message cocoon is giving me:

(...after a long pause, as if, it is waiting for something, or a timeout...)

java.io.IOException: Corrupt form data: premature ending
	at com.oreilly.servlet.MultipartRequest.readRequest(MultipartRequest.java,
Compiled Code)
	at java.lang.Exception.(Unknown Source)
	at java.io.IOException.(Unknown Source)
	at com.oreilly.servlet.MultipartRequest.readRequest(MultipartRequest.java,
Compiled Code)
	at com.oreilly.servlet.MultipartRequest.(MultipartRequest.java:147)
	at com.oreilly.servlet.MultipartRequest.(MultipartRequest.java:104)
	at _E_._htdocs._NewsMan._UI._addfile.populateDocument(_addfile.java,
Compiled Code)
	at org.apache.cocoon.processor.xsp.XSPPage.getDocument(XSPPage.java:96)
	at org.apache.cocoon.processor.xsp.XSPProcessor.process(XSPProcessor.java,
Compiled Code)
	at org.apache.cocoon.Engine.handle(Engine.java, Compiled Code)
	at org.apache.cocoon.Cocoon.service(Cocoon.java:145)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:840)
	at com.livesoftware.jrun.JRun.runServlet(JRun.java, Compiled Code)
	at com.livesoftware.jrun.JRunGeneric.handleConnection(JRunGeneric.java:116)
	at
com.livesoftware.jrun.JRunGeneric.handleProxyConnection(JRunGeneric.java:78)
	at
com.livesoftware.jrun.service.proxy.JRunProxyServiceHandler.handleRequest(JR
unProxyServiceHandler.java:102)
	at
com.livesoftware.jrun.service.ThreadConfigHandler.run(ThreadConfigHandler.ja
va, Compiled Code)

thanks,
RUm


Re: multi part mime requests

Posted by Gabor Dolla <ag...@mezon.net>.
I handle multipart/form-data with my producer and o'reilly's servlet tool

Gabor


On Mon, 6 Mar 2000, Donald Ball wrote:

> On Mon, 6 Mar 2000, K. Rumman Akhter wrote:
> 
> > i am trying to set up file uploads using
> > 
> > <form ENCTYPE="multipart/form-data" method="POST" action="addfile.xml">
> > 
> > and in addfile.xml, am using xsp's to break apart the httprequest object,
> > but so far, my multipart request only have the headers but when i start
> > reading the multipart boundaries, i start getting null, which means that the
> > multi-parts are not getting sent. is the request object on xsp's a standard
> > request object, or is the xsp processor striping down/adding to the request?
> 
> terribly unfortunately, most servlet engines cannot parse
> multipart/form-data requests with their default HttpServletRequest impl.
> oddly enough, code to do it manually is slightly hard to find on the 'net.
> even more unfortunately, cocoon messes with the request object, so that
> even if you found some code to do it for you, you're SOL since cocoon will
> have already messed with the inputstream. moral of the story - if you want
> to handle file uploads, do it in a standalone servlet or even easier, a
> perl cgi, and use redirect to send user back to cocoon-land.
> 
> - donald
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
> 


Re: multi part mime requests

Posted by Gabor Dolla <ag...@mezon.net>.
I handle multipart/form-data with my producer and o'reilly's servlet tool

Gabor


On Mon, 6 Mar 2000, Donald Ball wrote:

> On Mon, 6 Mar 2000, K. Rumman Akhter wrote:
> 
> > i am trying to set up file uploads using
> > 
> > <form ENCTYPE="multipart/form-data" method="POST" action="addfile.xml">
> > 
> > and in addfile.xml, am using xsp's to break apart the httprequest object,
> > but so far, my multipart request only have the headers but when i start
> > reading the multipart boundaries, i start getting null, which means that the
> > multi-parts are not getting sent. is the request object on xsp's a standard
> > request object, or is the xsp processor striping down/adding to the request?
> 
> terribly unfortunately, most servlet engines cannot parse
> multipart/form-data requests with their default HttpServletRequest impl.
> oddly enough, code to do it manually is slightly hard to find on the 'net.
> even more unfortunately, cocoon messes with the request object, so that
> even if you found some code to do it for you, you're SOL since cocoon will
> have already messed with the inputstream. moral of the story - if you want
> to handle file uploads, do it in a standalone servlet or even easier, a
> perl cgi, and use redirect to send user back to cocoon-land.
> 
> - donald
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
> 


Re: multi part mime requests

Posted by Donald Ball <ba...@webslingerZ.com>.
On Mon, 6 Mar 2000, K. Rumman Akhter wrote:

> i am trying to set up file uploads using
> 
> <form ENCTYPE="multipart/form-data" method="POST" action="addfile.xml">
> 
> and in addfile.xml, am using xsp's to break apart the httprequest object,
> but so far, my multipart request only have the headers but when i start
> reading the multipart boundaries, i start getting null, which means that the
> multi-parts are not getting sent. is the request object on xsp's a standard
> request object, or is the xsp processor striping down/adding to the request?

terribly unfortunately, most servlet engines cannot parse
multipart/form-data requests with their default HttpServletRequest impl.
oddly enough, code to do it manually is slightly hard to find on the 'net.
even more unfortunately, cocoon messes with the request object, so that
even if you found some code to do it for you, you're SOL since cocoon will
have already messed with the inputstream. moral of the story - if you want
to handle file uploads, do it in a standalone servlet or even easier, a
perl cgi, and use redirect to send user back to cocoon-land.

- donald


Re: multi part mime requests

Posted by Donald Ball <ba...@webslingerZ.com>.
On Mon, 6 Mar 2000, K. Rumman Akhter wrote:

> i am trying to set up file uploads using
> 
> <form ENCTYPE="multipart/form-data" method="POST" action="addfile.xml">
> 
> and in addfile.xml, am using xsp's to break apart the httprequest object,
> but so far, my multipart request only have the headers but when i start
> reading the multipart boundaries, i start getting null, which means that the
> multi-parts are not getting sent. is the request object on xsp's a standard
> request object, or is the xsp processor striping down/adding to the request?

terribly unfortunately, most servlet engines cannot parse
multipart/form-data requests with their default HttpServletRequest impl.
oddly enough, code to do it manually is slightly hard to find on the 'net.
even more unfortunately, cocoon messes with the request object, so that
even if you found some code to do it for you, you're SOL since cocoon will
have already messed with the inputstream. moral of the story - if you want
to handle file uploads, do it in a standalone servlet or even easier, a
perl cgi, and use redirect to send user back to cocoon-land.

- donald