You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Angelo Chen <an...@yahoo.com.hk> on 2008/12/04 08:27:41 UTC

t5.0.17: Tapestry-upload exception?

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


Re: t5.0.17: Tapestry-upload exception?

Posted by Martijn Brinkers <ma...@gmail.com>.
It makes it easier to distinguish between exceptions because of max
upload exceeded and 'regular' exceptions. A upload exceed exception is
something that can happen during normal usage of your web application
whereas regular exceptions should not happen under normal
circumstances. 

Martijn

On Fri, 2008-12-05 at 02:11 -0800, Angelo Chen wrote:
> 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
> >> <an...@yahoo.com.hk>
> >> > 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
> >> >>> <an...@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
> >> >>
> >> >>
> >> > 
> >> > 
> >> > 
> >> > -- 
> >> > 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
> >> > 
> >> > 
> >> > 
> >> 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> > 
> > 
> > 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: t5.0.17: Tapestry-upload exception?

Posted by Angelo Chen <an...@yahoo.com.hk>.
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
>> <an...@yahoo.com.hk>
>> > 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
>> >>> <an...@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
>> >>
>> >>
>> > 
>> > 
>> > 
>> > -- 
>> > 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
>> > 
>> > 
>> > 
>> 
> 
> 
> ---------------------------------------------------------------------
> 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--tp20828547p20850985.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


Re: t5.0.17: Tapestry-upload exception?

Posted by Martijn Brinkers <ma...@gmail.com>.
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 <an...@yahoo.com.hk>
> > 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
> >>> <an...@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
> >>
> >>
> > 
> > 
> > 
> > -- 
> > 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
> > 
> > 
> > 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: t5.0.17: Tapestry-upload exception?

Posted by Angelo Chen <an...@yahoo.com.hk>.
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 <an...@yahoo.com.hk>
> 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
>>> <an...@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
>>
>>
> 
> 
> 
> -- 
> 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--tp20828547p20850299.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


Re: t5.0.17: Tapestry-upload exception?

Posted by Howard Lewis Ship <hl...@gmail.com>.
Its an event that gets triggered on the page.

On Thu, Dec 4, 2008 at 1:41 PM, Angelo Chen <an...@yahoo.com.hk> 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 <an...@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
>
>



-- 
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


Re: t5.0.17: Tapestry-upload exception?

Posted by Angelo Chen <an...@yahoo.com.hk>.
 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 <an...@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


Re: t5.0.17: Tapestry-upload exception?

Posted by Howard Lewis Ship <hl...@gmail.com>.
This change is related to https://issues.apache.org/jira/browse/TAP5-272

On Wed, Dec 3, 2008 at 11:27 PM, Angelo Chen <an...@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