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
>
>

Reply via email to