The tapestry creator will look something like...

public class TapestryCreator extends AbstractCreator {
    private String beanName;

    public String getBeanName() {
        return beanName;
    }

    // set by config in dwr.xml (see my prev email)
    public void setBeanName(String beanName) {
        this.beanName = beanName;
    }

   public Object getInstance() {
      // Use this instead of WebContextFactory (suggested in my prev email)
      ServletContext servletContext =
org.directwebremoting.ServerContextFactory.get().getServletContext();
      Object bean = getTapestryBean(servletContext, getbeanName);
   }

   protected Object getTapestryBean(ServletContext servletContext, String
beanName) {
      // look up the bean from the tapestry registry
   }

   public Class getType() {
      return getInstance().getClass();
   }
}

You will then use a dwr config similar to my previous email to define the
TapestryCreator and map it to a named service in the tapestry registry. As I
said, please download the DWR source and take a look at the SpringCreator
for inspiration.

2009/12/22 Ashwanth Kumar <ashwanth.ku...@gmail.com>

> Can u provide an example! I dont find any good example on the site!
>
>  - Ashwanth Kumar
>
> On Tue, Dec 22, 2009 at 5:10 PM, Lance Java <lance.j...@googlemail.com
> >wrote:
>
> > Ah... great.
> >
> > The TapestryCreator can access the servlet context using:
> > org.directwebremoting.WebContextFactory.get().getServletContext();
> >
> > http://directwebremoting.org/dwr/server/javaapi.html
> >
> > 2009/12/22 Thiago H. de Paula Figueiredo <thiag...@gmail.com>
> >
> > > Em Tue, 22 Dec 2009 09:27:26 -0200, Lance Java <
> > lance.j...@googlemail.com>
> > > escreveu:
> > >
> > >
> > > One more thing to note is that DWR supports ajax filters which are
> > >> basically interceptors on DWR services. You may want to duplicate some
> > of
> > >> the
> > >> TapestryFilter's functionality in an AjaxFilter.
> > >>
> > >
> > > There's no need to do that. TapestryFilter puts the Registry in the
> > servlet
> > > context under the org.apache.tapestry5.application-registry attribute.
> > Then
> > > you can get the HibernateSessionManager and get a Session through its
> > > getSession() method. I haven't tested it, but that's what I would try.
> > >
> > > --
> > > Thiago H. de Paula Figueiredo
> > > Independent Java, Apache Tapestry 5 and Hibernate consultant,
> developer,
> > > and instructor
> > > Owner, software architect and developer, Ars Machina Tecnologia da
> > > Informação Ltda.
> > > http://www.arsmachina.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