You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Timo Westkämper <ti...@mysema.com> on 2009/09/29 22:47:13 UTC

Page alias & Guice integration

Hi.

I am fairly new to Tapestry 5 and I have a few questions.

* Is there a way to declare a pagename alias for the URL generation e.g. 
"article" for ArticlePage class or do I need to to do URL rewriting like 
described here :

http://tapestry.apache.org/tapestry5.1/guide/url-rewriting.html

I'd like to keep Page-suffixes for my Page class names, but I don't want 
to see them in the URLs. Without the Page-suffix there would be 
simplename clashes with domain types.


* What is the preferred way to do Tapestry / Guice integration. While 
the Tapestry IoC seems quite powerful, I got used to Guice and would 
like to continue using it in my Tapestry projects.

I managed to wire up something like this which pulls 
ImplementedBy-annotated services from a Guice module. Have you been 
successful with something more general?

    private static Injector injector = Guice.createInjector(new 
BlogModule());

    public static void 
contributeMasterObjectProvider(OrderedConfiguration<ObjectProvider> 
configuration) {
        configuration.add("Guice", new ObjectProvider() {
            @SuppressWarnings("unchecked")
            @Override
            public <T> T provide(Class<T> objectType, AnnotationProvider 
annotationProvider, ObjectLocator locator) {
                ImplementedBy implementedBy = 
objectType.getAnnotation(ImplementedBy.class);
                if (implementedBy != null){
                    return (T) injector.getInstance(implementedBy.value());
                } else {
                    return null;
                }
            }
        });
    }

Best regards,
Timo.

-- 
Timo Westkämper <ti...@mysema.com>
Mysema Ltd, Vilhonkatu 5 A, 00100 Helsinki, Finland
Mob. +358 (0)40 591 2172 
Internet: http://www.mysema.com


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


Re: Page alias & Guice integration

Posted by Christian Edward Gruber <ch...@gmail.com>.
Switching is hopefully not the issue, but if my organization uses  
Guice by fiat, but wants to use a Tapestry application, a tapestry- 
guice integration would be nice, since it would be major surgery (with  
a low patient survival rate) to rip out t5-ioc and replace it with  
Guice.  :)

Christian.

On 2009-09-29, at 17:20 , Thiago H. de Paula Figueiredo wrote:

> Em Tue, 29 Sep 2009 17:47:13 -0300, Timo Westkämper <timo.westkamper@mysema.com 
> > escreveu:
>
>> Hi.
>
> Hi!
>
>> I am fairly new to Tapestry 5 and I have a few questions.
>>
>> * Is there a way to declare a pagename alias for the URL generation  
>> e.g. "article" for ArticlePage class or do I need to to do URL  
>> rewriting like described here :
>>
>> http://tapestry.apache.org/tapestry5.1/guide/url-rewriting.html
>
> You can also decorate or advise the ComponentSource and  
> ComponentEventLinkEncoder services to do that.
>
>> * What is the preferred way to do Tapestry / Guice integration.  
>> While the Tapestry IoC seems quite powerful, I got used to Guice  
>> and would like to continue using it in my Tapestry projects.
>
> Tapestry-IoC was partly inspired by Guice, so switching from the  
> latter to the former shouldn't be hard. :)
> Regarding an integration between Tapestry and Guice, you could take  
> a look at how the Tapestry-Spring one to get some inspiration.
>
> -- 
> Thiago H. de Paula Figueiredo
> Independent Java consultant, developer, and instructor
> http://www.arsmachina.com.br/thiago
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

Christian Edward Gruber
e-mail: christianedwardgruber@gmail.com
weblog: http://www.geekinasuit.com/


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


Re: Page alias & Guice integration

Posted by Timo Westkämper <ti...@mysema.com>.
Hi Paul.

Thanks a lot for the pointer. The presented approach seems easy.

Thanks also for the other responses to my questions.

Br,
Timo.

