tapestry-users mailing list archives

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

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


Mime
View raw message