Re: Why is TapestryFilter.doFilter final?

2010-06-07 Thread Dmitry Gusev
Alex,

if you mean exception handling, I've just decorated RequestExceptionHandling
like this:

public RequestExceptionHandler decorateRequestExceptionHandler(
final Logger logger,
final Response response,
@Symbol(SymbolConstants.PRODUCTION_MODE)
boolean productionMode)
{
if (!productionMode) return null;

return new RequestExceptionHandler()
{
public void handleRequestException(Throwable exception) throws
IOException
{
logger.error(Unexpected runtime exception:  +
exception.getMessage(), exception);


response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, null);
}
};
}

Then in web.xml I added 500 error page:

...
error-page
error-code500/error-code
location/500.html/location
/error-page
 /web-app

I also ended with writing custom filter wrapping T5 to not load tapestry for
non-tapestry related requests wich may affect T5 by /* filter url pattern.

Not sure if I have some really generic code for tapestry5-gae.
However there are some tips  tricks I may share about tapestry5 for gae/j.
Probably I will write blogpost (or page in T5 wiki) on this later this/next
month.


On Mon, Jun 7, 2010 at 08:17, Alex Kotchnev akoch...@gmail.com wrote:

 Dmitry,
   could you possibly share what you come up with - this seems like
 something generically useful when running in GAE . Is there any possiblity
 for tapestry5-gae module ?

 Regards,

 Alex K

 On Wed, Jun 2, 2010 at 2:38 PM, Dmitry Gusev dmitry.gu...@gmail.com
 wrote:

  I'm thinking how to handle
  com.google.apphosting.api.DeadlineExceededException.
  This exception thrown in GAE if request processed more than 30 seconds
 and
  I
  have only ~400 ms to handle this error untill
  com.google.apphosting.runtime.HardDeadlineExceededError thrown.
 
  I was thinking to override filter and wrap doFilter with try/catch. But
 now
  I see that there is RequestExceptionHandler for these purposes.
  Looks like DefaultRequestExceptionHandler can't handle exception in 400
 ms.
  I think I will override this handler and just send response redirect to
  some
  static 500.html page.
 
  On Wed, Jun 2, 2010 at 21:25, Howard Lewis Ship hls...@gmail.com
 wrote:
 
   What are you trying to accomplish?  Tapestry already has great
   mechanisms for extending the request processing behavior, including
   dealing with thrown exceptions. That's why such methods are final, to
   encourage you to look in the correct place.
  
   On Wed, Jun 2, 2010 at 10:14 AM, Dmitry Gusev dmitry.gu...@gmail.com
   wrote:
I need to override this method to wrap it with try/catch but can't do
  it
right now.
   
Is there any reason why this method was declared final?
   
--
Dmitry Gusev
   
AnjLab Team
http://anjlab.com
   
  
  
  
   --
   Howard M. Lewis Ship
  
   Creator of Apache Tapestry
  
   The source for Tapestry training, mentoring and support. Contact me to
   learn how I can get you up and productive in Tapestry fast!
  
   (971) 678-5210
   http://howardlewisship.com
  
   -
   To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
   For additional commands, e-mail: users-h...@tapestry.apache.org
  
  
 
 
  --
  Dmitry Gusev
 
  AnjLab Team
  http://anjlab.com
 




-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com


Re: Why is TapestryFilter.doFilter final?

2010-06-07 Thread Thiago H. de Paula Figueiredo
On Mon, 07 Jun 2010 09:31:01 -0300, Dmitry Gusev dmitry.gu...@gmail.com  
wrote:


I also ended with writing custom filter wrapping T5 to not load tapestry  
for non-tapestry related requests wich may affect T5 by /* filter url  
pattern.


Servlet filters are loaded just once. I guess you meant Tapestry not  
handling some requests.
Tapestry already doesn't handles requests that aren't made to paths  
handled by Tapestry. You can configure it adding this method to your  
AppModule:


public static void contributeIgnoredPathsFilter(ConfigurationString  
configuration) {

configuration.add(/dwr/.*);
}

This examples tells Tapestry to not touch requests to the dwr folder.

--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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



Re: Why is TapestryFilter.doFilter final?

2010-06-07 Thread Dmitry Gusev

 Servlet filters are loaded just once.


This is exactly what I mean, I don't want tapestry to load even once for
some requests. GAE shutdown/startup instances very often (one new instance
per ~3 minues) and this consumes additional resources.

I have around 12K requests per day ATM and every request billed by cpu
usage.
So I decided to refuse from tapestry for some requests and use pure filter
API.

Btw I use gnoredPathsFilters for GAE dev server admin console and appstats:

public static void contributeIgnoredPathsFilter(ConfigurationString
configuration) {
//GAE filters
configuration.add(/_ah/.*);
//  GAE Appstats
configuration.add(/appstats/.*);
}

On Mon, Jun 7, 2010 at 17:22, Thiago H. de Paula Figueiredo 
thiag...@gmail.com wrote:

 On Mon, 07 Jun 2010 09:31:01 -0300, Dmitry Gusev dmitry.gu...@gmail.com
 wrote:

  I also ended with writing custom filter wrapping T5 to not load tapestry
 for non-tapestry related requests wich may affect T5 by /* filter url
 pattern.


 Servlet filters are loaded just once. I guess you meant Tapestry not
 handling some requests.
 Tapestry already doesn't handles requests that aren't made to paths handled
 by Tapestry. You can configure it adding this method to your AppModule:

 public static void contributeIgnoredPathsFilter(ConfigurationString
 configuration) {
configuration.add(/dwr/.*);
 }

 This examples tells Tapestry to not touch requests to the dwr folder.

 --
 Thiago H. de Paula Figueiredo
 Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
 and instructor
 Owner, Ars Machina Tecnologia da Informação Ltda.
 http://www.arsmachina.com.br

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




-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com


Re: Why is TapestryFilter.doFilter final?

2010-06-07 Thread Thiago H. de Paula Figueiredo
On Mon, 07 Jun 2010 10:42:52 -0300, Dmitry Gusev dmitry.gu...@gmail.com  
wrote:



This is exactly what I mean, I don't want tapestry to load even once for
some requests. GAE shutdown/startup instances very often (one new  
instance per ~3 minues) and this consumes additional resources.


Oops, I forgot this GAE characteristic and what you said makes sense now.  
:)


--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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



Re: Why is TapestryFilter.doFilter final?

2010-06-06 Thread Alex Kotchnev
Dmitry,
   could you possibly share what you come up with - this seems like
something generically useful when running in GAE . Is there any possiblity
for tapestry5-gae module ?

Regards,

Alex K

On Wed, Jun 2, 2010 at 2:38 PM, Dmitry Gusev dmitry.gu...@gmail.com wrote:

 I'm thinking how to handle
 com.google.apphosting.api.DeadlineExceededException.
 This exception thrown in GAE if request processed more than 30 seconds and
 I
 have only ~400 ms to handle this error untill
 com.google.apphosting.runtime.HardDeadlineExceededError thrown.

 I was thinking to override filter and wrap doFilter with try/catch. But now
 I see that there is RequestExceptionHandler for these purposes.
 Looks like DefaultRequestExceptionHandler can't handle exception in 400 ms.
 I think I will override this handler and just send response redirect to
 some
 static 500.html page.

 On Wed, Jun 2, 2010 at 21:25, Howard Lewis Ship hls...@gmail.com wrote:

  What are you trying to accomplish?  Tapestry already has great
  mechanisms for extending the request processing behavior, including
  dealing with thrown exceptions. That's why such methods are final, to
  encourage you to look in the correct place.
 
  On Wed, Jun 2, 2010 at 10:14 AM, Dmitry Gusev dmitry.gu...@gmail.com
  wrote:
   I need to override this method to wrap it with try/catch but can't do
 it
   right now.
  
   Is there any reason why this method was declared final?
  
   --
   Dmitry Gusev
  
   AnjLab Team
   http://anjlab.com
  
 
 
 
  --
  Howard M. Lewis Ship
 
  Creator of Apache Tapestry
 
  The source for Tapestry training, mentoring and support. Contact me to
  learn how I can get you up and productive in Tapestry fast!
 
  (971) 678-5210
  http://howardlewisship.com
 
  -
  To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
  For additional commands, e-mail: users-h...@tapestry.apache.org
 
 


 --
 Dmitry Gusev

 AnjLab Team
 http://anjlab.com



Why is TapestryFilter.doFilter final?

2010-06-02 Thread Dmitry Gusev
I need to override this method to wrap it with try/catch but can't do it
right now.

Is there any reason why this method was declared final?

-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com


Re: Why is TapestryFilter.doFilter final?

2010-06-02 Thread Howard Lewis Ship
What are you trying to accomplish?  Tapestry already has great
mechanisms for extending the request processing behavior, including
dealing with thrown exceptions. That's why such methods are final, to
encourage you to look in the correct place.

On Wed, Jun 2, 2010 at 10:14 AM, Dmitry Gusev dmitry.gu...@gmail.com wrote:
 I need to override this method to wrap it with try/catch but can't do it
 right now.

 Is there any reason why this method was declared final?

 --
 Dmitry Gusev

 AnjLab Team
 http://anjlab.com




-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

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



Re: Why is TapestryFilter.doFilter final?

2010-06-02 Thread Dmitry Gusev
I'm thinking how to handle
com.google.apphosting.api.DeadlineExceededException.
This exception thrown in GAE if request processed more than 30 seconds and I
have only ~400 ms to handle this error untill
com.google.apphosting.runtime.HardDeadlineExceededError thrown.

I was thinking to override filter and wrap doFilter with try/catch. But now
I see that there is RequestExceptionHandler for these purposes.
Looks like DefaultRequestExceptionHandler can't handle exception in 400 ms.
I think I will override this handler and just send response redirect to some
static 500.html page.

On Wed, Jun 2, 2010 at 21:25, Howard Lewis Ship hls...@gmail.com wrote:

 What are you trying to accomplish?  Tapestry already has great
 mechanisms for extending the request processing behavior, including
 dealing with thrown exceptions. That's why such methods are final, to
 encourage you to look in the correct place.

 On Wed, Jun 2, 2010 at 10:14 AM, Dmitry Gusev dmitry.gu...@gmail.com
 wrote:
  I need to override this method to wrap it with try/catch but can't do it
  right now.
 
  Is there any reason why this method was declared final?
 
  --
  Dmitry Gusev
 
  AnjLab Team
  http://anjlab.com
 



 --
 Howard M. Lewis Ship

 Creator of Apache Tapestry

 The source for Tapestry training, mentoring and support. Contact me to
 learn how I can get you up and productive in Tapestry fast!

 (971) 678-5210
 http://howardlewisship.com

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




-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com