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/08/27 15:44:06 UTC

T5: how to caught those exceptions uncaught by T5?

Hi,

I would like to catch the exception of FileSizeLimitExceededException, I
tried the decorator method like this:

public RequestExceptionHandler decorateRequestExceptionHandler(
          final Logger logger,
          final ResponseRenderer renderer,
          final ComponentSource componentSource,
          @Symbol(SymbolConstants.PRODUCTION_MODE)
          boolean productionMode,
          Object service)
  {
      System.out.println("exception!");
      return null;
}

but this method will not be called if the exception is
FileSizeLimitExceededException, the error simply dumps to the browser
screen, 
any idea why those errors can not be caught?

// limit the size of uploading file

public static void contributeApplicationDefaults( 
MappedConfiguration<String, String> configuration) 
{ 
   	configuration.add(UploadSymbols.REQUESTSIZE_MAX, "1000000"); 
	configuration.add(UploadSymbols.FILESIZE_MAX, "500000"); 
} 


-- 
View this message in context: http://www.nabble.com/T5%3A-how-to-caught-those-exceptions-uncaught-by-T5--tp19181261p19181261.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: how to caught those exceptions uncaught by T5?

Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
Hi,

This is just off the top of my head, but perhaps you can get the page 
through ComponentSource, set the property (it'll need to have a public 
setter, of course), get the page's ComponentResources and create a 
PageLink to the page, and send a redirect using that.

That *might* work.

-Filip

On 2008-08-28 04:52, Angelo Chen wrote:
> Hi Filip,
> 
> Thanks for the digging, and it's really a good idea, works very well to
> catch those exceptions.
> here is a sample code of my filter:
> public boolean service(HttpServletRequest request, HttpServletResponse
> response,
>                           HttpServletRequestHandler handler) throws
> IOException {
>        boolean result = true;
>        try {
>            result = handler.service(request, response);
>        } catch (RuntimeException e) {
>              // how to send this exception to the calling page?
> 	  }
> 	return result;
> }	
> 
> if there a way to send the exception back to the calling page's onException
> method?
> 
> Thanks,
> 
> Angelo
> 
> 
> 
> 
> Filip S. Adamsen-
> 2 wrote:
>> Hi Angelo,
>>
>> Having digged through the tapestry-upload source code, I think I may 
>> have found a solution. Or at least something to get you started.
>>
>> The upload stuff is handled, it seems, in MultipartServletRequestFilter, 
>> part of the HttpServletRequestHandler pipeline.
>>
>> If you contribute a HttpServletRequestFilter to the 
>> HttpServletRequestHandler pipeline and order it before the 
>> MultipartFilter ("before:MultipartFilter") you should be able to catch 
>> the exception in the service method and do whatever you want from there.
>>
>> Hope this helps.
>>
>> http://tapestry.apache.org/tapestry5/apidocs/src-html/org/apache/tapestry5/upload/services/UploadModule.html#line.73
>> http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/upload/internal/services/MultipartServletRequestFilter.html
>> http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/services/HttpServletRequestFilter.html
>> http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/services/HttpServletRequestHandler.html
>>
>> -Filip
>>
>> On 2008-08-28 01:20, Angelo Chen wrote:
>>> Hi Filip,
>>>
>>> That make sense. now how to deal these kinds of exceptions? 
>>>
>>>
>>> Filip S. Adamsen-2 wrote:
>>>> Hi Angelo,
>>>>
>>>> I think the upload processing happens before the request gets to where 
>>>> exceptions are caught på RequestExceptionHandler, if that makes sense.
>>>>
>>>> Perhaps that's why?
>>>>
>>>> -Filip
>>>>
>>>> On 2008-08-27 16:37, Angelo Chen wrote:
>>>>> hi,
>>>>>
>>>>> Thanks for the reply. I copied the code from the cookbook,  i deleted
>>>>> the
>>>>> other part, i just want to be sure if the method will be called when an
>>>>> exception occurs, it does with all those normal exceptions, but the 505
>>>>> status dumped coming somewhere from Apache's file upload routine was
>>>>> not
>>>>> caught. any idea>
>>>>>
>>>>>
>>>>> HugoPalma wrote:
>>>>>> That's not how decoration works.
>>>>>> You have to return your RequestExceptionHandler implementation that
>>>>>> will 
>>>>>> decorate the default one. Take a look at the example at the bottom of 
>>>>>> the page here
>>>>>> http://tapestry.apache.org/tapestry5/cookbook/exceptions.html
>>>>>>
>>>>>> Angelo Chen wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> I would like to catch the exception of
>>>>>>> FileSizeLimitExceededException,
>>>>>>> I
>>>>>>> tried the decorator method like this:
>>>>>>>
>>>>>>> public RequestExceptionHandler decorateRequestExceptionHandler(
>>>>>>>           final Logger logger,
>>>>>>>           final ResponseRenderer renderer,
>>>>>>>           final ComponentSource componentSource,
>>>>>>>           @Symbol(SymbolConstants.PRODUCTION_MODE)
>>>>>>>           boolean productionMode,
>>>>>>>           Object service)
>>>>>>>   {
>>>>>>>       System.out.println("exception!");
>>>>>>>       return null;
>>>>>>> }
>>>>>>>
>>>>>>> but this method will not be called if the exception is
>>>>>>> FileSizeLimitExceededException, the error simply dumps to the browser
>>>>>>> screen, 
>>>>>>> any idea why those errors can not be caught?
>>>>>>>
>>>>>>> // limit the size of uploading file
>>>>>>>
>>>>>>> public static void contributeApplicationDefaults( 
>>>>>>> MappedConfiguration<String, String> configuration) 
>>>>>>> { 
>>>>>>>    	configuration.add(UploadSymbols.REQUESTSIZE_MAX, "1000000"); 
>>>>>>> 	configuration.add(UploadSymbols.FILESIZE_MAX, "500000"); 
>>>>>>> } 
>>>>>>>
>>>>>>>
>>>>>>>   
>>>>>> ---------------------------------------------------------------------
>>>>>> 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
>>
>>
>>
> 

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


