T5 Module methods call

View: New views
5 Messages — Rating Filter:   Alert me  

T5 Module methods call

by flyabovesun :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have my own service module class under my services sub package to set up
my application configuration. There is one method to set up application
defaults, it is called corrected,

public void contributeApplicationDefaults(MappedConfiguration<String,
String> configuration){
        configuration.add(SymbolConstants.PRODUCTION_MODE, "false");
        configuration.add("tapestry.page-pool.active-window", "100 m");
        configuration.add("tapestry.page-pool.hard-limit", "30");
        //configuration.add("tapestry.exception-report-page",
"MyErrorPage");
        configuration.add("tapestry.file-check-interval", "10s");

        //customized symbol
        configuration.add("web.root", "/salesTrack/");
        System.out.println("change application default>>>>>>>>>>>>>>>>>>");
    }

but this one is not called:
 public static void contributeIgnoredPathsFilter(Configuration<String>
configuration)
      {
        configuration.add("/dwr/.*");
        configuration.add("/scripts/.*");
        configuration.add("/logout");

      }
Why?

--
Haipeng Du
Salt Lake City

Parent Message unknown Re: T5 Module methods call

by nille hammer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Haipeng,

> but this one is not called:
>  public static void contributeIgnoredPathsFilter(Configuration<String>
> configuration)
>       {
>         configuration.add("/dwr/.*");
>         configuration.add("/scripts/.*");
>         configuration.add("/logout");
>
>       }
The contribution method is called by a builder method for a service that accepts your configuration as method parameter. I assume you want to build a service that implements  "RequestFilter". So do you have sth. like the following in your module class?

public  RequestFilter buildIgnoredPathsFilter(final Collection<String> contributions) {
    return new IgnoredPathsFilter(contributions);
}

Regards, nillehammer

==
http://www.winfonet.eu

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


Re: T5 Module methods call

by Thiago H. de Paula Figueiredo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Em Mon, 29 Jun 2009 16:15:51 -0300, nille hammer  
<tapestry.nillehammer@...> escreveu:

> Hi Haipeng,

Hi everyone!

>> but this one is not called:
>>  public static void contributeIgnoredPathsFilter(Configuration<String>
>> configuration)

I don't know if that's your problem, but this method will only be called  
when the first request is received. Tapestry-IoC, by default, just create  
services when they're first needed.

> The contribution method is called by a builder method for a service that  
> accepts your configuration as method parameter. I assume you want to  
> build a service that implements  "RequestFilter". So do you have sth.  
> like the following in your module class?
>
> public  RequestFilter buildIgnoredPathsFilter(final Collection<String>  
> contributions) {
>     return new IgnoredPathsFilter(contributions);
> }

TapestryModule.class, part of Tapestry, defines an IgnoredPathsFilteer  
service inside method bind(), so there's no need to define it again. ;)

--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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


Re: T5 Module methods call

by flyabovesun :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for your reply. As I understand, I do no need to create such service
from my module class. There is one tapestry service called
IgnoredPathsFilter already. Also, from url:
http://tapestry.apache.org/tapestry5.1/guide/conf.html , it does not talk
about to create such service when I have contributeIgnoredPathsFilter(
Configuration<String>
> configuration);
Thanks.


On Mon, Jun 29, 2009 at 1:15 PM, nille hammer
<tapestry.nillehammer@...> wrote:

> Hi Haipeng,
>
> > but this one is not called:
> >  public static void contributeIgnoredPathsFilter(Configuration<String>
> > configuration)
> >       {
> >         configuration.add("/dwr/.*");
> >         configuration.add("/scripts/.*");
> >         configuration.add("/logout");
> >
> >       }
> The contribution method is called by a builder method for a service that
> accepts your configuration as method parameter. I assume you want to build a
> service that implements  "RequestFilter". So do you have sth. like the
> following in your module class?
>
> public  RequestFilter buildIgnoredPathsFilter(final Collection<String>
> contributions) {
>    return new IgnoredPathsFilter(contributions);
> }
>
> Regards, nillehammer
>
> ==
> http://www.winfonet.eu
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>


--
Haipeng Du
Salt Lake City

Re: T5 Module methods call

by flyabovesun :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Thiago. That makes sense.

On Mon, Jun 29, 2009 at 2:44 PM, haipeng du <haipengdu@...> wrote:

> Thanks for your reply. As I understand, I do no need to create such service
> from my module class. There is one tapestry service called
> IgnoredPathsFilter already. Also, from url:
> http://tapestry.apache.org/tapestry5.1/guide/conf.html , it does not talk
> about to create such service when I have contributeIgnoredPathsFilter(Configuration<String>
> > configuration);
> Thanks.
>
>
> On Mon, Jun 29, 2009 at 1:15 PM, nille hammer
> <tapestry.nillehammer@...> wrote:
>
>> Hi Haipeng,
>>
>> > but this one is not called:
>> >  public static void contributeIgnoredPathsFilter(Configuration<String>
>> > configuration)
>> >       {
>> >         configuration.add("/dwr/.*");
>> >         configuration.add("/scripts/.*");
>> >         configuration.add("/logout");
>> >
>> >       }
>> The contribution method is called by a builder method for a service that
>> accepts your configuration as method parameter. I assume you want to build a
>> service that implements  "RequestFilter". So do you have sth. like the
>> following in your module class?
>>
>> public  RequestFilter buildIgnoredPathsFilter(final Collection<String>
>> contributions) {
>>    return new IgnoredPathsFilter(contributions);
>> }
>>
>> Regards, nillehammer
>>
>> ==
>> http://www.winfonet.eu
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>>
>
>
> --
> Haipeng Du
> Salt Lake City
>



--
Haipeng Du
Salt Lake City