You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Stephen Nutbrown <st...@gmail.com> on 2015/07/30 21:12:31 UTC

Multiple domains, one webapp

Hi,

To cut a long story short, I have a website running using tapestry which
has two main areas, we will call them "Client accounts" and "Partner
accounts". The powers that be have now decided the best way forwards is to
split this into two separate domains, let's call them www.clients.com and
www.partners.com.

All of the logic and services are set up at the moment and hibernate is
used which accesses one database. Splitting them up is going to be tricky,
as both of the sites need access to the same, up to date database. Ideally
I can serve both these pages from the same webapp, and just say for example
put pages for clients.com in the "pages.clients" package and put pages for
partner.com in the "partner.clients" package, that way they can both make
use of the database, it'll be up to date, and we have to maintain only one
webapp and we don't need to duplicate lots of things or split everything up
in the backend.

Has anyone done something similar, and if so, is there a sensible structure
you would recommend?

I am thinking the most tricky page is the index, so I would have this page
redirect to /clients or /partner by returning the correct page from
onActivate. This would however mean that the page would be
partners.com/partner and clients.com/client but this is OK.

Then, perhaps each page in the clients package can inherit from some base
class which pretty much checks the request to make sure it's on clients.com
and not partners.com (if it is, it can redirect). The same for the
partners.com site.

All in all, I can see this becoming rather messy so i'm looking for any
advice within Tapestry how may be best to do this.

Any help is really appreciated,

Thanks,

Re: Multiple domains, one webapp

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Tue, 11 Aug 2015 06:47:38 -0300, Svein-Erik Løken <sv...@jacilla.no>  
wrote:

> The Manifest configuration is back! Thank you for clarification Thiago!

:)

>> If you main webapp project has anything Tapestry-IoC-related, like
>> declaring services, contributing to them, decorating them or advising
>> them, yes.
>
> Is this correct? Isn't only  
> https://github.com/sveine/tapestry-multi-module-demo/blob/master/common/src/main/java/com/demo/commonlib/services/CommonModule.java  
> read in commonlib, not AppModule.java?

I'm sorry, I didn't understand your question.

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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


RE: Multiple domains, one webapp

Posted by Svein-Erik Løken <sv...@jacilla.no>.
> 
> > Is the "@ImportModule(CommonModule.class)" required?
> 
> For multi-module development with the common module project open and
> live-class-reloadable, yes. If you're just adding the common module JAR to
> the main project (or any project using it as a dependency) as a JAR
> directly, no. You can use both @ImportModule/@SubModule and the
> manifest

The Manifest configuration is back! Thank you for clarification Thiago!

> entry at the same time without problems: Tapestry-IoC will only include
> one module class once no matter how many different times and ways you
> include it.
> 
> > But of course I had the problem that it doesn't seem to run my
> > contributeHibernateEntityPackageManager in HappyModule to add my
> entities
> > package (in my common module) to hibernate - maybe this is why. I'm
> away
> > from my work PC so I will have to check next time.
> 
> That's why.
> 
> > Also, is AppModule here needed?
> > https://github.com/sveine/tapestry-multi-module-
> demo/blob/master/common/src/main/java/com/demo/commonlib/service
> s/AppModule.java
> 
> If you main webapp project has anything Tapestry-IoC-related, like
> declaring services, contributing to them, decorating them or advising
> them, yes.

Is this correct? Isn't only https://github.com/sveine/tapestry-multi-module-demo/blob/master/common/src/main/java/com/demo/commonlib/services/CommonModule.java read in commonlib, not AppModule.java?

> 
> > If we do have to put "@ImportModule(CommonModule.class)" in the
> > non-common appmodules then it means that if we grab a module from
> some
> > library or
> > repository that we need to know the name of the module which needs to
> be
> > imported for it to work (i'm sure this can't be right).
> 
> Yes, but you'll only use that when you have the library open as a project
> in your IDE. Remember, you still should add the manifest file entry to
> your library JARs.
> 
> > There is a good chance my understanding is wrong, but in my
> understanding
> > it's best to have the module be auto loaded without it needing importing,
> > simply by adding it to the classpath (or pom.xml), otherwise the main
> > projects need to know about the details of how the shared module work.
> 
> Same sentence above. Use both when developing in parallel.
> 

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


RE: Multiple domains, one webapp

Posted by Svein-Erik Løken <sv...@jacilla.no>.
> This looks really good and will be really helpful to lots of people - thank
> you!
> I've had a look and have learnt some things from it myself, however I have
> a few questions.
> 
> Is the "@ImportModule(CommonModule.class)" required?
> 
> Instead of that I have something like this in my pom.xml
> <plugin>
>            <groupId>org.apache.maven.plugins</groupId>
>            <artifactId>maven-jar-plugin</artifactId>
>            <configuration>
>            <archive>
>              <manifestEntries>
> 
>  <Tapestry-Module-
> Classes>org.example.happylib.services.HappyModule</Tapestry-Module-
> Classes>
>              </manifestEntries>
>            </archive>
>            </configuration>
>        </plugin>
> 

No! But I find this method much easier (This was a tip from Kalle Korhonen in this thread)

> But of course I had the problem that it doesn't seem to run my
> contributeHibernateEntityPackageManager in HappyModule to add my
> entities
> package (in my common module) to hibernate - maybe this is why. I'm away
> from my work PC so I will have to check next time.

It should run for both methods.

BTW: In my real project I am not using contributeHibernateEntityPackageManager but <mapping class="..."/> in hibernate.cfg.xml because IntelliJ use it to resolve table information.


> 
> Also, is AppModule here needed?
> https://github.com/sveine/tapestry-multi-module-
> demo/blob/master/common/src/main/java/com/demo/commonlib/service
> s/AppModule.java

No! Can be removed.

> 
> If we do have to put "@ImportModule(CommonModule.class)" in the non-
> common
> appmodules then it means that if we grab a module from some library or
> repository that we need to know the name of the module which needs to be
> imported for it to work (i'm sure this can't be right).

> 
> There is a good chance my understanding is wrong, but in my understanding
> it's best to have the module be auto loaded without it needing importing,
> simply by adding it to the classpath (or pom.xml), otherwise the main
> projects need to know about the details of how the shared module work.

The way this is done in tapestry makes sense for me. My main module is addicted to the common module. I don't want a loose coupling. I want to make code in the common module (code-)shared between different front-end modules (end-user, admin, web-service).

 
> On 10 August 2015 at 15:51, Svein-Erik Løken <[hidden email]> wrote:
> 
> > >
> > > > Read about URL rewriting at
> > > > https://tapestry.apache.org/url-rewriting.html, but cannot figure out
> > > > how this can solve my question of how to access assets from javascript.
> > >
> > > Pass the asset URLs from Tapestry to JavaScript.
> > >
> >
> > Thank you Thiago!
> >
> >
> >
> > I have created a project for people who want a quick start with a
> > multi-module tapestry/maven project.
> >
> > https://github.com/sveine/tapestry-multi-module-demo
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> 
> ________________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://apache-tapestry-mailing-list-
> archives.1045711.n5.nabble.com/Multiple-domains-one-webapp-
> tp5730972p5731050.html
> To unsubscribe from users@tapestry.apache.org Mailing List Archives, click
> here.
> NAML

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

Re: Multiple domains, one webapp

Posted by Stephen Nutbrown <st...@gmail.com>.
Thank you also Thiago! You are all awesome and so is tapestry :)
On 10 Aug 2015 18:19, "Thiago H de Paula Figueiredo" <th...@gmail.com>
wrote:

> On Mon, 10 Aug 2015 13:04:25 -0300, Stephen Nutbrown <st...@gmail.com>
> wrote:
>
> This looks really good and will be really helpful to lots of people -
>> thank you!
>>
>
> +1!
>
> Is the "@ImportModule(CommonModule.class)" required?
>>
>
> For multi-module development with the common module project open and
> live-class-reloadable, yes. If you're just adding the common module JAR to
> the main project (or any project using it as a dependency) as a JAR
> directly, no. You can use both @ImportModule/@SubModule and the manifest
> entry at the same time without problems: Tapestry-IoC will only include one
> module class once no matter how many different times and ways you include
> it.
>
> But of course I had the problem that it doesn't seem to run my
>> contributeHibernateEntityPackageManager in HappyModule to add my entities
>> package (in my common module) to hibernate - maybe this is why. I'm away
>> from my work PC so I will have to check next time.
>>
>
> That's why.
>
> Also, is AppModule here needed?
>>
>> https://github.com/sveine/tapestry-multi-module-demo/blob/master/common/src/main/java/com/demo/commonlib/services/AppModule.java
>>
>
> If you main webapp project has anything Tapestry-IoC-related, like
> declaring services, contributing to them, decorating them or advising them,
> yes.
>
> If we do have to put "@ImportModule(CommonModule.class)" in the non-common
>> appmodules then it means that if we grab a module from some library or
>> repository that we need to know the name of the module which needs to be
>> imported for it to work (i'm sure this can't be right).
>>
>
> Yes, but you'll only use that when you have the library open as a project
> in your IDE. Remember, you still should add the manifest file entry to your
> library JARs.
>
> There is a good chance my understanding is wrong, but in my understanding
>> it's best to have the module be auto loaded without it needing importing,
>> simply by adding it to the classpath (or pom.xml), otherwise the main
>> projects need to know about the details of how the shared module work.
>>
>
> Same sentence above. Use both when developing in parallel.
>
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Multiple domains, one webapp

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Mon, 10 Aug 2015 13:04:25 -0300, Stephen Nutbrown <st...@gmail.com>  
wrote:

> This looks really good and will be really helpful to lots of people -  
> thank you!

+1!

> Is the "@ImportModule(CommonModule.class)" required?

For multi-module development with the common module project open and  
live-class-reloadable, yes. If you're just adding the common module JAR to  
the main project (or any project using it as a dependency) as a JAR  
directly, no. You can use both @ImportModule/@SubModule and the manifest  
entry at the same time without problems: Tapestry-IoC will only include  
one module class once no matter how many different times and ways you  
include it.

> But of course I had the problem that it doesn't seem to run my
> contributeHibernateEntityPackageManager in HappyModule to add my entities
> package (in my common module) to hibernate - maybe this is why. I'm away
> from my work PC so I will have to check next time.

That's why.

> Also, is AppModule here needed?
> https://github.com/sveine/tapestry-multi-module-demo/blob/master/common/src/main/java/com/demo/commonlib/services/AppModule.java

If you main webapp project has anything Tapestry-IoC-related, like  
declaring services, contributing to them, decorating them or advising  
them, yes.

> If we do have to put "@ImportModule(CommonModule.class)" in the  
> non-common appmodules then it means that if we grab a module from some  
> library or
> repository that we need to know the name of the module which needs to be
> imported for it to work (i'm sure this can't be right).

Yes, but you'll only use that when you have the library open as a project  
in your IDE. Remember, you still should add the manifest file entry to  
your library JARs.

> There is a good chance my understanding is wrong, but in my understanding
> it's best to have the module be auto loaded without it needing importing,
> simply by adding it to the classpath (or pom.xml), otherwise the main
> projects need to know about the details of how the shared module work.

Same sentence above. Use both when developing in parallel.

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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


Re: Multiple domains, one webapp

Posted by Stephen Nutbrown <st...@gmail.com>.
This looks really good and will be really helpful to lots of people - thank
you!
I've had a look and have learnt some things from it myself, however I have
a few questions.

Is the "@ImportModule(CommonModule.class)" required?

Instead of that I have something like this in my pom.xml
<plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-jar-plugin</artifactId>
           <configuration>
           <archive>
             <manifestEntries>

 <Tapestry-Module-Classes>org.example.happylib.services.HappyModule</Tapestry-Module-Classes>
             </manifestEntries>
           </archive>
           </configuration>
       </plugin>

But of course I had the problem that it doesn't seem to run my
contributeHibernateEntityPackageManager in HappyModule to add my entities
package (in my common module) to hibernate - maybe this is why. I'm away
from my work PC so I will have to check next time.

Also, is AppModule here needed?
https://github.com/sveine/tapestry-multi-module-demo/blob/master/common/src/main/java/com/demo/commonlib/services/AppModule.java

If we do have to put "@ImportModule(CommonModule.class)" in the non-common
appmodules then it means that if we grab a module from some library or
repository that we need to know the name of the module which needs to be
imported for it to work (i'm sure this can't be right).

There is a good chance my understanding is wrong, but in my understanding
it's best to have the module be auto loaded without it needing importing,
simply by adding it to the classpath (or pom.xml), otherwise the main
projects need to know about the details of how the shared module work.

On 10 August 2015 at 15:51, Svein-Erik Løken <sv...@jacilla.no> wrote:

> >
> > > Read about URL rewriting at
> > > https://tapestry.apache.org/url-rewriting.html, but cannot figure out
> > > how this can solve my question of how to access assets from javascript.
> >
> > Pass the asset URLs from Tapestry to JavaScript.
> >
>
> Thank you Thiago!
>
>
>
> I have created a project for people who want a quick start with a
> multi-module tapestry/maven project.
>
> https://github.com/sveine/tapestry-multi-module-demo
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

RE: Multiple domains, one webapp

Posted by Svein-Erik Løken <sv...@jacilla.no>.
> 
> > Read about URL rewriting at
> > https://tapestry.apache.org/url-rewriting.html, but cannot figure out
> > how this can solve my question of how to access assets from javascript.
> 
> Pass the asset URLs from Tapestry to JavaScript.
> 

Thank you Thiago!



I have created a project for people who want a quick start with a multi-module tapestry/maven project.

https://github.com/sveine/tapestry-multi-module-demo


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

Re: Multiple domains, one webapp

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Mon, 10 Aug 2015 06:05:27 -0300, Svein-Erik Løken <sv...@jacilla.no>  
wrote:

> Read about URL rewriting at  
> https://tapestry.apache.org/url-rewriting.html, but cannot figure out  
> how this can solve my question of how to access assets from javascript.

Pass the asset URLs from Tapestry to JavaScript.

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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


RE: Multiple domains, one webapp

Posted by Svein-Erik Løken <sv...@jacilla.no>.
Read about URL rewriting at https://tapestry.apache.org/url-rewriting.html, but cannot figure out how this can solve my question of how to access assets from javascript. 