Re: T5: how to caught those exceptions uncaught by T5?

Posted by Angelo Chen <an...@yahoo.com.hk>.
Hi Filip,

Thanks for the digging, and it's really a good idea, works very well to
catch those exceptions.
here is a sample code of my filter:
public boolean service(HttpServletRequest request, HttpServletResponse
response,
                          HttpServletRequestHandler handler) throws
IOException {
       boolean result = true;
       try {
           result = handler.service(request, response);
       } catch (RuntimeException e) {
             // how to send this exception to the calling page?
	  }
	return result;
}	

if there a way to send the exception back to the calling page's onException
method?

Thanks,

Angelo




Filip S. Adamsen-
2 wrote:
> 
> Hi Angelo,
> 
> Having digged through the tapestry-upload source code, I think I may 
> have found a solution. Or at least something to get you started.
> 
> The upload stuff is handled, it seems, in MultipartServletRequestFilter, 
> part of the HttpServletRequestHandler pipeline.
> 
> If you contribute a HttpServletRequestFilter to the 
> HttpServletRequestHandler pipeline and order it before the 
> MultipartFilter ("before:MultipartFilter") you should be able to catch 
> the exception in the service method and do whatever you want from there.
> 
> Hope this helps.
> 
> http://tapestry.apache.org/tapestry5/apidocs/src-html/org/apache/tapestry5/upload/services/UploadModule.html#line.73
> http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/upload/internal/services/MultipartServletRequestFilter.html
> http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/services/HttpServletRequestFilter.html
> http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/services/HttpServletRequestHandler.html
> 
> -Filip
> 
> On 2008-08-28 01:20, Angelo Chen wrote:
>> Hi Filip,
>> 
>> That make sense. now how to deal these kinds of exceptions? 
>> 
>> 
>> Filip S. Adamsen-2 wrote:
>>> Hi Angelo,
>>>
>>> I think the upload processing happens before the request gets to where 
>>> exceptions are caught på RequestExceptionHandler, if that makes sense.
>>>
>>> Perhaps that's why?
>>>
>>> -Filip
>>>
>>> On 2008-08-27 16:37, Angelo Chen wrote:
>>>> hi,
>>>>
>>>> Thanks for the reply. I copied the code from the cookbook,  i deleted
>>>> the
>>>> other part, i just want to be sure if the method will be called when an
>>>> exception occurs, it does with all those normal exceptions, but the 505
>>>> status dumped coming somewhere from Apache's file upload routine was
>>>> not
>>>> caught. any idea>
>>>>
>>>>
>>>> HugoPalma wrote:
>>>>> That's not how decoration works.
>>>>> You have to return your RequestExceptionHandler implementation that
>>>>> will 
>>>>> decorate the default one. Take a look at the example at the bottom of 
>>>>> the page here
>>>>> http://tapestry.apache.org/tapestry5/cookbook/exceptions.html
>>>>>
>>>>> Angelo Chen wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I would like to catch the exception of
>>>>>> FileSizeLimitExceededException,
>>>>>> I
>>>>>> tried the decorator method like this:
>>>>>>
>>>>>> public RequestExceptionHandler decorateRequestExceptionHandler(
>>>>>>           final Logger logger,
>>>>>>           final ResponseRenderer renderer,
>>>>>>           final ComponentSource componentSource,
>>>>>>           @Symbol(SymbolConstants.PRODUCTION_MODE)
>>>>>>           boolean productionMode,
>>>>>>           Object service)
>>>>>>   {
>>>>>>       System.out.println("exception!");
>>>>>>       return null;
>>>>>> }
>>>>>>
>>>>>> but this method will not be called if the exception is
>>>>>> FileSizeLimitExceededException, the error simply dumps to the browser
>>>>>> screen, 
>>>>>> any idea why those errors can not be caught?
>>>>>>
>>>>>> // limit the size of uploading file
>>>>>>
>>>>>> public static void contributeApplicationDefaults( 
>>>>>> MappedConfiguration<String, String> configuration) 
>>>>>> { 
>>>>>>    	configuration.add(UploadSymbols.REQUESTSIZE_MAX, "1000000"); 
>>>>>> 	configuration.add(UploadSymbols.FILESIZE_MAX, "500000"); 
>>>>>> } 
>>>>>>
>>>>>>
>>>>>>   
>>>>> ---------------------------------------------------------------------
>>>>> 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/T5%3A-how-to-caught-those-exceptions-uncaught-by-T5--tp19181261p19193417.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: how to caught those exceptions uncaught by T5?

Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
Hi Angelo,

Having digged through the tapestry-upload source code, I think I may 
have found a solution. Or at least something to get you started.

The upload stuff is handled, it seems, in MultipartServletRequestFilter, 
part of the HttpServletRequestHandler pipeline.

If you contribute a HttpServletRequestFilter to the 
HttpServletRequestHandler pipeline and order it before the 
MultipartFilter ("before:MultipartFilter") you should be able to catch 
the exception in the service method and do whatever you want from there.

Hope this helps.

http://tapestry.apache.org/tapestry5/apidocs/src-html/org/apache/tapestry5/upload/services/UploadModule.html#line.73
http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/upload/internal/services/MultipartServletRequestFilter.html
http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/services/HttpServletRequestFilter.html
http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/services/HttpServletRequestHandler.html

-Filip

On 2008-08-28 01:20, Angelo Chen wrote:
> Hi Filip,
> 
> That make sense. now how to deal these kinds of exceptions? 
> 
> 
> Filip S. Adamsen-2 wrote:
>> Hi Angelo,
>>
>> I think the upload processing happens before the request gets to where 
>> exceptions are caught på RequestExceptionHandler, if that makes sense.
>>
>> Perhaps that's why?
>>
>> -Filip
>>
>> On 2008-08-27 16:37, Angelo Chen wrote:
>>> hi,
>>>
>>> Thanks for the reply. I copied the code from the cookbook,  i deleted the
>>> other part, i just want to be sure if the method will be called when an
>>> exception occurs, it does with all those normal exceptions, but the 505
>>> status dumped coming somewhere from Apache's file upload routine was not
>>> caught. any idea>
>>>
>>>
>>> HugoPalma wrote:
>>>> That's not how decoration works.
>>>> You have to return your RequestExceptionHandler implementation that will 
>>>> decorate the default one. Take a look at the example at the bottom of 
>>>> the page here
>>>> http://tapestry.apache.org/tapestry5/cookbook/exceptions.html
>>>>
>>>> Angelo Chen wrote:
>>>>> Hi,
>>>>>
>>>>> I would like to catch the exception of FileSizeLimitExceededException,
>>>>> I
>>>>> tried the decorator method like this:
>>>>>
>>>>> public RequestExceptionHandler decorateRequestExceptionHandler(
>>>>>           final Logger logger,
>>>>>           final ResponseRenderer renderer,
>>>>>           final ComponentSource componentSource,
>>>>>           @Symbol(SymbolConstants.PRODUCTION_MODE)
>>>>>           boolean productionMode,
>>>>>           Object service)
>>>>>   {
>>>>>       System.out.println("exception!");
>>>>>       return null;
>>>>> }
>>>>>
>>>>> but this method will not be called if the exception is
>>>>> FileSizeLimitExceededException, the error simply dumps to the browser
>>>>> screen, 
>>>>> any idea why those errors can not be caught?
>>>>>
>>>>> // limit the size of uploading file
>>>>>
>>>>> public static void contributeApplicationDefaults( 
>>>>> MappedConfiguration<String, String> configuration) 
>>>>> { 
>>>>>    	configuration.add(UploadSymbols.REQUESTSIZE_MAX, "1000000"); 
>>>>> 	configuration.add(UploadSymbols.FILESIZE_MAX, "500000"); 
>>>>> } 
>>>>>
>>>>>
>>>>>   
>>>> ---------------------------------------------------------------------
>>>> 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: how to caught those exceptions uncaught by T5?

