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/02 02:59:48 UTC

Help with HttpRequest Handling

Hi,

I want to write a simple component, which will say the number of users
online! But, to do, that i need to access the non-threaded version of
HttpServletRequest of the Tapestry servlet, how do i do that? Please help
me!

 - Ashwanth

Tapestry and XFire

Posted by Jim O'Callaghan <jc...@yahoo.co.uk>.
I'm currently using Tapestry for some business services and the presentation
tier of an application, but also have some related Web Services exposed
using XFire - currently XFire is reusing some of the POJOs I'm using as
service providers within Tapestry, by exposing them also as Spring beans.
Is there a way to get XFire to hook up directly with Tapestry, to avoid the
doubling up of configuration details (Hibernate settings, beans) for Spring?
It feels like I'm losing some of the handier features of Tapestry (minimal
configuration) because of the XFire integration.

Many thanks,
Jim.


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


Re: Help with HttpRequest Handling

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Wed, 02 Dec 2009 10:38:59 -0200, Ashwanth Kumar  
<as...@gmail.com> escreveu:

> Thanks yar,

You're welcome!


> I tired this, and got it working! :)
>
> @Inject
> private HttpServletRequest _request;

Injecting the Request service would also work and it's the recommended  
choice.

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

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

I tired this, and got it working! :)

@Inject
private HttpServletRequest _request;

Now, i'm able to access the Session info, across all sessions! Thanks a lot,
for the help! I did get to know, better!

 - Ashwanth

On Wed, Dec 2, 2009 at 5:59 PM, Thiago H. de Paula Figueiredo <
thiagohp@gmail.com> wrote:

> Em Wed, 02 Dec 2009 09:57:50 -0200, Ashwanth Kumar <
> ashwanth.kumar@gmail.com> escreveu:
>
>
>  But Thiago,
>> I tired, but each and every time, i do so, i get just 1 each time!! Plz
>> help!
>>
>
> Every Tapestry service (including Request) is wrapped by a proxy. When the
> service is per thread, this proxy invokes the methods in the correct object
> for that thread. It is a little bit strange at first, but it works.
>
>
> --
> 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 HttpRequest Handling

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Wed, 02 Dec 2009 09:57:50 -0200, Ashwanth Kumar  
<as...@gmail.com> escreveu:

> But Thiago,
> I tired, but each and every time, i do so, i get just 1 each time!! Plz
> help!

Every Tapestry service (including Request) is wrapped by a proxy. When the  
service is per thread, this proxy invokes the methods in the correct  
object for that thread. It is a little bit strange at first, but it works.

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

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

I tired, but each and every time, i do so, i get just 1 each time!! Plz
help!

 - Ashwanth

On Wed, Dec 2, 2009 at 4:42 PM, Thiago H. de Paula Figueiredo <
thiagohp@gmail.com> wrote:

> Em Wed, 02 Dec 2009 02:38:05 -0200, Ashwanth Kumar <
> ashwanth.kumar@gmail.com> escreveu:
>
>  Thiago,
>>
>
> Hi!
>
>
>  Thanks for the reply. As u said, i did use sessions. But my problem, how
>> am i to access it? I mean, if i use RequestGlobals, i get per request
>> session.
>> And, if i use Request service also, i get the same thing! How am i access
>> it? (Actually thats wat i tired to mean by non-threaded stuff, sorry!)
>>
>
> There's no such thing as a per request session. Just @Inject Request and
> get the session. It'll work.
>
>
> --
> 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 HttpRequest Handling

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Wed, 02 Dec 2009 02:38:05 -0200, Ashwanth Kumar  
<as...@gmail.com> escreveu:

> Thiago,

Hi!

> Thanks for the reply. As u said, i did use sessions. But my problem, how  
> am i to access it? I mean, if i use RequestGlobals, i get per request  
> session.
> And, if i use Request service also, i get the same thing! How am i access
> it? (Actually thats wat i tired to mean by non-threaded stuff, sorry!)

There's no such thing as a per request session. Just @Inject Request and  
get the session. It'll work.

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

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

Thanks for the reply. As u said, i did use sessions. But my problem, how am
i to access it? I mean, if i use RequestGlobals, i get per request session.
And, if i use Request service also, i get the same thing! How am i access
it? (Actually thats wat i tired to mean by non-threaded stuff, sorry!)

 - Ashwanth

On Wed, Dec 2, 2009 at 7:55 AM, Thiago H. de Paula Figueiredo <
thiagohp@gmail.com> wrote:

> Em Tue, 01 Dec 2009 23:59:48 -0200, Ashwanth Kumar <
> ashwanth.kumar@gmail.com> escreveu:
>
>  Hi,
>>
>
> Hi!
>
>  I want to write a simple component, which will say the number of users
>> online! But, to do, that i need to access the non-threaded version of
>> HttpServletRequest of the Tapestry servlet, how do i do that? Please help
>> me!
>>
>
> Some points:
>
> 1) Tapestry is a servlet filter, not a servlet.
>
> 2) There isn't a non-threaded version of HttpServletRequest, as it is
> created for every request received.
>
> 3) As far as I know, it's not possible to count the number of concurrent
> users without using the session, as HTTP is a stateless protocol. You'll
> need to count open sessions. To do that, you'll need a service to hold the
> number of open sesions and an HttpSessionListener.
>
> I hope I gave you some pointers.
>
>
> --
> 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 HttpRequest Handling

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

> Hi,

Hi!

> I want to write a simple component, which will say the number of users
> online! But, to do, that i need to access the non-threaded version of
> HttpServletRequest of the Tapestry servlet, how do i do that? Please help
> me!

Some points:

1) Tapestry is a servlet filter, not a servlet.

2) There isn't a non-threaded version of HttpServletRequest, as it is  
created for every request received.

3) As far as I know, it's not possible to count the number of concurrent  
users without using the session, as HTTP is a stateless protocol. You'll  
need to count open sessions. To do that, you'll need a service to hold the  
number of open sesions and an HttpSessionListener.

I hope I gave you some pointers.

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