Karen,
As the exception is thrown in AbstractEngine.service() and before your
page is even loaded from the pool I think you have but one option for
improving the presentation of this error.
1) create your own implementation of ExceptionPage. End users usually
don't appreciate the presentation of the default ExceptionPage as much
as we developers do!
2) subclass BaseEngine and override
protected void activateExceptionPage(
IRequestCycle cycle,
ResponseOutputStream output,
Throwable cause)
throws ServletException {
//check for the upload exeption
if (cause instanceof yadayada) {
cause = a new Exception with your user friendly message;
}
super(cycle, output, cause);
}
Clear as mud?
I don't use Upload so I can't help much with the configuration issue.
Geoff
On 8/22/05, Karen <[EMAIL PROTECTED]> wrote:
> Hi Geoff,
>
> Here is the stack trace:
>
> org.apache.tapestry.ApplicationRuntimeException
> Unable to decode request: the request was rejected because it's size exceeds
> allowed range
>
> org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException
> the request was rejected because it's size exceeds allowed range
> Stack Trace:
>
> *org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:317)
>
> *org.apache.commons.fileupload.DiskFileUpload.parseRequest(DiskFileUpload.java:245)
>
> *org.apache.tapestry.multipart.DefaultMultipartDecoder.decode(DefaultMultipartDecoder.java:159)
>
> *org.apache.tapestry.request.RequestContext.getDecoder(RequestContext.java:1077)
>
> *org.apache.tapestry.request.RequestContext.getParameter(RequestContext.java:440)
>
> *org.apache.tapestry.engine.AbstractEngine.extractServiceName(AbstractEngine.java:2063)
>
> *org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:864)
>
> *org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:198)
>
> *org.apache.tapestry.ApplicationServlet.doPost(ApplicationServlet.java:327)
> *javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> *javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>
> *org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>
> *org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>
> *org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
>
> *org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
>
> *org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
>
> *org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>
> *org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
>
> *org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
> *org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:307)
> *org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:385)
> *org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:748)
>
> *org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:678)
> *org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:871)
>
> *org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
> *java.lang.Thread.run(Thread.java:595)
>
> Page specification:
> --------------------------
> <application name="XTapestryModule"
> engine-class="org.apache.tapestry.engine.BaseEngine" >
> <description><![CDATA[ add a description ]]></description>
>
> <page name="Home" specification-path="Home.page"/>
> <page name="MainPage" specification-path="Main/Main.page"/>
>
> <extension name="org.apache.tapestry.multipart-decoder"
> class="org.apache.tapestry.multipart.DefaultMultipartDecoder">
> <configure property-name="maxSize" type="double" value="134217728"/>
> </extension>
> </application>
>
> HTML:
> --------
> <form jwcid="@Form" listener="ognl:listeners.submit">
> <table border="0" cellspacing="0" cellpadding="0">
> <tr>
> <th>File </th>
> <td><input jwcid="@Upload" file="ognl:file" type=
> "file"></input></td>
> </tr>
> <tr>
> <th> </th>
> <td>
> <input type="submit" jwcid="@Submit"
> selected="ognl:submitBtn"
> tag="Upload" value="Upload"/>
> <input type="button" jwcid="@Submit"
> selected="ognl:submitBtn"
> tag="Cancel" value="Cancel"/>
> </td>
> </tr>
> </table>
> </form>
>
> Template class listener:
> --------------------------------
>
> public void submit(IRequestCycle cycle) {
> log.info("[Enter] public void submit(IRequestCycle cycle)");
> String submit = getSubmitBtn();
> if (submit == null) submit = "";
>
> try {
> if (submit.equalsIgnoreCase("CANCEL")) {
> changePage(cycle, "MainPage");
> } else if (submit.equalsIgnoreCase("UPLOAD")) {
> if (getFile() != null &&
> getFile().getFileName().length() > 0) {
> //UPLOAD FILE
> }
> }
> } catch (ApplicationRuntimeException e) {
> log.error(e);
> changePage(cycle, "MainPage");
> } catch (Exception e) {
> log.error(e);
> changePage(cycle, "MainPage");
> }
> log.info("[Exit] public void submit(IRequestCycle cycle)");
> }
>
>
> I tried to catch the "ApplicationRuntimeException " in the form listener, but
> the exception thrown prior entering the listener. Not even enter the page
> begin render as well.
>
> According to the Upload component reference example, I can set max upload file
> size by adding the section below in the .application file.
>
> <extension name="org.apache.tapestry.multipart-decoder"
> class="org.apache.tapestry.multipart.DefaultMultipartDecoder">
> <configure property-name="maxSize" type="double" value="134217728"/>
> </extension>
>
> Still I got the same exception when I do an upload of 14MB file.
>
> Please advise. Thank you.
>
> Regards,
> K.
>
> On Saturday 20 August 2005 09:37, Geoff Longman wrote:
> > Could you post the stack trace?
> >
> > Geoff
> >
> > On 8/19/05, Karen Low <[EMAIL PROTECTED]> wrote:
> > > Actually I did it in the form listener. However, the exception was thrown
> > > before the request hit page begin render. Hence, even i put a catch block
> > > in my listener, is of no use.
> > >
> > > Any idea?
> > >
> > > K.
> > >
> > > On Friday 19 August 2005 12:05, Patrick Casey wrote:
> > > > What happens when you try to catch it in the submit listener?
> > > > Does your catch block not run? Or are you trying to redirect directly
> > > > from there?
> > > >
> > > > If memory serves, if you want to navigate via cycle.activate()
> > > > you have to do it in the form listener method, not the submit button's
> > > > listener message.
> > > >
> > > > Altnerately, did you try catching the applicaitonruntimeexception
> > > > and re-throwing a PageRedirectException?
> > > >
> > > > --- Pat
> > > >
> > > > > -----Original Message-----
> > > > > From: Karen [mailto:[EMAIL PROTECTED]
> > > > > Sent: Thursday, August 18, 2005 8:48 PM
> > > > > To: 'Tapestry users'
> > > > > Subject: File upload size problem
> > > > >
> > > > > Hi,
> > > > >
> > > > > I'm using Tapestry's Upload component to upload files. It throws
> > > > > org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededExcepti
> > > > >on when
> > > > > the upload file size exceed the allow range. What I need to do is to
> > > > > turn that exception to a more meaningful message before display to
> > > > > the HTML page.
> > > > >
> > > > > I tried to catch the ApplicationRuntimeException from the submit
> > > > > listener's
> > > > > method, but to no avail.
> > > > >
> > > > > How to catch the ApplicationRuntimeException when this happen? Please
> > > > > advise.
> > > > >
> > > > > Thank you.
> > > > >
> > > > > Regards,
> > > > > Karen
> > > > >
> > > > > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > For additional commands, e-mail:
> > > > > [EMAIL PROTECTED]
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
The Spindle guy. http://spindle.sf.net
Get help with Spindle:
http://lists.sourceforge.net/mailman/listinfo/spindle-user
Announcement Feed:
http://www.jroller.com/rss/glongman?catname=/Announcements
Feature Updates: http://spindle.sf.net/updates
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]