tapestry-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Angelo Chen <angelochen...@yahoo.com.hk>
Subject Re: t5.0.17: Tapestry-upload exception?
Date Thu, 04 Dec 2008 21:41:22 GMT

 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 <angelochen960@yahoo.com.hk>
> 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: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 
> 
> -- 
> Howard M. Lewis Ship
> 
> Creator Apache Tapestry and Apache HiveMind
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
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: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Mime
View raw message