Hi, Thanks, this works, also this: public Object onUploadException(Throwable cause) { upload_form.recordError("Please limit file size to 500K or below."); return this; }
but why this not working: public Object onException(Throwable cause) { String x = cause.getMessage(); System.out.println("error"); return this; } Martijn Brinkers (List)-2 wrote: > > I use it like this: > > @OnEvent(UploadEvents.UPLOAD_EXCEPTION) > protected Object onUploadException(FileUploadException > uploadException) > { > return this; > } > > > Regards, > > Martijn Brinkers > > On Fri, 2008-12-05 at 01:19 -0800, Angelo Chen wrote: >> Hi Howard, >> I added this, but it was never called, any idea how to handle this: >> >> Object onException(Throwable cause) >> { >> String x = cause.getMessage(); >> >> System.out.println("error"); >> >> return this; >> } >> thanks >> >> >> Howard Lewis Ship wrote: >> > >> > Its an event that gets triggered on the page. >> > >> > On Thu, Dec 4, 2008 at 1:41 PM, Angelo Chen >> <[EMAIL PROTECTED]> >> > wrote: >> >> >> >> Hi Howard, >> >> >> >> Thanks, so uploadException is the solution, request filter not needed >> any >> >> more. then, how to catch the uploadException in the page? >> >> >> >> Angelo >> >> >> >> >> >> Howard Lewis Ship wrote: >> >>> >> >>> This change is related to >> https://issues.apache.org/jira/browse/TAP5-272 >> >>> >> >>> On Wed, Dec 3, 2008 at 11:27 PM, Angelo Chen >> >>> <[EMAIL PROTECTED]> >> >>> wrote: >> >>>> >> >>>> Hi, >> >>>> >> >>>> I have a request filter which works in 5.0.15 but not working any >> more >> >>>> in >> >>>> 5.0.17, the purpose is to capture exceptions in the uploading of >> files >> >>>> when >> >>>> using tapestry-upload module and redirect to a specific page when it >> >>>> encounter FileSizeLimitExceededException. Problem now in 5.0.17 is, >> if >> >>>> there >> >>>> is an exception under : >> >>>> >> >>>> result = handler.service(request, response); >> >>>> >> >>>> it never throw the exception to the catch(), but I do see those >> >>>> exceptions >> >>>> in the log, but not coming from my class, any ideas? Thanks. >> >>>> >> >>>> >> >>>> public class UploadRequestFilter implements HttpServletRequestFilter >> { >> >>>> >> >>>> public boolean service(HttpServletRequest request, >> >>>> HttpServletResponse >> >>>> response, >> >>>> HttpServletRequestHandler handler) throws >> >>>> IOException { >> >>>> boolean result = true; >> >>>> try { >> >>>> result = handler.service(request, response); >> >>>> } catch (RuntimeException e) { >> >>>> Throwable err = e.getCause(); >> >>>> if (err instanceof >> >>>> FileUploadBase.FileSizeLimitExceededException) { >> >>>> response.sendRedirect("/info/filesizeproblem"); >> >>>> } else if (err instanceof >> >>>> FileUploadBase.IOFileUploadException) >> >>>> { >> >>>> try { >> >>>> throw err; >> >>>> } catch (Throwable throwable) { >> >>>> throwable.printStackTrace(); >> >>>> } >> >>>> } else { >> >>>> } >> >>>> } >> >>>> return result; >> >>>> } >> >>>> } >> >>>> >> >>>> under AppModule.java: >> >>>> >> >>>> binder.bind(HttpServletRequestFilter.class, >> >>>> UploadRequestFilter.class).withId("UploadRequestFilter"); >> >>>> >> >>>> >> >>>> public static void contributeHttpServletRequestHandler( >> >>>> OrderedConfiguration<HttpServletRequestFilter> >> configuration, >> >>>> @InjectService("UploadRequestFilter") >> >>>> HttpServletRequestFilter uploadFilter) { >> >>>> System.out.println("contributing uploadfilter"); >> >>>> configuration.add("UploadRequestFilter", uploadFilter, >> >>>> "before:MultipartFilter"); >> >>>> >> >>>> } >> >>>> >> >>>> >> >>>> -- >> >>>> View this message in context: >> >>>> >> http://www.nabble.com/t5.0.17%3A-Tapestry-upload-exception--tp20828547p20828547.html >> >>>> Sent from the Tapestry - User mailing list archive at Nabble.com. >> >>>> >> >>>> >> >>>> >> --------------------------------------------------------------------- >> >>>> To unsubscribe, e-mail: [EMAIL PROTECTED] >> >>>> For additional commands, e-mail: [EMAIL PROTECTED] >> >>>> >> >>>> >> >>> >> >>> >> >>> >> >>> -- >> >>> Howard M. Lewis Ship >> >>> >> >>> Creator Apache Tapestry and Apache HiveMind >> >>> >> >>> --------------------------------------------------------------------- >> >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >> >>> For additional commands, e-mail: [EMAIL PROTECTED] >> >>> >> >>> >> >>> >> >> >> >> -- >> >> View this message in context: >> >> >> http://www.nabble.com/t5.0.17%3A-Tapestry-upload-exception--tp20828547p20843096.html >> >> Sent from the Tapestry - User mailing list archive at Nabble.com. >> >> >> >> >> >> --------------------------------------------------------------------- >> >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >> >> > >> > >> > >> > -- >> > Howard M. Lewis Ship >> > >> > Creator Apache Tapestry and Apache HiveMind >> > >> > --------------------------------------------------------------------- >> > 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] > > > -- View this message in context: http://www.nabble.com/t5.0.17%3A-Tapestry-upload-exception--tp20828547p20850985.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]