Thanks Barry!

One more thing, what changes do I need to make in the Web.Xml so that both T4 
and T5 pages continue working.
Apparently my application has started working once I put in the filters for T5

Regards
Mukesh

-----Original Message-----
From: Barry Books [mailto:trs...@gmail.com]
Sent: Tuesday, June 28, 2016 5:34 PM
To: Tapestry users
Subject: Re: Tapestry 4.1 Migration to Tapestry 5

I dug up this code that allows T5 applications to access T4 sessions. I think 
the XXX is the app name in the T4 configuration.

@Deprecated

public class T4SessionStrategy extends
SessionApplicationStatePersistenceStrategy   implements
ApplicationStatePersistenceStrategy  {

               private final String prefix = "state:XXX";

               private final Request request;

               private final Logger logger;



               public T4SessionStrategy(Request request, Logger logger) {

                              super(request);

                              this.request = request;

                              this.logger = logger;

               }



               @Override

               public <T> boolean exists(Class<T> clazz) {

                              Session s = request.getSession(false);

                              if (s == null || clazz == null)

                                             return false;

                              return   s.getAttribute(prefix +
clazz.getSimpleName()) != null;

               }



               @Override

               public <T> T get(Class<T> clazz, ApplicationStateCreator<T>
creator) {

                              Session s = request.getSession(true);



                              logger.info("find session {}{} ", prefix, 
clazz.getSimpleName());

                              @SuppressWarnings("unchecked")

                              T state = (T) s.getAttribute(prefix + 
clazz.getSimpleName());

                              if ( state == null ) {

                                             state = creator.create();

                                             set(clazz,state);

                              }

                              return state;

               }



               @Override

               public <T> void set(Class<T> clazz, T object) {

                              Session s = request.getSession(true);

                              s.setAttribute(prefix + clazz.getSimpleName(), 
object);

               }



}

On Monday, June 27, 2016, Thiago H de Paula Figueiredo <thiag...@gmail.com>
wrote:

> On Mon, 27 Jun 2016 10:33:06 -0300, Mukesh Chandra <
> mukesh.chan...@opensolutions.com> wrote:
>
> Hi Barry
>>
>> Which service are you talking about? How do I create one. Is there
>> some class I need to inherit?
>>
>
> No.
>
> Can I have a sample implementation for same?
>>
>
> The documentation for Tapestry-IoC, the replacement for HiveMind in
> Tapestry 5, is here: http://tapestry.apache.org/ioc.html.
>
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

________________________________

NOTICE:
This e-mail is intended solely for the use of the individual to whom it is 
addressed and may contain information that is privileged, confidential or 
otherwise exempt from disclosure. If the reader of this e-mail is not the 
intended recipient or the employee or agent responsible for delivering the 
message to the intended recipient, you are hereby notified that any 
dissemination, distribution, or copying of this communication is strictly 
prohibited. If you have received this communication in error, please 
immediately notify us by replying to the original message at the listed email 
address. Thank You.

Reply via email to