Posted by Hugo Palma <hu...@gmail.com>.
Have you tried adding the error-page element to your web.xml ?

Something like:

<error-page>
        <error-code>505</error-code>
        <location>/myErrorHandlerPage.html</location>
    </error-page>

Angelo Chen wrote:
> Hi Filip,
>
> That make sense. now how to deal these kinds of exceptions? 
>
>
> Filip S. Adamsen-2 wrote:
>   
>> Hi Angelo,
>>
>> I think the upload processing happens before the request gets to where 
>> exceptions are caught på RequestExceptionHandler, if that makes sense.
>>
>> Perhaps that's why?
>>
>> -Filip
>>
>> On 2008-08-27 16:37, Angelo Chen wrote:
>>     
>>> hi,
>>>
>>> Thanks for the reply. I copied the code from the cookbook,  i deleted the
>>> other part, i just want to be sure if the method will be called when an
>>> exception occurs, it does with all those normal exceptions, but the 505
>>> status dumped coming somewhere from Apache's file upload routine was not
>>> caught. any idea>
>>>
>>>
>>> HugoPalma wrote:
>>>       
>>>> That's not how decoration works.
>>>> You have to return your RequestExceptionHandler implementation that will 
>>>> decorate the default one. Take a look at the example at the bottom of 
>>>> the page here
>>>> http://tapestry.apache.org/tapestry5/cookbook/exceptions.html
>>>>
>>>> Angelo Chen wrote:
>>>>         
>>>>> Hi,
>>>>>
>>>>> I would like to catch the exception of FileSizeLimitExceededException,
>>>>> I
>>>>> tried the decorator method like this:
>>>>>
>>>>> public RequestExceptionHandler decorateRequestExceptionHandler(
>>>>>           final Logger logger,
>>>>>           final ResponseRenderer renderer,
>>>>>           final ComponentSource componentSource,
>>>>>           @Symbol(SymbolConstants.PRODUCTION_MODE)
>>>>>           boolean productionMode,
>>>>>           Object service)
>>>>>   {
>>>>>       System.out.println("exception!");
>>>>>       return null;
>>>>> }
>>>>>
>>>>> but this method will not be called if the exception is
>>>>> FileSizeLimitExceededException, the error simply dumps to the browser
>>>>> screen, 
>>>>> any idea why those errors can not be caught?
>>>>>
>>>>> // limit the size of uploading file
>>>>>
>>>>> public static void contributeApplicationDefaults( 
>>>>> MappedConfiguration<String, String> configuration) 
>>>>> { 
>>>>>    	configuration.add(UploadSymbols.REQUESTSIZE_MAX, "1000000"); 
>>>>> 	configuration.add(UploadSymbols.FILESIZE_MAX, "500000"); 
>>>>> } 
>>>>>
>>>>>
>>>>>   
>>>>>           
>>>> ---------------------------------------------------------------------
>>>> 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: how to caught those exceptions uncaught by T5?

