Thanks A LOT! Exactly what I was looking for - works great! Malin
On 10/18/07, Ulrich Stärk <[EMAIL PROTECTED]> wrote: > > Malin Ljungh schrieb: > > Hi all, > > > > I've got some annoying stack traces in my log from bots, primarily a bot > > called LiteFinder but also Googlebot. (the LiteFinder seems to get > lowercase > > URLs which results in many org.apache.tapestry.PageNotFoundExceptionsince I > > use uppercase first letter of my pages) > > > > I print stack trace in the exception page setException method - how can > I at > > this point detect the user-agent and just ignore it? > > > > Cheers, > > Malin > > > > Just inject the WebRequest into your page and check for any unwanted > user agents in your setException() method. > > @InjectObject("infrastructure:request") > public abstract WebRequest getRequest(); > > public void setException(Throwable t) > { > String userAgent = getRequest().getHeader("User-Agent"); > if(!isUnwanted(userAgent)) > { > // user agent is valid > // do your logging stuff or whatever > } > } > > Uli > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >