You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Andreas Bohnert <ab...@weberhofer.at> on 2010/10/25 21:32:46 UTC

Using T5 and T3 side by side

Hi!

We have started to port a fairly big tapestry3 application to tapestry5. 
It works very well, however it will take a while to complete the whole code.
Are there any known issues/pitfalls if we run tapestry 3 and 5 code side 
by side?

We don't want to login twice, so what is the recommended way to share 
the session?

Thanks for your help,
Andreas

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


Re: Using T5 and T3 side by side

Posted by Andreas Bohnert <ab...@weberhofer.at>.
Thanks for getting into details, Robert! That helps a lot!

Andreas


Robert Zeigler wrote:
> I also had a reasonably large T3 application that I considered porting to T5.  I wound up adding some new functionality via T5 and running them side-by-side without issues.  Since T5 is a servlet filter and T3 is a servlet, they actually play(ed) quite nicely together. But. That was with an early 5.0 release (5.0.13-SNAPSHOT).  Later versions of T5 got a bit "greedier" about url matching, to where any url that looks like /app/* (assuming defaults here) will match the index page, if nothing else, unless you explicitly add paths to be excluding by T5 processing.  You might be able to play around with using different paths for the T5 vs. T3 code, or else you'll need to contribute the urls that map to your T3 app to T5's list of urls to ignore/pass through.
>
> For login, I'm not sure what the "recommended" way is, but what I did was to create a service that mapped from the T3 session-stored values values of interest in T5, where values of interest were things like the current user, whether the user was authenticated, and so forth.  Basically, it gave me easy access to my T3 "visit" and "global" objects (as well as the custom Engine that the T3 app used).  For me, that worked well.  The trick was mapping the session value as required.  So that turned out to be pretty straightforward. T3's ApplicationServlet.java stores the engine in the session under the following key:
>
> org.apache.tapestry.engine:<servletname>
>
> And you can, of course, get your visit from the engine.
>
>
> And the global is at:
>
> org.apache.tapestry.global:<servletname>
>
> in the ServletContext.
>
> So you can inject the context and the session into your "Bridge" service and then grab the objects from there.
> You'll have to duplicate a bit of logic from T3 in that your Bridge service needs to check for the existence of the objects, create as required, and stash the objects back into the session/servlet context if necessary.
>
> Good luck!
>
> Robert
>
>
>
> On Oct 25, 2010, at 10/252:32 PM , Andreas Bohnert wrote:
>
>> Hi!
>>
>> We have started to port a fairly big tapestry3 application to tapestry5. It works very well, however it will take a while to complete the whole code.
>> Are there any known issues/pitfalls if we run tapestry 3 and 5 code side by side?
>>
>> We don't want to login twice, so what is the recommended way to share the session?
>>
>> Thanks for your help,
>> Andreas
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>


Re: Using T5 and T3 side by side

Posted by Robert Zeigler <ro...@scazdl.org>.
I also had a reasonably large T3 application that I considered porting to T5.  I wound up adding some new functionality via T5 and running them side-by-side without issues.  Since T5 is a servlet filter and T3 is a servlet, they actually play(ed) quite nicely together. But. That was with an early 5.0 release (5.0.13-SNAPSHOT).  Later versions of T5 got a bit "greedier" about url matching, to where any url that looks like /app/* (assuming defaults here) will match the index page, if nothing else, unless you explicitly add paths to be excluding by T5 processing.  You might be able to play around with using different paths for the T5 vs. T3 code, or else you'll need to contribute the urls that map to your T3 app to T5's list of urls to ignore/pass through.  

For login, I'm not sure what the "recommended" way is, but what I did was to create a service that mapped from the T3 session-stored values values of interest in T5, where values of interest were things like the current user, whether the user was authenticated, and so forth.  Basically, it gave me easy access to my T3 "visit" and "global" objects (as well as the custom Engine that the T3 app used).  For me, that worked well.  The trick was mapping the session value as required.  So that turned out to be pretty straightforward. T3's ApplicationServlet.java stores the engine in the session under the following key:

org.apache.tapestry.engine:<servletname>

And you can, of course, get your visit from the engine.


And the global is at:

org.apache.tapestry.global:<servletname>

in the ServletContext.

So you can inject the context and the session into your "Bridge" service and then grab the objects from there.
You'll have to duplicate a bit of logic from T3 in that your Bridge service needs to check for the existence of the objects, create as required, and stash the objects back into the session/servlet context if necessary.

Good luck!

Robert



On Oct 25, 2010, at 10/252:32 PM , Andreas Bohnert wrote:

> Hi!
> 
> We have started to port a fairly big tapestry3 application to tapestry5. It works very well, however it will take a while to complete the whole code.
> Are there any known issues/pitfalls if we run tapestry 3 and 5 code side by side?
> 
> We don't want to login twice, so what is the recommended way to share the session?
> 
> Thanks for your help,
> Andreas
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org


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