Posted by Angelo Chen <an...@yahoo.com.hk>.
Hi Filip,

That make sense. now how to deal these kinds of exceptions? 


Filip S. Adamsen-2 wrote:
> 
> Hi Angelo,
> 
> I think the upload processing happens before the request gets to where 
> exceptions are caught på RequestExceptionHandler, if that makes sense.
> 
> Perhaps that's why?
> 
> -Filip
> 
> On 2008-08-27 16:37, Angelo Chen wrote:
>> hi,
>> 
>> Thanks for the reply. I copied the code from the cookbook,  i deleted the
>> other part, i just want to be sure if the method will be called when an
>> exception occurs, it does with all those normal exceptions, but the 505
>> status dumped coming somewhere from Apache's file upload routine was not
>> caught. any idea>
>> 
>> 
>> HugoPalma wrote:
>>> That's not how decoration works.
>>> You have to return your RequestExceptionHandler implementation that will 
>>> decorate the default one. Take a look at the example at the bottom of 
>>> the page here
>>> http://tapestry.apache.org/tapestry5/cookbook/exceptions.html
>>>
>>> Angelo Chen wrote:
>>>> Hi,
>>>>
>>>> I would like to catch the exception of FileSizeLimitExceededException,
>>>> I
>>>> tried the decorator method like this:
>>>>
>>>> public RequestExceptionHandler decorateRequestExceptionHandler(
>>>>           final Logger logger,
>>>>           final ResponseRenderer renderer,
>>>>           final ComponentSource componentSource,
>>>>           @Symbol(SymbolConstants.PRODUCTION_MODE)
>>>>           boolean productionMode,
>>>>           Object service)
>>>>   {
>>>>       System.out.println("exception!");
>>>>       return null;
>>>> }
>>>>
>>>> but this method will not be called if the exception is
>>>> FileSizeLimitExceededException, the error simply dumps to the browser
>>>> screen, 
>>>> any idea why those errors can not be caught?
>>>>
>>>> // limit the size of uploading file
>>>>
>>>> public static void contributeApplicationDefaults( 
>>>> MappedConfiguration<String, String> configuration) 
>>>> { 
>>>>    	configuration.add(UploadSymbols.REQUESTSIZE_MAX, "1000000"); 
>>>> 	configuration.add(UploadSymbols.FILESIZE_MAX, "500000"); 
>>>> } 
>>>>
>>>>
>>>>   
>>> ---------------------------------------------------------------------
>>> 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%3A-how-to-caught-those-exceptions-uncaught-by-T5--tp19181261p19191590.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: how to caught those exceptions uncaught by T5?

Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
Hi Angelo,

I think the upload processing happens before the request gets to where 
exceptions are caught på RequestExceptionHandler, if that makes sense.

Perhaps that's why?

-Filip

On 2008-08-27 16:37, Angelo Chen wrote:
> hi,
> 
> Thanks for the reply. I copied the code from the cookbook,  i deleted the
> other part, i just want to be sure if the method will be called when an
> exception occurs, it does with all those normal exceptions, but the 505
> status dumped coming somewhere from Apache's file upload routine was not
> caught. any idea>
> 
> 
> HugoPalma wrote:
>> That's not how decoration works.
>> You have to return your RequestExceptionHandler implementation that will 
>> decorate the default one. Take a look at the example at the bottom of 
>> the page here
>> http://tapestry.apache.org/tapestry5/cookbook/exceptions.html
>>
>> Angelo Chen wrote:
>>> Hi,
>>>
>>> I would like to catch the exception of FileSizeLimitExceededException, I
>>> tried the decorator method like this:
>>>
>>> public RequestExceptionHandler decorateRequestExceptionHandler(
>>>           final Logger logger,
>>>           final ResponseRenderer renderer,
>>>           final ComponentSource componentSource,
>>>           @Symbol(SymbolConstants.PRODUCTION_MODE)
>>>           boolean productionMode,
>>>           Object service)
>>>   {
>>>       System.out.println("exception!");
>>>       return null;
>>> }
>>>
>>> but this method will not be called if the exception is
>>> FileSizeLimitExceededException, the error simply dumps to the browser
>>> screen, 
>>> any idea why those errors can not be caught?
>>>
>>> // limit the size of uploading file
>>>
>>> public static void contributeApplicationDefaults( 
>>> MappedConfiguration<String, String> configuration) 
>>> { 
>>>    	configuration.add(UploadSymbols.REQUESTSIZE_MAX, "1000000"); 
>>> 	configuration.add(UploadSymbols.FILESIZE_MAX, "500000"); 
>>> } 
>>>
>>>
>>>   
>> ---------------------------------------------------------------------
>> 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: how to caught those exceptions uncaught by T5?