> 
> I use to host tons of dealer websites on a single Tapestry application all
> with their own unique domain. I used a combination of Mod rewrite and
> Tapestry's URL rewriter. It worked flawlessly.
> 
> On Fri, Aug 7, 2015 at 8:00 AM, Svein-Erik Løken <[hidden email]> wrote:
> 
> > >
> > > > WOW! Multi-module in Tapestry with Live Class Reloading is fantastic!
> > > > Thanks for pointing me in the right direction Thiago!
> > >
> > > Yay! Virtual high-five! :D Tapestry is awesome, isn't it? ;)
> > >
> >
> > Oh yea! T5.4 is a success!
> >
> > > specify @SubModule(HappyModule.class) (or @ImportModule in T5.4) in
> your
> > Tanks Kalle! A good replacement for
> > <manifestEntries><Tapestry-Module-Classes>
> >
> >
> > I am moving a lot of code to my common module. I think the biggest
> > challenge is how to access assets from JavaScript.
> >
> > I moved the box_1.png, box_2.png, ... images to my common modules
> > META-INF.assets.jacillacore.img.destinationStatus
> >
> > public static void
> > contributeComponentClassResolver(Configuration<LibraryMapping>
> > configuration) {
> >         configuration.add(new LibraryMapping("jacillacore",
> > "com.jacilla.core"));
> > }
> >
> > My original code:
> > var iconUrl = "/img/destinationStatus/box_" + prepStatus + ".png";
> >
> > Tried:
> > var iconUrl = "${asset:jacillacore/img/destinationStatus/box_" +
> > prepStatus + ".png}";
> > and:
> > var iconUrl = "/jacillacore/assets/jacillacore/img/destinationStatus/box_"
> > + prepStatus + ".png";
> >
> >
> > It did not work! Is it possible to access then directly for javascript?
> >
> > To make it work I had to send the asset url's to the javascript module:
> >         final JSONObject statusImages = new JSONObject();
> >         for (int i = 1; i <= maxStatus; i++) {
> >             final String format =
> > String.format("/META-
> INF/assets/jacillacore/img/destinationStatus/box_%d.png",
> > i);
> >             Asset asset = assetSource.getExpandedAsset(format);
> >             statusImages.put(String.valueOf(i), asset.toClientURL());
> >         }
> >         return new JSONObject(
> >                 "statusImages", statusImages,
> >                 "symbols", symbols);
> >
> > Is this the correct way of doing this in T5.4, or could it be simpler?
> >

Re: Multiple domains, one webapp

Posted by George Christman <gc...@cardaddy.com>.
I use to host tons of dealer websites on a single Tapestry application all
with their own unique domain. I used a combination of Mod rewrite and
Tapestry's URL rewriter. It worked flawlessly.

On Fri, Aug 7, 2015 at 8:00 AM, Svein-Erik Løken <sv...@jacilla.no> wrote:

> >
> > > WOW! Multi-module in Tapestry with Live Class Reloading is fantastic!
> > > Thanks for pointing me in the right direction Thiago!
> >
> > Yay! Virtual high-five! :D Tapestry is awesome, isn't it? ;)
> >
>
> Oh yea! T5.4 is a success!
>
> > specify @SubModule(HappyModule.class) (or @ImportModule in T5.4) in your
> Tanks Kalle! A good replacement for
> <manifestEntries><Tapestry-Module-Classes>
>
>
> I am moving a lot of code to my common module. I think the biggest
> challenge is how to access assets from JavaScript.
>
> I moved the box_1.png, box_2.png, ... images to my common modules
> META-INF.assets.jacillacore.img.destinationStatus
>
> public static void
> contributeComponentClassResolver(Configuration<LibraryMapping>
> configuration) {
>         configuration.add(new LibraryMapping("jacillacore",
> "com.jacilla.core"));
> }
>
> My original code:
> var iconUrl = "/img/destinationStatus/box_" + prepStatus + ".png";
>
> Tried:
> var iconUrl = "${asset:jacillacore/img/destinationStatus/box_" +
> prepStatus + ".png}";
> and:
> var iconUrl = "/jacillacore/assets/jacillacore/img/destinationStatus/box_"
> + prepStatus + ".png";
>
>
> It did not work! Is it possible to access then directly for javascript?
>
> To make it work I had to send the asset url's to the javascript module:
>         final JSONObject statusImages = new JSONObject();
>         for (int i = 1; i <= maxStatus; i++) {
>             final String format =
> String.format("/META-INF/assets/jacillacore/img/destinationStatus/box_%d.png",
> i);
>             Asset asset = assetSource.getExpandedAsset(format);
>             statusImages.put(String.valueOf(i), asset.toClientURL());
>         }
>         return new JSONObject(
>                 "statusImages", statusImages,
>                 "symbols", symbols);
>
> Is this the correct way of doing this in T5.4, or could it be simpler?
>
>
>
>
>
>


-- 
George Christman
CEO
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

RE: Multiple domains, one webapp

Posted by Svein-Erik Løken <sv...@jacilla.no>.
> 
> > WOW! Multi-module in Tapestry with Live Class Reloading is fantastic!
> > Thanks for pointing me in the right direction Thiago!
> 
> Yay! Virtual high-five! :D Tapestry is awesome, isn't it? ;)
> 

Oh yea! T5.4 is a success!

> specify @SubModule(HappyModule.class) (or @ImportModule in T5.4) in your
Tanks Kalle! A good replacement for <manifestEntries><Tapestry-Module-Classes> 


I am moving a lot of code to my common module. I think the biggest challenge is how to access assets from JavaScript.

I moved the box_1.png, box_2.png, ... images to my common modules META-INF.assets.jacillacore.img.destinationStatus

public static void contributeComponentClassResolver(Configuration<LibraryMapping> configuration) {
        configuration.add(new LibraryMapping("jacillacore", "com.jacilla.core"));
}

My original code:
var iconUrl = "/img/destinationStatus/box_" + prepStatus + ".png";

Tried: 
var iconUrl = "${asset:jacillacore/img/destinationStatus/box_" + prepStatus + ".png}";
and:
var iconUrl = "/jacillacore/assets/jacillacore/img/destinationStatus/box_" + prepStatus + ".png";


It did not work! Is it possible to access then directly for javascript?

To make it work I had to send the asset url's to the javascript module:
        final JSONObject statusImages = new JSONObject();
        for (int i = 1; i <= maxStatus; i++) {
            final String format = String.format("/META-INF/assets/jacillacore/img/destinationStatus/box_%d.png", i);
            Asset asset = assetSource.getExpandedAsset(format);
            statusImages.put(String.valueOf(i), asset.toClientURL());
        }
        return new JSONObject(
                "statusImages", statusImages,
                "symbols", symbols);

Is this the correct way of doing this in T5.4, or could it be simpler?






RE: Multiple domains, one webapp

Posted by Svein-Erik Løken <sv...@jacilla.no>.
Do you have Tapestry-Module-Classes set up in the common module? https://tapestry.apache.org/autoloading-modules.html

The hibernate.cfg.xml and maven dependency to hibernate should be set up in the main module.
E.g.
<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-c3p0</artifactId>
</dependency>


