You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ashwanth Kumar <as...@gmail.com> on 2009/12/21 18:35:09 UTC

Help with using DWR with Tapestry

Hello,

In my project, i would like to use DWR along with Tapestry! But i've a
probelm. Its like i need to access the DB, i use Hibernate with Tapestry. In
my class i've:

@Inject
private Session _session;

when i access this class from DWR, Tapestry doesn't interfere at all. But,
i'm getting a null pointer exception where i first start using the Session.
How and what should be done for this?

 - Ashwanth Kumar

Re: Help with using DWR with Tapestry

Posted by "Vangel V. Ajanovski" <aj...@ii.edu.mk>.
On 30.12.2009 17:27, Ashwanth Kumar wrote:
> No offense, just wanted to learn some things.. at a rapid pace.. thats it..
> :)
>   
No offense taken, I was just curious because I had never heard about DWR
and was just curious where it fits.


Re: Help with using DWR with Tapestry

Posted by Ashwanth Kumar <as...@gmail.com>.
Hello Guys,

Okay, i give up! I'm very new here! And i'm just a 2nd year college student!
I'm learning java only now! And more-over when i hunter the WWW for some
good framework to build my WebApp in J2EE. I had to keep my hands on many
things. Its during that, i actually got in Tapestry and DWR. Though i
stumbled on DWR first, i finally rested with Tapestry, as it actually made
my life simpler!

And using DWR (soley for 1 reason), i wanted to do, some live username
availability checking, (may be u can do it with a custom Component
from Scriptaculous, as i told u, i'm very very new here in java and
Tapestry, to DWR too).

I'm too young in experience to say advantages of DWR over Tapestry or the
vice versa. It just makes begineers like me, open my JAW fall.. ;)  Nothing
more..

No offense, just wanted to learn some things.. at a rapid pace.. thats it..
:)

 - Ashwanth Kumar

On Wed, Dec 30, 2009 at 9:48 PM, Thiago H. de Paula Figueiredo <
thiagohp@gmail.com> wrote:

> Em Wed, 30 Dec 2009 14:14:12 -0200, Vangel V. Ajanovski <aj...@ii.edu.mk>
> escreveu:
>
>
>  OK let me see if I get the point. If I build user registration for me
>> it's a simple form, username and email and such and for example I bind
>> javascript code on the username that will check if it already exists,
>> before I even fill the entire registration form and certainly before I
>> submit it.
>>
>
> I implemented this using Tapestry itself and JavaScript. Just a few lines
> of code. I'm curious too why Ashwanth is using DWR instead of Tapestry
> itself for AJAX things stuff.
>
>
> --
> 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-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Help with using DWR with Tapestry

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Wed, 30 Dec 2009 14:14:12 -0200, Vangel V. Ajanovski <aj...@ii.edu.mk>  
escreveu:

> OK let me see if I get the point. If I build user registration for me
> it's a simple form, username and email and such and for example I bind
> javascript code on the username that will check if it already exists,
> before I even fill the entire registration form and certainly before I
> submit it.

I implemented this using Tapestry itself and JavaScript. Just a few lines  
of code. I'm curious too why Ashwanth is using DWR instead of Tapestry  
itself for AJAX things stuff.

-- 
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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Help with using DWR with Tapestry

Posted by "Vangel V. Ajanovski" <aj...@ii.edu.mk>.
On 30.12.2009 11:06, Ashwanth Kumar wrote:
> Well, My use here is a typical example of User Registration and User
> authentication! I'm trying to extend the entire app of Tapestry to be AJAX
> driven, with all the pages served through AJAX.
>
> Imagine u can use sought of AJAX capabilities with DWR and Tapestry!
>   
OK let me see if I get the point. If I build user registration for me
it's a simple form, username and email and such and for example I bind
javascript code on the username that will check if it already exists,
before I even fill the entire registration form and certainly before I
submit it. But if i did this, I wouldn't have calls to tapestry stuff at
all, i would directly call the dao methods.

I am probably missing something, that's why I asked for some specific
scenario .... maybe something that can't be done (or wouldn't look good)
with just tapestry and what it offers from ajax components.
I expected an answer of the type: "if you want to have ________________
on your tapestry generated page, then you can do that more user-friendly
or more secure or generally better with DWR and Tapestry interaction".

I am just curious and want to learn something new about this.
Thanks


Re: Help with using DWR with Tapestry

Posted by Ashwanth Kumar <as...@gmail.com>.
Well, My use here is a typical example of User Registration and User
authentication! I'm trying to extend the entire app of Tapestry to be AJAX
driven, with all the pages served through AJAX.

