You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Norman Franke <No...@myASD.com> on 2009/12/07 18:44:05 UTC

T5 Multiple AppModules?

I'd like to have a single installation of T5 run two apps that will  
share a great deal of code. While I could have separate WAR files and  
deploy them to Tomcat, that would take more resources and prevent some  
level of interaction between them. So, is it possible to have two  
AppModules in a WAR? Then depending on the URL, it would appear as if  
that was the only app running. They'll share tons of database objects,  
DAOs, etc. Some users will have access to both, so I want to keep them  
in the same session. As a hack, I could have the Start page redirect  
depending on what type they are, but that seems less than desirable.

Norman Franke
Answering Service for Directors, Inc.
www.myasd.com




Re: T5 Multiple AppModules?

Posted by Norman Franke <no...@myasd.com>.
In my case, one of the sub-applications needed a few services that  
were database heavy. If they user is only going to access the basic  
one, I didn't want to worry about that. I'd assume the lazy loading  
will take care of this, however.

The real reason I wanted it was so I could have relative path names in  
the app for specifying pages, components and mixins. That failed until  
I renamed several hundred instances in the .tml files with a more  
complete pathname.

Norman Franke
Answering Service for Directors, Inc.
www.myasd.com



On Dec 7, 2009, at 5:02 PM, Howard Lewis Ship wrote:

> I don't believe you can have two separate T5 TapestryFilters in the
> same web.xml; currently T5 doesn't account for an extra identifying
> layer between the context path and the servlet path. In other words,
> the first T5 TapestryFilter would probably take all the incoming
> requests.
>
> What would be nice if you could map "/admin", say, to one T5 app and
> map "/user" or just "/" to the other, and Tapestry would be smart
> enough to distinguish between the two, both when dispatching requests
> and when constructing URLs.
>
> However, that kind of support was explicitly NOT part of my plan for
> T5, since that additional complexity was one of the things that sank
> Spindle (the Tapestry 3 Eclipse plugin).
>
> Given that you can spread your application easily across multiple
> folders/packages, I don't see a particular reason to have multiple T5
> applications running in the same web application context.
>
> On Mon, Dec 7, 2009 at 1:12 PM, Norman Franke <no...@myasd.com>  
> wrote:
>> Do I then create multiple filters in the web.xml for each sub-app?  
>> Or just
>> one for /*? Seems to require multiple filter definitions, but then  
>> other
>> stuff fails.
>>
>> With separate filters for each sub-level of the URL, I get:
>>
>> java.lang.RuntimeException: No service implements the interface
>> org.springframework.security.userdetails.UserDetailsService.
>>
>> Which is from Tapestry Spring Services saying it can't find the  
>> service,
>> which is defined in the AppModule.
>>
>> I can see in the log that it does load three applications, but my  
>> DAOs and
>> UserDetailsService are not listed under the sub-applications. I  
>> assume from
>> the error and the lack of output, that it is not sucking in the  
>> common
>> module's contributions?
>>
>> Further, it's claiming I have multiple IoCs. Removing the extra  
>> filters from
>> the web.xml eliminates the multiple IoC issue, but doesn't load my  
>> sub-apps.
>> Despite the @SubModule, they don't seem to be loading.
>>
>> Norman Franke
>> Answering Service for Directors, Inc.
>> www.myasd.com
>>
>>
>>
>> On Dec 7, 2009, at 1:01 PM, Howard Lewis Ship wrote:
>>
>>> Create a common module, and in each app use @SubModule on the app's
>>> AppModule to suck in the CommonModule services and contributions.
>>>
>>> On Mon, Dec 7, 2009 at 9:44 AM, Norman Franke <No...@myasd.com>  
>>> wrote:
>>>>
>>>> I'd like to have a single installation of T5 run two apps that  
>>>> will share
>>>> a
>>>> great deal of code. While I could have separate WAR files and  
>>>> deploy them
>>>> to
>>>> Tomcat, that would take more resources and prevent some level of
>>>> interaction
>>>> between them. So, is it possible to have two AppModules in a WAR?  
>>>> Then
>>>> depending on the URL, it would appear as if that was the only app
>>>> running.
>>>> They'll share tons of database objects, DAOs, etc. Some users  
>>>> will have
>>>> access to both, so I want to keep them in the same session. As a  
>>>> hack, I
>>>> could have the Start page redirect depending on what type they  
>>>> are, but
>>>> that
>>>> seems less than desirable.
>>>>
>>>> Norman Franke
>>>> Answering Service for Directors, Inc.
>>>> www.myasd.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-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>
>>
>
>
>
> -- 
> 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-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>


Re: T5 Multiple AppModules?

Posted by Howard Lewis Ship <hl...@gmail.com>.
I don't believe you can have two separate T5 TapestryFilters in the
same web.xml; currently T5 doesn't account for an extra identifying
layer between the context path and the servlet path. In other words,
the first T5 TapestryFilter would probably take all the incoming
requests.

What would be nice if you could map "/admin", say, to one T5 app and
map "/user" or just "/" to the other, and Tapestry would be smart
enough to distinguish between the two, both when dispatching requests
and when constructing URLs.

However, that kind of support was explicitly NOT part of my plan for
T5, since that additional complexity was one of the things that sank
Spindle (the Tapestry 3 Eclipse plugin).

Given that you can spread your application easily across multiple
folders/packages, I don't see a particular reason to have multiple T5
applications running in the same web application context.

On Mon, Dec 7, 2009 at 1:12 PM, Norman Franke <no...@myasd.com> wrote:
> Do I then create multiple filters in the web.xml for each sub-app? Or just
> one for /*? Seems to require multiple filter definitions, but then other
> stuff fails.
>
> With separate filters for each sub-level of the URL, I get:
>
> java.lang.RuntimeException: No service implements the interface
> org.springframework.security.userdetails.UserDetailsService.
>
> Which is from Tapestry Spring Services saying it can't find the service,
> which is defined in the AppModule.
>
> I can see in the log that it does load three applications, but my DAOs and
> UserDetailsService are not listed under the sub-applications. I assume from
> the error and the lack of output, that it is not sucking in the common
> module's contributions?
>
> Further, it's claiming I have multiple IoCs. Removing the extra filters from
> the web.xml eliminates the multiple IoC issue, but doesn't load my sub-apps.
> Despite the @SubModule, they don't seem to be loading.
>
> Norman Franke
> Answering Service for Directors, Inc.
> www.myasd.com
>
>
>
> On Dec 7, 2009, at 1:01 PM, Howard Lewis Ship wrote:
>
>> Create a common module, and in each app use @SubModule on the app's
>> AppModule to suck in the CommonModule services and contributions.
>>
>> On Mon, Dec 7, 2009 at 9:44 AM, Norman Franke <No...@myasd.com> wrote:
>>>
>>> I'd like to have a single installation of T5 run two apps that will share
>>> a
>>> great deal of code. While I could have separate WAR files and deploy them
>>> to
>>> Tomcat, that would take more resources and prevent some level of
>>> interaction
>>> between them. So, is it possible to have two AppModules in a WAR? Then
>>> depending on the URL, it would appear as if that was the only app
>>> running.
>>> They'll share tons of database objects, DAOs, etc. Some users will have
>>> access to both, so I want to keep them in the same session. As a hack, I
>>> could have the Start page redirect depending on what type they are, but
>>> that
>>> seems less than desirable.
>>>
>>> Norman Franke
>>> Answering Service for Directors, Inc.
>>> www.myasd.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-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
>



-- 
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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5 Multiple AppModules?

Posted by Piero Sartini <li...@pierosartini.de>.
Ups. Just realized that is not what Howard said: Two seperate webapps that 
access one common module. My approach is only one webapp with 2 modules for 
the different app-pages/components.

Sorry for the confusion.

	Piero

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


Re: T5 Multiple AppModules?

Posted by Norman Franke <no...@myasd.com>.
On Dec 7, 2009, at 4:37 PM, Piero Sartini wrote:

>> Do I then create multiple filters in the web.xml for each sub-app? Or
>> just one for /*? Seems to require multiple filter definitions, but
>> then other stuff fails.
>
> Only one filter!

Yes, that seemed obvious after I figured out the multiple IoC issue.

>> Further, it's claiming I have multiple IoCs. Removing the extra
>> filters from the web.xml eliminates the multiple IoC issue, but
>> doesn't load my sub-apps. Despite the @SubModule, they don't seem to
>> be loading.
>
> You need to annotate your main AppModule which is configured in the  
> web-
> context with @SubModule({WebAppModule1.class, WebAppModule2.class})

Somehow, I mis-read that. I was annotating the sub-modules. I don't  
think it's actually possible to really do what I wanted.

> Tapestry IoC will then load the two given classes as new Modules.  
> Then, in
> your new submodules, you do this:
>
>    public static void
> contributeComponentClassResolver(Configuration<LibraryMapping>  
> configuration)
> {
>        configuration.add(new LibraryMapping("moduleId",
> "your.root.package"));
>    }

That was the missing part. I googled for an hour and never came across  
that.

Ultimately, this wasn't really what I wanted exactly, since I have to  
still rename all pages and components in the .tml files to be preceded  
by the new submodule. I'll debate that.

> Also see here for more info:
> http://tapestry.apache.org/tapestry5.1/tapestry-ioc/autoload.html
>
>
> 	Piero
>


Norman Franke
Answering Service for Directors, Inc.
www.myasd.com


Re: T5 Multiple AppModules?

Posted by Piero Sartini <li...@pierosartini.de>.
> Do I then create multiple filters in the web.xml for each sub-app? Or
> just one for /*? Seems to require multiple filter definitions, but
> then other stuff fails.

Only one filter!

> Further, it's claiming I have multiple IoCs. Removing the extra
> filters from the web.xml eliminates the multiple IoC issue, but
> doesn't load my sub-apps. Despite the @SubModule, they don't seem to
> be loading.

You need to annotate your main AppModule which is configured in the web-
context with @SubModule({WebAppModule1.class, WebAppModule2.class})

Tapestry IoC will then load the two given classes as new Modules. Then, in 
your new submodules, you do this:

    public static void 
contributeComponentClassResolver(Configuration<LibraryMapping> configuration) 
{
        configuration.add(new LibraryMapping("moduleId", 
"your.root.package"));
    }


Also see here for more info:
http://tapestry.apache.org/tapestry5.1/tapestry-ioc/autoload.html


	Piero

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


Re: T5 Multiple AppModules?

Posted by Norman Franke <no...@myasd.com>.
Do I then create multiple filters in the web.xml for each sub-app? Or  
just one for /*? Seems to require multiple filter definitions, but  
then other stuff fails.

With separate filters for each sub-level of the URL, I get:

java.lang.RuntimeException: No service implements the interface  
org.springframework.security.userdetails.UserDetailsService.

Which is from Tapestry Spring Services saying it can't find the  
service, which is defined in the AppModule.

I can see in the log that it does load three applications, but my DAOs  
and UserDetailsService are not listed under the sub-applications. I  
assume from the error and the lack of output, that it is not sucking  
in the common module's contributions?

Further, it's claiming I have multiple IoCs. Removing the extra  
filters from the web.xml eliminates the multiple IoC issue, but  
doesn't load my sub-apps. Despite the @SubModule, they don't seem to  
be loading.

Norman Franke
Answering Service for Directors, Inc.
www.myasd.com



On Dec 7, 2009, at 1:01 PM, Howard Lewis Ship wrote:

> Create a common module, and in each app use @SubModule on the app's
> AppModule to suck in the CommonModule services and contributions.
>
> On Mon, Dec 7, 2009 at 9:44 AM, Norman Franke <No...@myasd.com>  
> wrote:
>> I'd like to have a single installation of T5 run two apps that will  
>> share a
>> great deal of code. While I could have separate WAR files and  
>> deploy them to
>> Tomcat, that would take more resources and prevent some level of  
>> interaction
>> between them. So, is it possible to have two AppModules in a WAR?  
>> Then
>> depending on the URL, it would appear as if that was the only app  
>> running.
>> They'll share tons of database objects, DAOs, etc. Some users will  
>> have
>> access to both, so I want to keep them in the same session. As a  
>> hack, I
>> could have the Start page redirect depending on what type they are,  
>> but that
>> seems less than desirable.
>>
>> Norman Franke
>> Answering Service for Directors, Inc.
>> www.myasd.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-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>


Re: T5 Multiple AppModules?

Posted by Howard Lewis Ship <hl...@gmail.com>.
Create a common module, and in each app use @SubModule on the app's
AppModule to suck in the CommonModule services and contributions.

On Mon, Dec 7, 2009 at 9:44 AM, Norman Franke <No...@myasd.com> wrote:
> I'd like to have a single installation of T5 run two apps that will share a
> great deal of code. While I could have separate WAR files and deploy them to
> Tomcat, that would take more resources and prevent some level of interaction
> between them. So, is it possible to have two AppModules in a WAR? Then
> depending on the URL, it would appear as if that was the only app running.
> They'll share tons of database objects, DAOs, etc. Some users will have
> access to both, so I want to keep them in the same session. As a hack, I
> could have the Start page redirect depending on what type they are, but that
> seems less than desirable.
>
> Norman Franke
> Answering Service for Directors, Inc.
> www.myasd.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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org