Paul Field wrote:
> Hi Timo,
>
> You may be interested in this issue in the Tap5 issue tracking system:
> https://issues.apache.org/jira/browse/TAP5-633
>
> Look in the comments as there is some discussion about how to achieve the 
> "page" class prefix.
>
> - Paul
>
> "Thiago H. de Paula Figueiredo" <th...@gmail.com> wrote on 29/09/2009 
> 22:20:26:
>
>   
>> Em Tue, 29 Sep 2009 17:47:13 -0300, Timo Westkämper 
>> <ti...@mysema.com> escreveu:
>>     
>>> I am fairly new to Tapestry 5 and I have a few questions.
>>>
>>> * Is there a way to declare a pagename alias for the URL generation 
>>>       
> e.g. 
>   
>>> "article" for ArticlePage class or do I need to to do URL rewriting 
>>>       
> like 
>   
>>> described here :
>>>
>>> http://tapestry.apache.org/tapestry5.1/guide/url-rewriting.html
>>>       
>> You can also decorate or advise the ComponentSource and 
>> ComponentEventLinkEncoder services to do that.
>>     
>
>
>
> ---
>
> This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
>
> Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional EU corporate and regulatory disclosures.
>   


-- 
Timo Westkämper <ti...@mysema.com>
Mysema Ltd, Vilhonkatu 5 A, 00100 Helsinki, Finland
Mob. +358 (0)40 591 2172 
Internet: http://www.mysema.com


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


Re: Page alias & Guice integration

Posted by Paul Field <pa...@db.com>.
Hi Timo,

You may be interested in this issue in the Tap5 issue tracking system:
https://issues.apache.org/jira/browse/TAP5-633

Look in the comments as there is some discussion about how to achieve the 
"page" class prefix.

- Paul

"Thiago H. de Paula Figueiredo" <th...@gmail.com> wrote on 29/09/2009 
22:20:26:

> Em Tue, 29 Sep 2009 17:47:13 -0300, Timo Westkämper 
> <ti...@mysema.com> escreveu:
> > I am fairly new to Tapestry 5 and I have a few questions.
> >
> > * Is there a way to declare a pagename alias for the URL generation 
e.g. 
> > "article" for ArticlePage class or do I need to to do URL rewriting 
like 
> > described here :
> >
> > http://tapestry.apache.org/tapestry5.1/guide/url-rewriting.html
> 
> You can also decorate or advise the ComponentSource and 
> ComponentEventLinkEncoder services to do that.



---

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional EU corporate and regulatory disclosures.

Re: Page alias & Guice integration

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Tue, 29 Sep 2009 17:47:13 -0300, Timo Westkämper  
<ti...@mysema.com> escreveu:

> Hi.

Hi!

> I am fairly new to Tapestry 5 and I have a few questions.
>
> * Is there a way to declare a pagename alias for the URL generation e.g.  
> "article" for ArticlePage class or do I need to to do URL rewriting like  
> described here :
>
> http://tapestry.apache.org/tapestry5.1/guide/url-rewriting.html

You can also decorate or advise the ComponentSource and  
ComponentEventLinkEncoder services to do that.

> * What is the preferred way to do Tapestry / Guice integration. While  
> the Tapestry IoC seems quite powerful, I got used to Guice and would  
> like to continue using it in my Tapestry projects.

Tapestry-IoC was partly inspired by Guice, so switching from the latter to  
the former shouldn't be hard. :)
Regarding an integration between Tapestry and Guice, you could take a look  
at how the Tapestry-Spring one to get some inspiration.

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

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


Re: Page alias & Guice integration

Posted by Massimo Lusetti <ml...@gmail.com>.
On Tue, Sep 29, 2009 at 10:47 PM, Timo Westkämper
<ti...@mysema.com> wrote:
>
> * What is the preferred way to do Tapestry / Guice integration. While the
> Tapestry IoC seems quite powerful, I got used to Guice and would like to
> continue using it in my Tapestry projects.
>
> I managed to wire up something like this which pulls ImplementedBy-annotated
> services from a Guice module. Have you been successful with something more
> general?

Having an ObjectProvider is useful but not a complete integration, for
that purpose i think you should get your finger more dirty. I've done
the same for HiveMind and it works smoothly for the basics of inter
operations between services.

-- 
Massimo
http://meridio.blogspot.com

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