Posted by Angelo Chen <an...@yahoo.com.hk>.
hi,

Thanks for the reply. I copied the code from the cookbook,  i deleted the
other part, i just want to be sure if the method will be called when an
exception occurs, it does with all those normal exceptions, but the 505
status dumped coming somewhere from Apache's file upload routine was not
caught. any idea>


HugoPalma wrote:
> 
> That's not how decoration works.
> You have to return your RequestExceptionHandler implementation that will 
> decorate the default one. Take a look at the example at the bottom of 
> the page here
> http://tapestry.apache.org/tapestry5/cookbook/exceptions.html
> 
> Angelo Chen wrote:
>> Hi,
>>
>> I would like to catch the exception of FileSizeLimitExceededException, I
>> tried the decorator method like this:
>>
>> public RequestExceptionHandler decorateRequestExceptionHandler(
>>           final Logger logger,
>>           final ResponseRenderer renderer,
>>           final ComponentSource componentSource,
>>           @Symbol(SymbolConstants.PRODUCTION_MODE)
>>           boolean productionMode,
>>           Object service)
>>   {
>>       System.out.println("exception!");
>>       return null;
>> }
>>
>> but this method will not be called if the exception is
>> FileSizeLimitExceededException, the error simply dumps to the browser
>> screen, 
>> any idea why those errors can not be caught?
>>
>> // limit the size of uploading file
>>
>> public static void contributeApplicationDefaults( 
>> MappedConfiguration<String, String> configuration) 
>> { 
>>    	configuration.add(UploadSymbols.REQUESTSIZE_MAX, "1000000"); 
>> 	configuration.add(UploadSymbols.FILESIZE_MAX, "500000"); 
>> } 
>>
>>
>>   
> 
> ---------------------------------------------------------------------
> 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%3A-how-to-caught-those-exceptions-uncaught-by-T5--tp19181261p19182388.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: how to caught those exceptions uncaught by T5?

Posted by Hugo Palma <hu...@gmail.com>.
That's not how decoration works.
You have to return your RequestExceptionHandler implementation that will 
decorate the default one. Take a look at the example at the bottom of 
the page here http://tapestry.apache.org/tapestry5/cookbook/exceptions.html

Angelo Chen wrote:
> Hi,
>
> I would like to catch the exception of FileSizeLimitExceededException, I
> tried the decorator method like this:
>
> public RequestExceptionHandler decorateRequestExceptionHandler(
>           final Logger logger,
>           final ResponseRenderer renderer,
>           final ComponentSource componentSource,
>           @Symbol(SymbolConstants.PRODUCTION_MODE)
>           boolean productionMode,
>           Object service)
>   {
>       System.out.println("exception!");
>       return null;
> }
>
> but this method will not be called if the exception is
> FileSizeLimitExceededException, the error simply dumps to the browser
> screen, 
> any idea why those errors can not be caught?
>
> // limit the size of uploading file
>
> public static void contributeApplicationDefaults( 
> MappedConfiguration<String, String> configuration) 
> { 
>    	configuration.add(UploadSymbols.REQUESTSIZE_MAX, "1000000"); 
> 	configuration.add(UploadSymbols.FILESIZE_MAX, "500000"); 
> } 
>
>
>   

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