cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeroen Reijn <j.re...@hippo.nl>
Subject [ExceptionHandling] Catching "Content length exceeds maximum upload size"
Date Thu, 10 Nov 2005 10:17:37 GMT
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


Mime
View raw message