You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Jeroen Reijn <j....@hippo.nl> on 2005/11/10 11:17:37 UTC

[ExceptionHandling] Catching "Content length exceeds maximum upload size"

Hi guys,

I hope somebody can help me out.Here is the situation:

I have a Cform with a file upload widget.
When I submit the form with a file that is bigger then the max allowed file
size, it throws a nice "Content length exceeds maximum upload size" error.

I'm under the impression that I could use the ExceptionSelector to catch this error.

So this is what I did:

Define the selector in my sitemap:

<map:selector name="exception"
      src="org.apache.cocoon.selection.ExceptionSelector"
      logger="sitemap.selector.exception-selector">
   <exception name="toolarge" class="java.io.IOException"/>
</map:selector>

I've put both matchers in a seperate pipeline with a handle-errors part:

<map:pipeline type="noncaching" internal-only="false">

   <map:match pattern="*.continue">
     <map:call continuation="{1}"/>
   </map:match>

   <map:match pattern="actionsform/*/**">
     <map:call function="availableActionsCachingHandleForm">
       <map:parameter name="function" value="actionsform2xml"/>
       <map:parameter name="form-definition"
            value="cocoon:/actions2formmodel/{1}/{2}"/>
       <map:parameter name="resourceId" value="/{1}/{2}"/>
     </map:call>
   </map:match>

   <map:handle-errors>
     <map:select type="exception">
       <map:when test="toolarge">
         <map:generate src="status.xml"/>
         <map:serialize type="xml"/>
       </map:when>
     </map:select>
   </map:handle-errors>

</map:pipeline>

But when I get the error nothing happens. The selector does not get triggered.
It returns the same error I got before. Any clues? Or is there a better way of
doing this?

Thanks in advance!

Jeroen Reijn


Re: [ExceptionHandling] Catching "Content length exceeds maximum upload size"

Posted by Jean-Baptiste Quenot <jb...@anyware-tech.com>.
* Jeroen Reijn:

> I have  a Cform with  a file upload  widget.  When I  submit the
> form with a file that is  bigger then the max allowed file size,
> it throws  a nice "Content  length exceeds maximum  upload size"
> error.

This occurs in the processing of the HTTP request thus cannot be
handled by your pipeline.  But this problem has been adressed, see
http://svn.apache.org/viewcvs.cgi?view=rev&rev=280876
-- 
Jean-Baptiste Quenot
Systèmes d'Information
ANYWARE TECHNOLOGIES
Tel : +33 (0)5 61 00 52 90
Fax : +33 (0)5 61 00 51 46
http://www.anyware-tech.com/