Re: [T5] Avoid logs in error for wrong urls and missing components ?

2013-04-09 Thread Ivan Khalopik
What about configuring robots.txt?


On Sat, Apr 6, 2013 at 1:50 PM, Nicolas Bouillon wrote:

> Thanks for your thoughts, and that leads me to the following suggestion to
> resolve my problem:
>
> I've already contributed a custom RequestExceptionHandler using
> binder.bind(RequestExceptionHandler.class,
> CustomRequestExceptionHandler.class)
>   .withId("CustomRequestExceptionHandler");
>
> That is this service which is responsible of my log error message
>
> (org.apache.tapestry5.internal.services.DefaultRequestExceptionHandler#handleRequestException).
>
> In my Custom RequestExceptionHandler, I could check the user agent to match
> against bots, and then instead of rendering the exception page, give them a
> 404 response code so they could stop crawling the page (and me skipping
> logger.error at the top of the handleRequestException method).
>
> Best regards.
>
>
>
> 2013/4/6 Muhammad Gelbana 
>
> > When you create a tapestry project using maven's archtype, it creates the
> > below request filter (slightly modified) to log how much time each
> request
> > consumed.
> >
> > // Service building
> > public RequestFilter buildTimingFilter(final Logger log) {
> > return new RequestFilter() {
> > @Override
> > public boolean service(Request request, Response response,
> > RequestHandler handler) throws IOException {
> > long startTime = System.currentTimeMillis();
> > try {
> > // The responsibility of a filter is to invoke the
> > corresponding method
> > // in the handler. When you chain multiple filters
> > together, each filter
> > // received a handler that is a bridge to the next
> filter.
> > return handler.service(request, response);
> > } finally {
> > long elapsed = System.currentTimeMillis() - startTime;
> > if (TimeUnit.MILLISECONDS.toSeconds(elapsed) >= 10) {
> > log.warn(String.format("Request time: %d ms",
> > elapsed));
> >  }
> > }
> > }
> > };
> > }
> >
> > // Service contribution
> > public void contributeRequestHandler(OrderedConfiguration
> > configuration, @Local RequestFilter filter) {
> > // Each contribution to an ordered configuration has a name, When
> > necessary, you may
> > // set constraints to precisely control the invocation order of the
> > contributed filter
> > // within the pipeline.
> > configuration.add("Timing", filter);
> > }
> >
> > From there, if you find a pattern for requests coming from bots, you can
> > drop these requests if that suits you. This way these bots will also
> learn
> > that the links they are requesting doesn't exists anymore and will
> > eventually stop bothering you, if they are smart enough !
> >
> > Regards
> >
> >
> > On Fri, Apr 5, 2013 at 10:08 PM, Nicolas Bouillon  > >wrote:
> >
> > > Dear all,
> > >
> > > I'm working on a e-commerce website in Tapestry 5 since a couple of
> years
> > > and we are making our website evolving constantly, adding some features
> > and
> > > changing stuff here and there.
> > >
> > > I'm closely monitoring application logs but i'm very annoyed by robots
> > who
> > > reminds some URLs that are not valid anymore.
> > >
> > > For example, they remind (or follow old links) to webpages that used to
> > be
> > > coded in PHP and where the URL contained special chars, not allowed in
> > > Tapestry URLs. Or those spiders try to access an URL of a grid pager
> > event,
> > > but the Grid component is not there anymore (or has a different name).
> > Each
> > > of those hit generate a log.error message, and that hide the important
> > > errors messages inside many noise. (I know, "Cool URI don't change",
> but
> > > for page events, it could be quite had to keep old URLs...)
> > >
> > > The error log is something like that :
> > > org.apache.tapestry5.ioc.util.UnknownValueException: Component
> > > product/domain/PriceList does not contain embedded component 'v3grid'.
> > >
> > > It's seems to be too wide to ignore totally "UnknownValueException" log
> > > appender, because it might hide real mistakes in the web application.
> > >
> > > Is there a way to avoid this kind of behavior ? How do you treat error
> > logs
> > > from your applications ?
> > >
> > > Thanks.
> > >
> > > Nicolas.
> > >
> >
>



-- 
BR
Ivan


Re: Reuse component containing form, but with extra fields

2013-04-09 Thread Ivan Khalopik
1. You can move form up, so that you personeditor component will contain
only form controls:

*page.tml*


  


*personeditor.tml*


...

*page2.tml*


  
  


All validation logic can be deffered using FormSupport.



2. Or you can use block parameters.

*page.tml*



*personeditor.tml*



...



*PersonEditor.java*

@Property
@Parameter
private Block extra;

*page2.tml*


  

  




On Tue, Apr 9, 2013 at 2:53 PM, Nathan Quirynen  wrote:

>  Hi,
>
> I have a component which I pass a Person object as parameter. This
> component contains a form to edit the person's data.
>
> *page.tml*
>
> 
>
> *personeditor.tml*
>
> 
> 
> ...
> 
>
> Now what should I do if I have the following:
> I have a class Employee containing a Person object and 1 extra field.
>
> public class Employee {
> private Person person;
> private String extraField;
> }
>
> I'd like to reuse the component to edit the person data, but I also need
> to be able to edit that extra field, which should be located in one and the
> same form. The problem here is that the form is defined in the person
> editor component.
> So what's a good way to do this and still reuse my personeditor in some
> way, or at least avoid duplicate code.
>
> --
>
> Een klare kijk op aanvullende pensioenen
>
> *Nathan Quirynen*
> 03 340 04 60 | 0494 28 45 15
> nat...@pensionarchitects.be
>
> Follow us on Web  | 
> Twitter|
> LinkedIn  | 
> RSS|
> YouTube 
>
>


-- 
BR
Ivan


Reuse component containing form, but with extra fields

2013-04-09 Thread Nathan Quirynen

  
  
Hi,

I have a component which I pass a Person object as parameter. This
component contains a form to edit the person's data.

page.tml



personeditor.tml


    
    ...


Now what should I do if I have the following:
I have a class Employee containing a Person object and 1 extra
field. 

public class Employee {
    private Person person;
    private String extraField;
}

I'd like to reuse the component to edit the person data, but I also
need to be able to edit that extra field, which should be located in
one and the same form. The problem here is that the form is defined
in the person editor component.
So what's a good way to do this and still reuse my personeditor in
some way, or at least avoid duplicate code.

-- 
  
  Een klare kijk op aanvullende
pensioenen
  
  Nathan Quirynen
  03 340 04 60 | 0494 28 45 15
  nat...@pensionarchitects.be
  
  Follow us on Web | Twitter | LinkedIn
| RSS
| YouTube
  

  



Re: Tapestry 5 and Java EE6/CDI

2013-04-09 Thread Thiago H de Paula Figueiredo
On Tue, 09 Apr 2013 03:26:08 -0300, Geoff Callender  
 wrote:


You just drop the Conversations and Conversation class from either of  
these examples into your project:


http://jumpstart.doublenegative.com.au/jumpstart/examples/wizard/usingformfragments/START/wiz4

http://jumpstart.doublenegative.com.au/jumpstart/examples/wizard/usingpages1/wiz5


Or use the tynamo-conversations package:  
http://docs.codehaus.org/display/TYNAMO/tapestry-conversations+guide


--
Thiago H. de Paula Figueiredo

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



Re: SymbolConstants.APPLICATION_VERSION = maven build version

2013-04-09 Thread Ivan Khalopik
If you have web application you can use context param to specify
application version:


tapestry.application-version
${project.version}


Then you just need to enable filtering for web.xml in maven-war-plugin,
e.g.:


org.apache.maven.plugins
maven-war-plugin

src/main/config/web.xml

true






On Tue, Apr 9, 2013 at 1:11 PM, John  wrote:

> found this in the archives!
>
>
> http://mail-archives.apache.org/mod_mbox/tapestry-users/201109.mbox/%3ccacd-vspwu9snhgmf9xx7n5xe8feqxyvozoayaynavff-_xv...@mail.gmail.com%3E
>   - Original Message -
>   From: Dmitry Gusev
>   To: Tapestry users
>   Sent: Tuesday, April 09, 2013 10:29 AM
>   Subject: Re: SymbolConstants.APPLICATION_VERSION = maven build version
>
>
>   I can suggest storing build number to a file during build process and
> read
>   the file in contributeApplicationDefaults.
>
>   On Tue, Apr 9, 2013 at 1:28 PM, John  wrote:
>
>   > Is there a neat way for SymbolConstants.APPLICATION_VERSION to match
> the
>   > maven build version?
>   >
>   > John
>
>
>
>
>   --
>   Dmitry Gusev
>
>   AnjLab Team
>   http://anjlab.com
>



-- 
BR
Ivan


Re: SymbolConstants.APPLICATION_VERSION = maven build version

2013-04-09 Thread John
found this in the archives!

http://mail-archives.apache.org/mod_mbox/tapestry-users/201109.mbox/%3ccacd-vspwu9snhgmf9xx7n5xe8feqxyvozoayaynavff-_xv...@mail.gmail.com%3E
  - Original Message - 
  From: Dmitry Gusev 
  To: Tapestry users 
  Sent: Tuesday, April 09, 2013 10:29 AM
  Subject: Re: SymbolConstants.APPLICATION_VERSION = maven build version


  I can suggest storing build number to a file during build process and read
  the file in contributeApplicationDefaults.

  On Tue, Apr 9, 2013 at 1:28 PM, John  wrote:

  > Is there a neat way for SymbolConstants.APPLICATION_VERSION to match the
  > maven build version?
  >
  > John




  -- 
  Dmitry Gusev

  AnjLab Team
  http://anjlab.com


Re: SymbolConstants.APPLICATION_VERSION = maven build version

2013-04-09 Thread John
I'd like to put a property in the manifest, but not sure how that works during 
development using the maven jetty plugin.

John
  - Original Message - 
  From: Dmitry Gusev 
  To: Tapestry users 
  Sent: Tuesday, April 09, 2013 10:29 AM
  Subject: Re: SymbolConstants.APPLICATION_VERSION = maven build version


  I can suggest storing build number to a file during build process and read
  the file in contributeApplicationDefaults.

  On Tue, Apr 9, 2013 at 1:28 PM, John  wrote:

  > Is there a neat way for SymbolConstants.APPLICATION_VERSION to match the
  > maven build version?
  >
  > John




  -- 
  Dmitry Gusev

  AnjLab Team
  http://anjlab.com


Re: SymbolConstants.APPLICATION_VERSION = maven build version

2013-04-09 Thread Dmitry Gusev
I can suggest storing build number to a file during build process and read
the file in contributeApplicationDefaults.

On Tue, Apr 9, 2013 at 1:28 PM, John  wrote:

> Is there a neat way for SymbolConstants.APPLICATION_VERSION to match the
> maven build version?
>
> John




-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com


SymbolConstants.APPLICATION_VERSION = maven build version

2013-04-09 Thread John
Is there a neat way for SymbolConstants.APPLICATION_VERSION to match the maven 
build version?

John