> The only issue I am having is that my code for hibernate doesn't seem to 
> work quite as expexted. Ideally, this should be picked up from the happylib 
>
> public static void 
> contributeHibernateEntityPackageManager(Configuration<String> 
> configuration) { 
>        configuration.add("com.my.package.myentities"); 
>    } 
>
> However I am finding it only seems to work for me if it's in the main 
> projects AppModule.java, perhaps I have configured something wrong, or 
> perhaps this has to be in app module rather than in my shared jar? 
>
> I've put the hibernate entities that are shared between the projects in 
> there and so ideally the code should be in the shared library rather than 
> duplicated in both webapps (although it works as it is... any ideas what 
> may cause that?) 


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

Re: Multiple domains, one webapp

Posted by Stephen Nutbrown <st...@gmail.com>.
This one:

https://tapestry.apache.org/component-libraries.html

There are a few issues, if someone has a chance to edit them i'll just list
them here:


1) It says:

You will need to modify the Tapestry release version number ("5.2.0" in the
listing above) to reflect the current version of Tapestry when you create
your component library.

The tapestry version in the example pom is 5.4-beta-28. There are two
problems here - mainly that the text is wrong, but also that i'm not sure
if we should have beta releases in the documentation. I assume that's ok
though which brings about the next issue


2) The @Path annotation is relative to the HappyIcon.class file; it should
be stored in the project under
src/main/resources/org/example/happylib/components.

Whilst this will work, you will then get a log saying that images should be
under the META-INF/assets directory.


3) "This page has not yet been fully updated for Tapestry 5.4. Things are
different and simpler in 5.4 than in previous releases."
This contradicts the pom example a little, I think the documentation should
probably be updated and this removed. It worked mostly (with the above
differences) fine for me on 5.4


4)The example pom points at : http://snapshots.repository.codehaus.org/

I think this is no longer there and neither is the other repo it points at:
http://archiva.openqa.org/repository/releases/

Another quick question - In my project I was using beta 32 from staging
here:

https://repository.apache.org/content/groups/staging/


It then seemed to then be removed and replaced by 33, but when I update to
use 33 I kept getting an issue saying maven could not read the jar file so
I had to go back to beta-26 where it seemed to work again. I'm not sure if
anyone else experienced something similar.

I suppose we shouldn't be using the staging repository for anything other
than testing, where is the actual official repository for full releases? I
always seem to have similar problems. I notice beta 26 is available here:
http://mvnrepository.com/artifact/org.apache.tapestry

5)It would be nice, although perhaps not the focus of the T5 documentation,
to show how this module can be referenced from another project using the
pom.xml. I'm sure many others are looking at this with that in mind,
particularly as many of the examples use mvn.
I found I was able to add this to my other project, and so long as I had
installed the happylib using mvn clean install, I could use:

<dependency>

<groupId>org.example</groupId>

<artifactId>happylib</artifactId>

<version>1.0-SNAPSHOT</version>

</dependency>

Eventually I suppose I am going to need a top level pom which compiles both
of these together. I'm not quite sure about how maven works here, as
ultimately it means for anyone building my project they currently need to
manually build and install happylib first for maven to know about it, but
this detail may not be required for the documentation (I think it's a nice
to have though)

I can't attach the .zip of the project with gmail as it says there is some
security problem, however I have uploaded it here for now in case it can be
attached to the documentation (probably worth checking it first):
www.spindroid.co.uk/shared.zip


Of course now this is set up, to go back to my original issue - I am going
to put the hibernate entities in this happy lib and sort out the naming of
it, then I can reference it from my two web apps. I will need to contribute
something to say where the hibernate entities are but I did see some
documentation about that and it should look a little vur like this:
    public static void
contributeHibernateEntityPackageManager(Configuration<String>
configuration) {
        configuration.add("com.my.package.myentities");
    }

Thanks,

Steve


On 4 Aug 2015 23:14, "Thiago H de Paula Figueiredo" <th...@gmail.com>
wrote:

> On Tue, 04 Aug 2015 18:15:20 -0300, Stephen Nutbrown <st...@gmail.com>
> wrote:
>
> Thanks. I have got the example set up from the documentation for the happy
>> lib.  I found some bits that seemed not quite right along the way.
>>
>
> Which ones? If there's anything wrong on the documentation, we should fix
> it.
>
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Multiple domains, one webapp

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Tue, 04 Aug 2015 18:15:20 -0300, Stephen Nutbrown <st...@gmail.com>  
wrote:

> Thanks. I have got the example set up from the documentation for the  
> happy lib.  I found some bits that seemed not quite right along the way.

Which ones? If there's anything wrong on the documentation, we should fix  
it.

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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


Re: Multiple domains, one webapp

Posted by Stephen Nutbrown <st...@gmail.com>.
Thanks. I have got the example set up from the documentation for the happy
lib.  I found some bits that seemed not quite right along the way. Perhaps
it is possible to attach full working examples to the documentation as a
zip or git repo. I am happy to attach it here for reference, any chance
someone can update it in the documentation?

Thanks,
Steve
On 4 Aug 2015 19:29, "Thiago H de Paula Figueiredo" <th...@gmail.com>
wrote:

> On Tue, 04 Aug 2015 12:19:40 -0300, Stephen Nutbrown <st...@gmail.com>
> wrote:
>
> It's checked by default on my Eclipse Lunar - I haven't used it yet as i'm
>> just diving into making this shared module to see how it goes.
>>
>
> As long as the compiler target folder of the included
> library/module/subproject is included in the classpath of the main project,
> regardless of what tool you're using, live class reloading will work after
> a class in the library/module/subproject is recompiled. Maybe Eclipse makes
> it easier because it compiles automatically on save. I don't know how IDEA
> handles this.
>
>
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

RE: Multiple domains, one webapp

Posted by Svein-Erik Løken <sv...@jacilla.no>.
Do you have Tapestry-Module-Classes set up in the common module? https://tapestry.apache.org/autoloading-modules.html



The hibernate.cfg.xml and maven dependency to hibernate should be set up in the main module.

E.g.

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-c3p0</artifactId>
</dependency>



The only issue I am having is that my code for hibernate doesn't seem to
work quite as expexted. Ideally, this should be picked up from the happylib

public static void
contributeHibernateEntityPackageManager(Configuration<String>
configuration) {
        configuration.add("com.my.package.myentities");
    }

However I am finding it only seems to work for me if it's in the main
projects AppModule.java, perhaps I have configured something wrong, or
perhaps this has to be in app module rather than in my shared jar?

I've put the hibernate entities that are shared between the projects in
there and so ideally the code should be in the shared library rather than
duplicated in both webapps (although it works as it is... any ideas what
may cause that?)



Re: Multiple domains, one webapp

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Wed, 05 Aug 2015 17:42:29 -0300, Svein-Erik Løken <sv...@jacilla.no>  
wrote:

> WOW! Multi-module in Tapestry with Live Class Reloading is fantastic!  
> Thanks for pointing me in the right direction Thiago!

Yay! Virtual high-five! :D Tapestry is awesome, isn't it? ;)

> To get live class reloading work for the common module in IntelliJ: Open  
> Project Structure, Project Settings > Modules. Select the common module  
> > Paths > Compiler output. Set Output path to the same path as the main  
> project output path.

Thanks for sharing this all with us!

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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


Re: Multiple domains, one webapp

Posted by Kalle Korhonen <ka...@gmail.com>.
On Wed, Aug 5, 2015 at 4:12 PM, Stephen Nutbrown <st...@gmail.com>
wrote:

> Seems to be working for me too! Thanks.
> The only issue I am having is that my code for hibernate doesn't seem to
> work quite as expexted. Ideally, this should be picked up from the happylib
> public static void
> contributeHibernateEntityPackageManager(Configuration<String>
> configuration) {
>         configuration.add("com.my.package.myentities");
>     }
> However I am finding it only seems to work for me if it's in the main
> projects AppModule.java, perhaps I have configured something wrong, or
> perhaps this has to be in app module rather than in my shared jar?
>

I suspect the HappyModule configuration isn't read at all. That's because
you don't have a manifest when you are reading the classes directly from
the the target path rather than from a jar. Often, you need to explicitly
specify @SubModule(HappyModule.class) (or @ImportModule in T5.4) in your
AppModule when you are developing multiple libraries at the same time (or,
doing integration testing of your modules).

Kalle


> I've put the hibernate entities that are shared between the projects in
> there and so ideally the code should be in the shared library rather than
> duplicated in both webapps (although it works as it is... any ideas what
> may cause that?)
>
> Thanks,
> Steve
> On 5 Aug 2015 21:42, "Svein-Erik Løken" <sv...@jacilla.no> wrote:
>
> > WOW! Multi-module in Tapestry with Live Class Reloading is fantastic!
> > Thanks for pointing me in the right direction Thiago!
> >
> > To get live class reloading work for the common module in IntelliJ: Open
> > Project Structure, Project Settings > Modules. Select the common module >
> > Paths > Compiler output. Set Output path to the same path as the main
> > project output path.
> >
> > I have created a multi-module maven demo project for test and
> > documentation. A page in the main project includes a component-class from
> > the common module. I have demo of using assets (img and js-modules) and
> IoC
> > service. Everything works with Live Class Reloading.
> >
> > I am using a top-level pom (dependencyManagement, pluginManagement,
> > properties), a modules pom (maven-root), the main project (war), and the
> > common module (jar).
> >
> > The main project and common module is both created from mvn
> > -DarchetypeArtifactId=quickstart ..., with necessary modification.
> >
> > I have documented all steps to make everything working in IntelliJ
> (plugin
> > configuration etc).
> >
> >
> > >
> > > As long as the compiler target folder of the included
> > > library/module/subproject is included in the classpath of the main
> > > project, regardless of what tool you're using, live class reloading
> will
> > > work after a class in the library/module/subproject is recompiled.
> Maybe
> > > Eclipse makes it easier because it compiles automatically on save. I
> > don't
> > > know how IDEA handles this.
> > >
> > >
> > > --
> > > Thiago H. de Paula Figueiredo
> > > Tapestry, Java and Hibernate consultant and developer
> > > http://machina.com.br
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>

RE: Multiple domains, one webapp

Posted by Stephen Nutbrown <st...@gmail.com>.
Seems to be working for me too! Thanks.

The only issue I am having is that my code for hibernate doesn't seem to
work quite as expexted. Ideally, this should be picked up from the happylib

public static void
contributeHibernateEntityPackageManager(Configuration<String>
configuration) {
        configuration.add("com.my.package.myentities");
    }

However I am finding it only seems to work for me if it's in the main
projects AppModule.java, perhaps I have configured something wrong, or
perhaps this has to be in app module rather than in my shared jar?

I've put the hibernate entities that are shared between the projects in
there and so ideally the code should be in the shared library rather than
duplicated in both webapps (although it works as it is... any ideas what
may cause that?)

Thanks,
Steve
On 5 Aug 2015 21:42, "Svein-Erik Løken" <sv...@jacilla.no> wrote:

> WOW! Multi-module in Tapestry with Live Class Reloading is fantastic!
> Thanks for pointing me in the right direction Thiago!
>
> To get live class reloading work for the common module in IntelliJ: Open
> Project Structure, Project Settings > Modules. Select the common module >
> Paths > Compiler output. Set Output path to the same path as the main
> project output path.
>
> I have created a multi-module maven demo project for test and
> documentation. A page in the main project includes a component-class from
> the common module. I have demo of using assets (img and js-modules) and IoC
> service. Everything works with Live Class Reloading.
>
> I am using a top-level pom (dependencyManagement, pluginManagement,
> properties), a modules pom (maven-root), the main project (war), and the
> common module (jar).
>
> The main project and common module is both created from mvn
> -DarchetypeArtifactId=quickstart ..., with necessary modification.
>
> I have documented all steps to make everything working in IntelliJ (plugin
> configuration etc).
>
>
> >
> > As long as the compiler target folder of the included
> > library/module/subproject is included in the classpath of the main
> > project, regardless of what tool you're using, live class reloading will
> > work after a class in the library/module/subproject is recompiled. Maybe
> > Eclipse makes it easier because it compiles automatically on save. I
> don't
> > know how IDEA handles this.
> >
> >
> > --
> > Thiago H. de Paula Figueiredo
> > Tapestry, Java and Hibernate consultant and developer
> > http://machina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

RE: Multiple domains, one webapp

Posted by Svein-Erik Løken <sv...@jacilla.no>.
WOW! Multi-module in Tapestry with Live Class Reloading is fantastic! Thanks for pointing me in the right direction Thiago!

To get live class reloading work for the common module in IntelliJ: Open Project Structure, Project Settings > Modules. Select the common module > Paths > Compiler output. Set Output path to the same path as the main project output path.

I have created a multi-module maven demo project for test and documentation. A page in the main project includes a component-class from the common module. I have demo of using assets (img and js-modules) and IoC service. Everything works with Live Class Reloading.

I am using a top-level pom (dependencyManagement, pluginManagement, properties), a modules pom (maven-root), the main project (war), and the common module (jar).

The main project and common module is both created from mvn -DarchetypeArtifactId=quickstart ..., with necessary modification.

I have documented all steps to make everything working in IntelliJ (plugin configuration etc).


> 
> As long as the compiler target folder of the included
> library/module/subproject is included in the classpath of the main
> project, regardless of what tool you're using, live class reloading will
> work after a class in the library/module/subproject is recompiled. Maybe
> Eclipse makes it easier because it compiles automatically on save. I don't
> know how IDEA handles this.
> 
> 
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br

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


Re: Multiple domains, one webapp

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Tue, 04 Aug 2015 12:19:40 -0300, Stephen Nutbrown <st...@gmail.com>  
wrote:

> It's checked by default on my Eclipse Lunar - I haven't used it yet as  
> i'm just diving into making this shared module to see how it goes.

As long as the compiler target folder of the included  
library/module/subproject is included in the classpath of the main  
project, regardless of what tool you're using, live class reloading will  
work after a class in the library/module/subproject is recompiled. Maybe  
Eclipse makes it easier because it compiles automatically on save. I don't  
know how IDEA handles this.


-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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


Re: Multiple domains, one webapp

Posted by Stephen Nutbrown <st...@gmail.com>.
It's checked by default on my Eclipse Lunar - I haven't used it yet as i'm
just diving into making this shared module to see how it goes.

Thanks,
Steve

On 4 August 2015 at 16:15, Lance Java <la...@googlemail.com> wrote:

> Further from Thiagos connents...
>
> In eclipse, when using the m2e plugin you can right click on a project
>
> Properties -> Maven -> Resolve dependencies from Workplace projects
>
> This is flagged on by default. Perhaps intellij has a similar configuration
> option?
>
> It's rare that eclipse can do something that intellij cant.
>

Re: Multiple domains, one webapp

Posted by Lance Java <la...@googlemail.com>.
Further from Thiagos connents...

In eclipse, when using the m2e plugin you can right click on a project

Properties -> Maven -> Resolve dependencies from Workplace projects

This is flagged on by default. Perhaps intellij has a similar configuration
option?

It's rare that eclipse can do something that intellij cant.

Re: Multiple domains, one webapp

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Tue, 04 Aug 2015 12:12:02 -0300, Stephen Nutbrown <st...@gmail.com>  
wrote:

> Hi,

Hi!

> I'm looking at the documentation at he moment for how to create a jar  
> file for tapestry to use and I intend to use the documentation here:
> https://tapestry.apache.org/component-libraries.html
>
> I did spot that it says clearly at the top: "This page has not yet been
> fully updated for Tapestry 5.4. Things are different and simpler in 5.4
> than in previous releases." but i'm going to have to just run with it and
> find out what those changes are as I go along.

I don't think this has really changed in Tapestry 5.4. At least I cannot  
recall anything like that. Anyway, I think creating component libraries in  
any Tapestry version is already easy and the pre-5.4 way of doing that  
will continue to work in 5.4+, as the project has always been very  
concerned with backward compatibility.

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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


Re: Multiple domains, one webapp

Posted by Stephen Nutbrown <st...@gmail.com>.
Hi,

Many thanks for all of your thoughts on this. I have chosen to go with
having a common project as a jar and setting up maven to build this project
first and use it as a dependency for the other two. This means i'll be able
to put the various entities in there that are shared between both web
applications. I am not *too* concerned about live class reloading if it's
only for the shared JAR since it will contain mainly only entities and it
doesn't take long whilst developing to just hit "run" again if I can't
figure out a better way. I would imagine these entities will remain
relatively static throughout the restructing as they are mapped to database
tables using hibernate and everything currently works, they are just going
to be moved.

Another factor in deciding to use this approach is that I have been told we
are having one side of the website launch before the other and this
division of the projects into separate web apps makes it slightly easier.

I'm looking at the documentation at he moment for how to create a jar file
for tapestry to use and I intend to use the documentation here:
https://tapestry.apache.org/component-libraries.html

I did spot that it says clearly at the top: "This page has not yet been
fully updated for Tapestry 5.4. Things are different and simpler in 5.4
than in previous releases." but i'm going to have to just run with it and
find out what those changes are as I go along.

I think long term, having them split into two webapps that just share the
same model (the database and various entities) makes most sense. In the
meantime, whilst making this decision I have been working on the front end,
but after a while of reading up I am thinking (for us) this is the best
solution.

Any light on what the documentation is hinting at with the updates for that
page would be fantastic if anyone has any ideas.

Thanks,
Steve

On 4 August 2015 at 15:40, Thiago H de Paula Figueiredo <th...@gmail.com>
wrote:

> On Tue, 04 Aug 2015 10:27:01 -0300, Svein-Erik Løken <sv...@jacilla.no>
> wrote:
>
> >> 4) You can't use Tapestry's Live Class Reloading on any class in the
>>> >> common
>>> >> JAR (e.g. Tapestry IOC service implementation classes).
>>> >
>>> > I think 4) is the biggest downside in a multi-module project. Do you
>>> > think Tapestry can do a Live Class Reloading of the common JAR included
>>> > with contributeCoreLibComponentClasses?
>>>
>>> If this is about Eclipse (I'm not sure about other IDEs, since I haven't
>>> used any besides Eclipse for many years), if you have all the projects
>>> open at the same time, you can use live class reloading on all of them at
>>> the same, and I do this all the time.
>>>
>>>
>> Really! I am using IntelliJ IDEA Ultimate and NEED this functionality.
>> Today I need to recompile all maven projects and restart jetty for every
>> change to components and JavaScript modules (all resources) in the common
>> JAR.
>>
>
> If you're including your common project as a JAR in the classpath of your
> main project, live class reloading will never work. On the other hand, if
> you include your common project's target folder (where the .class files are
> generated) in the classpath of your main project, it should work. I'm sure
> there's a way of doing that in IDEA. There has to be one. IDEA would suck
> if there wasn't, and apparently IDEA is the opposite of suck. :)
>
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Multiple domains, one webapp

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Tue, 04 Aug 2015 10:27:01 -0300, Svein-Erik Løken <sv...@jacilla.no>  
wrote:

>> >> 4) You can't use Tapestry's Live Class Reloading on any class in the
>> >> common
>> >> JAR (e.g. Tapestry IOC service implementation classes).
>> >
>> > I think 4) is the biggest downside in a multi-module project. Do you
>> > think Tapestry can do a Live Class Reloading of the common JAR  
>> included
>> > with contributeCoreLibComponentClasses?
>>
>> If this is about Eclipse (I'm not sure about other IDEs, since I haven't
>> used any besides Eclipse for many years), if you have all the projects
>> open at the same time, you can use live class reloading on all of them  
>> at
>> the same, and I do this all the time.
>>
>
> Really! I am using IntelliJ IDEA Ultimate and NEED this functionality.  
> Today I need to recompile all maven projects and restart jetty for every  
> change to components and JavaScript modules (all resources) in the  
> common JAR.

If you're including your common project as a JAR in the classpath of your  
main project, live class reloading will never work. On the other hand, if  
you include your common project's target folder (where the .class files  
are generated) in the classpath of your main project, it should work. I'm  
sure there's a way of doing that in IDEA. There has to be one. IDEA would  
suck if there wasn't, and apparently IDEA is the opposite of suck. :)

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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


RE: Multiple domains, one webapp

Posted by Svein-Erik Løken <sv...@jacilla.no>.
> >> 4) You can't use Tapestry's Live Class Reloading on any class in the
> >> common
> >> JAR (e.g. Tapestry IOC service implementation classes).
> >
> > I think 4) is the biggest downside in a multi-module project. Do you
> > think Tapestry can do a Live Class Reloading of the common JAR included
> > with contributeCoreLibComponentClasses?
> 
> If this is about Eclipse (I'm not sure about other IDEs, since I haven't
> used any besides Eclipse for many years), if you have all the projects
> open at the same time, you can use live class reloading on all of them at
> the same, and I do this all the time.
> 

Really! I am using IntelliJ IDEA Ultimate and NEED this functionality. Today I need to recompile all maven projects and restart jetty for every change to components and JavaScript modules (all resources) in the common JAR.

The common JAR project is included in the Project view. Has anyone solved this in IntelliJ IDEA?



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

Re: Multiple domains, one webapp

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Tue, 04 Aug 2015 10:05:49 -0300, Svein-Erik Løken <sv...@jacilla.no>  
wrote:

>> 4) You can't use Tapestry's Live Class Reloading on any class in the  
>> common
>> JAR (e.g. Tapestry IOC service implementation classes).
>
> I think 4) is the biggest downside in a multi-module project. Do you  
> think Tapestry can do a Live Class Reloading of the common JAR included  
> with contributeCoreLibComponentClasses?

If this is about Eclipse (I'm not sure about other IDEs, since I haven't  
used any besides Eclipse for many years), if you have all the projects  
open at the same time, you can use live class reloading on all of them at  
the same, and I do this all the time.

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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


RE: Multiple domains, one webapp