Imagine u can use sought of AJAX capabilities with DWR and Tapestry!

 - Ashwanth Kumar

On Tue, Dec 29, 2009 at 10:34 PM, Vangel V. Ajanovski <aj...@ii.edu.mk>wrote:

> I am a bit curious and never had such a scenario, so can you or anyone
> else elaborate a bit more or give an example of a use-case where this
> interaction between DWR and tapestry-hibernate is useful?
> Thanks
>
> On 29.12.2009 17:24, Ashwanth Kumar wrote:
> > Hey, Thanks a lot!!
> >
> > I got the Tapestry Hibernate Working with DWR!! U made my life easy!!
> >
> >
>
>
>

Re: Help with using DWR with Tapestry

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Tue, 29 Dec 2009 15:04:23 -0200, Vangel V. Ajanovski <aj...@ii.edu.mk>  
escreveu:

> I am a bit curious and never had such a scenario, so can you or anyone
> else elaborate a bit more or give an example of a use-case where this
> interaction between DWR and tapestry-hibernate is useful?

When your DWR code needs to do a database search? (I've never used DWR, so  
I cannot think of other uses).

-- 
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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Help with using DWR with Tapestry

Posted by "Vangel V. Ajanovski" <aj...@ii.edu.mk>.
I am a bit curious and never had such a scenario, so can you or anyone
else elaborate a bit more or give an example of a use-case where this
interaction between DWR and tapestry-hibernate is useful?
Thanks

On 29.12.2009 17:24, Ashwanth Kumar wrote:
> Hey, Thanks a lot!!
>
> I got the Tapestry Hibernate Working with DWR!! U made my life easy!!
>
>   



Re: Help with using DWR with Tapestry

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Tue, 29 Dec 2009 14:24:16 -0200, Ashwanth Kumar  
<as...@gmail.com> escreveu:

> Hey, Thanks a lot!!

You're welcome!

> I got the Tapestry Hibernate Working with DWR!! U made my life easy!!

Tapestry and Tapestry-IoC made it. I just showed you the way. :)

-- 
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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Help with using DWR with Tapestry

Posted by Ashwanth Kumar <as...@gmail.com>.
Hey, Thanks a lot!!

I got the Tapestry Hibernate Working with DWR!! U made my life easy!!

 - Ashwanth Kumar

On Tue, Dec 29, 2009 at 9:52 PM, Thiago H. de Paula Figueiredo <
thiagohp@gmail.com> wrote:

> Em Tue, 29 Dec 2009 13:48:40 -0200, Ashwanth Kumar <
> ashwanth.kumar@gmail.com> escreveu:
>
>  Hello,
>>
>
> Hi!
>
>
>  But, sorry how am i to get HibernateSessionManager?? from the attribute,
>> can u tell me that plz.. I'm breaking my head here.. for almost a week.
>>
>
> Get the registry from that servlet context attribute. It's an Registry
> instance. Use Registry.getService(HibernateSessionManager.class) to get a
> HibernateSessionManager instance.
>
>
> --
> 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-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Help with using DWR with Tapestry

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Tue, 29 Dec 2009 13:48:40 -0200, Ashwanth Kumar  
<as...@gmail.com> escreveu:

> Hello,

Hi!

> But, sorry how am i to get HibernateSessionManager?? from the attribute,  
> can u tell me that plz.. I'm breaking my head here.. for almost a week.

Get the registry from that servlet context attribute. It's an Registry  
instance. Use Registry.getService(HibernateSessionManager.class) to get a  
HibernateSessionManager instance.

-- 
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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Help with using DWR with Tapestry

Posted by Ashwanth Kumar <as...@gmail.com>.
Hello,

On Tue, Dec 22, 2009 at 5:05 PM, Thiago H. de Paula Figueiredo <
thiagohp@gmail.com> wrote:

> Em Tue, 22 Dec 2009 09:27:26 -0200, Lance Java <la...@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.
>

But, sorry how am i to get HibernateSessionManager?? from the attribute, can
u tell me that plz.. I'm breaking my head here.. for almost a week.


>
> --
> 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-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
 - Ashwanth Kumar

Re: Help with using DWR with Tapestry

Posted by Lance Java <la...@googlemail.com>.
No probs. To verify that the TapestryFilter is doing it's job, try to
@Inject RequestGlobals into your bean.

Cheers,
Lance.

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

> Sure,
>
> Thanks a lot! I'll post my code, once i get it working!
>
>  - Ashwanth Kumar
>
> On Tue, Dec 22, 2009 at 5:32 PM, Lance Java <lance.java@googlemail.com
> >wrote:
>
> > 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 <as...@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.java@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 <th...@gmail.com>
> > > >
> > > > > Em Tue, 22 Dec 2009 09:27:26 -0200, Lance Java <
> > > > lance.java@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-unsubscribe@tapestry.apache.org
> > > > > For additional commands, e-mail: users-help@tapestry.apache.org
> > > > >
> > > > >
> > > >
> > >
> >
>

Re: Help with using DWR with Tapestry

Posted by Ashwanth Kumar <as...@gmail.com>.
Sure,

Thanks a lot! I'll post my code, once i get it working!

 - Ashwanth Kumar

On Tue, Dec 22, 2009 at 5:32 PM, Lance Java <la...@googlemail.com>wrote:

> 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 <as...@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.java@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 <th...@gmail.com>
> > >
> > > > Em Tue, 22 Dec 2009 09:27:26 -0200, Lance Java <
> > > lance.java@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-unsubscribe@tapestry.apache.org
> > > > For additional commands, e-mail: users-help@tapestry.apache.org
> > > >
> > > >
> > >
> >
>

Re: Help with using DWR with Tapestry

Posted by Lance Java <la...@googlemail.com>.
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 <as...@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.java@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 <th...@gmail.com>
> >
> > > Em Tue, 22 Dec 2009 09:27:26 -0200, Lance Java <
> > lance.java@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-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: users-help@tapestry.apache.org
> > >
> > >
> >
>

Re: Help with using DWR with Tapestry

Posted by Ashwanth Kumar <as...@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 <la...@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 <th...@gmail.com>
>
> > Em Tue, 22 Dec 2009 09:27:26 -0200, Lance Java <
> lance.java@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-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>

Re: Help with using DWR with Tapestry

Posted by Lance Java <la...@googlemail.com>.
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 <th...@gmail.com>

> Em Tue, 22 Dec 2009 09:27:26 -0200, Lance Java <la...@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-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Help with using DWR with Tapestry

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Tue, 22 Dec 2009 09:27:26 -0200, Lance Java <la...@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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Help with using DWR with Tapestry

Posted by Lance Java <la...@googlemail.com>.
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.

http://directwebremoting.org/dwr/server/dwrxml/filters.html
2009/12/22 Lance Java <la...@googlemail.com>

> For a bit more info your dwr.xml might look like this:
>
> <dwr>
>   <init>
>     <creator id="tapestry" class="foo.bar.TapestryCreator"/>
>   </init>
>   <allow>
>     <create creator="tapestry" javascript="SomeService">
>       <param name="beanName" value="someService"/>
>     </create>
>   </allow>
> </dwr>
>
> Perhaps some of the tapestry gurus can help out a bit more here. For
> normal DWR usage in tapestry, you disable the tapestry filter for /dwr/*. It
> seems that you might want a bit of the tapestry filter's functionality but
> not all. For example injecting the request / response / session and creating
> a hibernate session.
>
> If you come up with a working solution, please post it back to the DWR
> user's list and we'll include it in the project.
>
> Cheers,
> Lance.
>
> 2009/12/22 Lance Java <la...@googlemail.com>
>
>  You might like to take this discussion onto the dwr user's list. I think
>> it might involve writing a TapestryCreator which is able to look up services
>> from the tapestry registry. Please download the dwr source and have a look
>> at the SpringCreator for inspiration.
>>
>> Cheers,
>> Lance.
>>
>> 2009/12/21 Ashwanth Kumar <as...@gmail.com>
>>
>> Hello,
>>>
>>> In my project, i would like to use DWR along with Tapestry! But i've a
>>> probelm. Its like i need to access the DB, i use Hibernate with Tapestry.
>>> In
>>> my class i've:
>>>
>>> @Inject
>>> private Session _session;
>>>
>>> when i access this class from DWR, Tapestry doesn't interfere at all.
>>> But,
>>> i'm getting a null pointer exception where i first start using the
>>> Session.
>>> How and what should be done for this?
>>>
>>>  - Ashwanth Kumar
>>>
>>
>>
>

Re: Help with using DWR with Tapestry

Posted by Lance Java <la...@googlemail.com>.
For a bit more info your dwr.xml might look like this:

<dwr>
  <init>
    <creator id="tapestry" class="foo.bar.TapestryCreator"/>
  </init>
  <allow>
    <create creator="tapestry" javascript="SomeService">
      <param name="beanName" value="someService"/>
    </create>
  </allow>
</dwr>

Perhaps some of the tapestry gurus can help out a bit more here. For
normal DWR usage in tapestry, you disable the tapestry filter for /dwr/*. It
seems that you might want a bit of the tapestry filter's functionality but
not all. For example injecting the request / response / session and creating
a hibernate session.

If you come up with a working solution, please post it back to the DWR
user's list and we'll include it in the project.

Cheers,
Lance.

2009/12/22 Lance Java <la...@googlemail.com>

> You might like to take this discussion onto the dwr user's list. I think it
> might involve writing a TapestryCreator which is able to look up services
> from the tapestry registry. Please download the dwr source and have a look
> at the SpringCreator for inspiration.
>
> Cheers,
> Lance.
>
> 2009/12/21 Ashwanth Kumar <as...@gmail.com>
>
> Hello,
>>
>> In my project, i would like to use DWR along with Tapestry! But i've a
>> probelm. Its like i need to access the DB, i use Hibernate with Tapestry.
>> In
>> my class i've:
>>
>> @Inject
>> private Session _session;
>>
>> when i access this class from DWR, Tapestry doesn't interfere at all. But,
>> i'm getting a null pointer exception where i first start using the
>> Session.
>> How and what should be done for this?
>>
>>  - Ashwanth Kumar
>>
>
>

Re: Help with using DWR with Tapestry

Posted by Lance Java <la...@googlemail.com>.
You might like to take this discussion onto the dwr user's list. I think it
might involve writing a TapestryCreator which is able to look up services
from the tapestry registry. Please download the dwr source and have a look
at the SpringCreator for inspiration.

Cheers,
Lance.

2009/12/21 Ashwanth Kumar <as...@gmail.com>

> Hello,
>
> In my project, i would like to use DWR along with Tapestry! But i've a
> probelm. Its like i need to access the DB, i use Hibernate with Tapestry.
> In
> my class i've:
>
> @Inject
> private Session _session;
>
> when i access this class from DWR, Tapestry doesn't interfere at all. But,
> i'm getting a null pointer exception where i first start using the Session.
> How and what should be done for this?
>
>  - Ashwanth Kumar
>

Re: Help with using DWR with Tapestry

Posted by Ashwanth Kumar <as...@gmail.com>.
I've a doubt, how will the Tapestry's @SessionState work with DWR ah??

And here by Session i mean Hibernate's Session instance we use in Tapestry
for accessing it!

 - Ashwanth

On Tue, Dec 22, 2009 at 1:14 PM, Peter Stavrinides <
P.Stavrinides@albourne.com> wrote:

> What is Session? surely you should be using an SSO, and not a singleton
> service? i.e.:
>
> @SessionState
> private Session _session;
>
> --
> If you are not an intended recipient of this e-mail, please notify the
> sender, delete it and do not read, act upon, print, disclose, copy, retain
> or redistribute it. Please visit http://www.albourne.com/email.html for
> important additional terms relating to this e-mail.
>
> ----- Original Message -----
> From: "Ashwanth Kumar" <as...@gmail.com>
> To: "Tapestry users" <us...@tapestry.apache.org>
> Sent: Monday, 21 December, 2009 19:35:09 GMT +02:00 Athens, Beirut,
> Bucharest, Istanbul
> Subject: Help with using DWR with Tapestry
>
> Hello,
>
> In my project, i would like to use DWR along with Tapestry! But i've a
> probelm. Its like i need to access the DB, i use Hibernate with Tapestry.
> In
> my class i've:
>
> @Inject
> private Session _session;
>
> when i access this class from DWR, Tapestry doesn't interfere at all. But,
> i'm getting a null pointer exception where i first start using the Session.
> How and what should be done for this?
>
>  - Ashwanth Kumar
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Help with using DWR with Tapestry

Posted by Peter Stavrinides <P....@albourne.com>.
What is Session? surely you should be using an SSO, and not a singleton service? i.e.: 

@SessionState
private Session _session;

-- 
If you are not an intended recipient of this e-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute it. Please visit http://www.albourne.com/email.html for important additional terms relating to this e-mail.

----- Original Message -----
From: "Ashwanth Kumar" <as...@gmail.com>
To: "Tapestry users" <us...@tapestry.apache.org>
Sent: Monday, 21 December, 2009 19:35:09 GMT +02:00 Athens, Beirut, Bucharest, Istanbul
Subject: Help with using DWR with Tapestry

Hello,

In my project, i would like to use DWR along with Tapestry! But i've a
probelm. Its like i need to access the DB, i use Hibernate with Tapestry. In
my class i've:

@Inject
private Session _session;

when i access this class from DWR, Tapestry doesn't interfere at all. But,
i'm getting a null pointer exception where i first start using the Session.
How and what should be done for this?

 - Ashwanth Kumar

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