Posted by Svein-Erik Løken <sv...@jacilla.no>.
> 1) You have to maintain three projects (or a Maven multi-module project if
> you're using Maven) instead of one.
> 2) You'll have two different app servers to configure & maintain.
> 3) You'll probably need to maintain database credentials in two different
> places.
> 4) You can't use Tapestry's Live Class Reloading on any class in the common
> JAR (e.g. Tapestry IOC service implementation classes).


I think 4) is the biggest downside in a multi-module project. Do you think Tapestry can do a Live Class Reloading of the common JAR included with contributeCoreLibComponentClasses?



> 5) If you use an automated build server like Jenkins then you'll have to
> set up and maintain triple the number of jobs.
> 6) Your build process will be slower and more error prone because you'll
> often have to build the common JAR before building and deploying you'll
> have different log files.

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


Re: Multiple domains, one webapp

Posted by John Coleman <qb...@gmail.com>.
I'm going to agree with Bob here. Reducing complexity is a top level goal
IMO. Using a different app for different URLs seems somewhat familiar to
the MVC anti-pattern.

The domain name used to access a system ought to be considered part of the
presentation layer (like an interface vs an implementation) and therefore
should not inform how an application is assembled.

John


On Sat, Aug 1, 2015 at 11:01 PM, Bob Harner <bo...@gmail.com> wrote:

> Stephen,
>
> An contrary viewpoint...
>
> There is really nothing wrong with having two web front ends for a single
> web app if you handle authentication in a clean and reliable way. Sure, the
> conventional wisdom is to split the app into 3 parts (clients, partners,
> and a common JAR containing classes that both share) as Dimitri and Thiago
> recommend. However, doing so does add significant infrastructure
> complexity:
>
> 1) You have to maintain three projects (or a Maven multi-module project if
> you're using Maven) instead of one.
> 2) You'll have two different app servers to configure & maintain.
> 3) You'll probably need to maintain database credentials in two different
> places.
> 4) You can't use Tapestry's Live Class Reloading on any class in the common
> JAR (e.g. Tapestry IOC service implementation classes).
> 5) If you use an automated build server like Jenkins then you'll have to
> set up and maintain triple the number of jobs.
> 6) Your build process will be slower and more error prone because you'll
> often have to build the common JAR before building and deploying you'll
> have different log files.
>
> On Thu, Jul 30, 2015 at 5:05 PM, Stephen Nutbrown <st...@gmail.com>
> wrote:
>
> > Thanks for the advice. I'll go with this. I will look into how to create
> a
> > module which I can use in both webapps, and I will need to find a
> reliable
> > way to connect both of the webapps to the same (amazon RDS) database
> > without running out of connections etc (I believe this will just mean
> > working with the hibernate config).
> >
> > In the long run, I do think this is the best approach, although as we
> > currently have ~70 pages and around 10 services, i'm sure you can imagine
> > why I was a little hesitant to start chopping things out of it, but I
> > suppose this number of pages and services is all the more reason to split
> > it into two webapps.
> >
> > One benefit of having a single webapp is hosting prices, as it's with
> > Amazon on an EC2 instance - it means we will now have two EC2 instances
> > unless I can figure out a way to get them both on one - I am sure this is
> > possible but perhaps not particularly easy.
> >
> > Thanks again for all the help - I know what I have to do, it's just going
> > to be quite an effort (no fault of T5 - it's a huge change to the
> direction
> > of the project).
> >
> >
> >
> > On 30 July 2015 at 21:45, Norman Franke <no...@myasd.com> wrote:
> >
> > > Or have two instances of the same application with some configuration
> > > parameter to tell it which version it should be.
> > >
> > > Norman Franke
> > > Answering Service for Directors, Inc.
> > > www.myasd.com <http://www.myasd.com/>
> > >
> > >
> > >
> > > > On Jul 30, 2015, at 4:12 PM, Thiago H de Paula Figueiredo <
> > > thiagohp@gmail.com> wrote:
> > > >
> > > > On Thu, 30 Jul 2015 16:19:50 -0300, Dimitris Zenios <
> > > dimitris.zenios@gmail.com> wrote:
> > > >
> > > >> I would definitely split it into two web applications with a common
> > > >> tapestry module.Any other way will result to a mess.
> > > >
> > > > Agreed, as that's basically two distinct web applications which just
> > > happen to be in the same server, even if they have shared code.
> > > >
> > > > If it was the same web application but with different domains and
> data,
> > > you can use URL rewriting to make them work out of the same webapp
> > > instance. My (incomplete, but working) Eloquentia blogging engine does
> > > that: https://github.com/thiagohp/eloquentia. It can serve two or more
> > > different blogs, each from its own different domain, in the same webapp
> > > instance. It can also have subdomains for tags (domain.com for general
> > > stuff and tapestry.domain.com for tapestry-specific posts, for
> example).
> > > >
> > > > --
> > > > Thiago H. de Paula Figueiredo
> > > > Tapestry, Java and Hibernate consultant and developer
> > > > http://machina.com.br
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > > For additional commands, e-mail: users-help@tapestry.apache.org
> > > >
> > >
> > >
> >
>

Re: Multiple domains, one webapp

Posted by Bob Harner <bo...@gmail.com>.
Stephen,

An contrary viewpoint...

There is really nothing wrong with having two web front ends for a single
web app if you handle authentication in a clean and reliable way. Sure, the
conventional wisdom is to split the app into 3 parts (clients, partners,
and a common JAR containing classes that both share) as Dimitri and Thiago
recommend. However, doing so does add significant infrastructure complexity:

1) You have to maintain three projects (or a Maven multi-module project if
you're using Maven) instead of one.
2) You'll have two different app servers to configure & maintain.
3) You'll probably need to maintain database credentials in two different
places.
4) You can't use Tapestry's Live Class Reloading on any class in the common
JAR (e.g. Tapestry IOC service implementation classes).
5) If you use an automated build server like Jenkins then you'll have to
set up and maintain triple the number of jobs.
6) Your build process will be slower and more error prone because you'll
often have to build the common JAR before building and deploying you'll
have different log files.

On Thu, Jul 30, 2015 at 5:05 PM, Stephen Nutbrown <st...@gmail.com>
wrote:

> Thanks for the advice. I'll go with this. I will look into how to create a
> module which I can use in both webapps, and I will need to find a reliable
> way to connect both of the webapps to the same (amazon RDS) database
> without running out of connections etc (I believe this will just mean
> working with the hibernate config).
>
> In the long run, I do think this is the best approach, although as we
> currently have ~70 pages and around 10 services, i'm sure you can imagine
> why I was a little hesitant to start chopping things out of it, but I
> suppose this number of pages and services is all the more reason to split
> it into two webapps.
>
> One benefit of having a single webapp is hosting prices, as it's with
> Amazon on an EC2 instance - it means we will now have two EC2 instances
> unless I can figure out a way to get them both on one - I am sure this is
> possible but perhaps not particularly easy.
>
> Thanks again for all the help - I know what I have to do, it's just going
> to be quite an effort (no fault of T5 - it's a huge change to the direction
> of the project).
>
>
>
> On 30 July 2015 at 21:45, Norman Franke <no...@myasd.com> wrote:
>
> > Or have two instances of the same application with some configuration
> > parameter to tell it which version it should be.
> >
> > Norman Franke
> > Answering Service for Directors, Inc.
> > www.myasd.com <http://www.myasd.com/>
> >
> >
> >
> > > On Jul 30, 2015, at 4:12 PM, Thiago H de Paula Figueiredo <
> > thiagohp@gmail.com> wrote:
> > >
> > > On Thu, 30 Jul 2015 16:19:50 -0300, Dimitris Zenios <
> > dimitris.zenios@gmail.com> wrote:
> > >
> > >> I would definitely split it into two web applications with a common
> > >> tapestry module.Any other way will result to a mess.
> > >
> > > Agreed, as that's basically two distinct web applications which just
> > happen to be in the same server, even if they have shared code.
> > >
> > > If it was the same web application but with different domains and data,
> > you can use URL rewriting to make them work out of the same webapp
> > instance. My (incomplete, but working) Eloquentia blogging engine does
> > that: https://github.com/thiagohp/eloquentia. It can serve two or more
> > different blogs, each from its own different domain, in the same webapp
> > instance. It can also have subdomains for tags (domain.com for general
> > stuff and tapestry.domain.com for tapestry-specific posts, for example).
> > >
> > > --
> > > Thiago H. de Paula Figueiredo
> > > Tapestry, Java and Hibernate consultant and developer
> > > http://machina.com.br
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: users-help@tapestry.apache.org
> > >
> >
> >
>

Re: Multiple domains, one webapp

Posted by Stephen Nutbrown <st...@gmail.com>.
Thanks for the advice. I'll go with this. I will look into how to create a
module which I can use in both webapps, and I will need to find a reliable
way to connect both of the webapps to the same (amazon RDS) database
without running out of connections etc (I believe this will just mean
working with the hibernate config).

In the long run, I do think this is the best approach, although as we
currently have ~70 pages and around 10 services, i'm sure you can imagine
why I was a little hesitant to start chopping things out of it, but I
suppose this number of pages and services is all the more reason to split
it into two webapps.

One benefit of having a single webapp is hosting prices, as it's with
Amazon on an EC2 instance - it means we will now have two EC2 instances
unless I can figure out a way to get them both on one - I am sure this is
possible but perhaps not particularly easy.

Thanks again for all the help - I know what I have to do, it's just going
to be quite an effort (no fault of T5 - it's a huge change to the direction
of the project).



On 30 July 2015 at 21:45, Norman Franke <no...@myasd.com> wrote:

> Or have two instances of the same application with some configuration
> parameter to tell it which version it should be.
>
> Norman Franke
> Answering Service for Directors, Inc.
> www.myasd.com <http://www.myasd.com/>
>
>
>
> > On Jul 30, 2015, at 4:12 PM, Thiago H de Paula Figueiredo <
> thiagohp@gmail.com> wrote:
> >
> > On Thu, 30 Jul 2015 16:19:50 -0300, Dimitris Zenios <
> dimitris.zenios@gmail.com> wrote:
> >
> >> I would definitely split it into two web applications with a common
> >> tapestry module.Any other way will result to a mess.
> >
> > Agreed, as that's basically two distinct web applications which just
> happen to be in the same server, even if they have shared code.
> >
> > If it was the same web application but with different domains and data,
> you can use URL rewriting to make them work out of the same webapp
> instance. My (incomplete, but working) Eloquentia blogging engine does
> that: https://github.com/thiagohp/eloquentia. It can serve two or more
> different blogs, each from its own different domain, in the same webapp
> instance. It can also have subdomains for tags (domain.com for general
> stuff and tapestry.domain.com for tapestry-specific posts, for example).
> >
> > --
> > Thiago H. de Paula Figueiredo
> > Tapestry, Java and Hibernate consultant and developer
> > http://machina.com.br
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
>
>

Re: Multiple domains, one webapp

Posted by Norman Franke <no...@myasd.com>.
Or have two instances of the same application with some configuration parameter to tell it which version it should be.

Norman Franke
Answering Service for Directors, Inc.
www.myasd.com <http://www.myasd.com/>



> On Jul 30, 2015, at 4:12 PM, Thiago H de Paula Figueiredo <th...@gmail.com> wrote:
> 
> On Thu, 30 Jul 2015 16:19:50 -0300, Dimitris Zenios <di...@gmail.com> wrote:
> 
>> I would definitely split it into two web applications with a common
>> tapestry module.Any other way will result to a mess.
> 
> Agreed, as that's basically two distinct web applications which just happen to be in the same server, even if they have shared code.
> 
> If it was the same web application but with different domains and data, you can use URL rewriting to make them work out of the same webapp instance. My (incomplete, but working) Eloquentia blogging engine does that: https://github.com/thiagohp/eloquentia. It can serve two or more different blogs, each from its own different domain, in the same webapp instance. It can also have subdomains for tags (domain.com for general stuff and tapestry.domain.com for tapestry-specific posts, for example).
> 
> -- 
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 


Re: Multiple domains, one webapp

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Thu, 30 Jul 2015 16:19:50 -0300, Dimitris Zenios  
<di...@gmail.com> wrote:

> I would definitely split it into two web applications with a common
> tapestry module.Any other way will result to a mess.

Agreed, as that's basically two distinct web applications which just  
happen to be in the same server, even if they have shared code.

If it was the same web application but with different domains and data,  
you can use URL rewriting to make them work out of the same webapp  
instance. My (incomplete, but working) Eloquentia blogging engine does  
that: https://github.com/thiagohp/eloquentia. It can serve two or more  
different blogs, each from its own different domain, in the same webapp  
instance. It can also have subdomains for tags (domain.com for general  
stuff and tapestry.domain.com for tapestry-specific posts, for example).

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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


Re: Multiple domains, one webapp

Posted by Dimitris Zenios <di...@gmail.com>.
I would definitely split it into two web applications with a common
tapestry module.Any other way will result to a mess.

On Thu, Jul 30, 2015 at 10:12 PM, Stephen Nutbrown <st...@gmail.com>
wrote:

> Hi,
>
> To cut a long story short, I have a website running using tapestry which
> has two main areas, we will call them "Client accounts" and "Partner
> accounts". The powers that be have now decided the best way forwards is to
> split this into two separate domains, let's call them www.clients.com and
> www.partners.com.
>
> All of the logic and services are set up at the moment and hibernate is
> used which accesses one database. Splitting them up is going to be tricky,
> as both of the sites need access to the same, up to date database. Ideally
> I can serve both these pages from the same webapp, and just say for example
> put pages for clients.com in the "pages.clients" package and put pages for
> partner.com in the "partner.clients" package, that way they can both make
> use of the database, it'll be up to date, and we have to maintain only one
> webapp and we don't need to duplicate lots of things or split everything up
> in the backend.
>
> Has anyone done something similar, and if so, is there a sensible structure
> you would recommend?
>
> I am thinking the most tricky page is the index, so I would have this page
> redirect to /clients or /partner by returning the correct page from
> onActivate. This would however mean that the page would be
> partners.com/partner and clients.com/client but this is OK.
>
> Then, perhaps each page in the clients package can inherit from some base
> class which pretty much checks the request to make sure it's on
> clients.com
> and not partners.com (if it is, it can redirect). The same for the
> partners.com site.
>
> All in all, I can see this becoming rather messy so i'm looking for any
> advice within Tapestry how may be best to do this.
>
> Any help is really appreciated,
>
> Thanks,
>