You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tiles.apache.org by Neil Aggarwal <ne...@JAMMConsulting.com> on 2007/09/03 05:52:43 UTC

Improvement: Do not create sessions in ServletTilesRequestContext

Hello:

I created this tiles improvement request:
http://issues.apache.org/struts/browse/TILES-207

Right now, ServletTilesRequestContext.getSessionScope() calls
request.getSession() when it should be using
request.getSession(false)

I hope this is the correct way to report this.

Thanks,
	Neil


--
Neil Aggarwal, (832)245-7314, www.JAMMConsulting.com
Eliminate junk email and reclaim your inbox.
Visit http://www.spammilter.com for details.


Re: Improvement: Do not create sessions in ServletTilesRequestContext

Posted by Antonio Petrelli <an...@gmail.com>.
2007/9/4, Neil Aggarwal <ne...@jammconsulting.com>:
>
> Antonio:
>
> I took a look.  It looks complete to me.



Anyway I wish to make another test this evening (CET), just to be sure. I
want to check if no session cookies are set in the test webapp, because it
does not need it. I will commit it after this test.

Thanks
Antonio

RE: Improvement: Do not create sessions in ServletTilesRequestContext

Posted by Neil Aggarwal <ne...@JAMMConsulting.com>.
Antonio:

I took a look.  It looks complete to me.

Thanks,
	Neil

--
Neil Aggarwal, (832)245-7314, www.JAMMConsulting.com
Eliminate junk email and reclaim your inbox.
Visit http://www.spammilter.com for details.

-----Original Message-----
From: Antonio Petrelli [mailto:antonio.petrelli@gmail.com] 
Sent: Tuesday, September 04, 2007 1:15 PM
To: users@tiles.apache.org
Subject: Re: Improvement: Do not create sessions in
ServletTilesRequestContext

2007/9/3, Neil Aggarwal <ne...@jammconsulting.com>:
> Antonio:
>
> I defer to your judgement since you know the code
> much better than I do.
>
> I appreciate your willingness to work on this
> issue.

Neil, can you check the code that I attached to the TILES-207 issue?
It is the "patch.diff" attachment (the bigger and more recent one).
I hope that I did not miss something.

Thanks
Antonio


RE: Improvement: Do not create sessions in ServletTilesRequestContext

Posted by Neil Aggarwal <ne...@JAMMConsulting.com>.
Antonio:

Never mind.  You call size which calls the session.

Its easy to get cross-eyed looking at this!

	Neil 

--
Neil Aggarwal, (832)245-7314, www.JAMMConsulting.com
Eliminate junk email and reclaim your inbox.
Visit http://www.spammilter.com for details.

-----Original Message-----
From: Neil Aggarwal [mailto:neil@jammconsulting.com] 
Sent: Tuesday, September 04, 2007 3:00 PM
To: users@tiles.apache.org
Subject: RE: Improvement: Do not create sessions in
ServletTilesRequestContext

Antonio:

I just realized isEmpty needs to use the session:

    /** {@inheritDoc} */
    public boolean isEmpty() {
        return (size() < 1);
    }

Thanks,
	Neil


--
Neil Aggarwal, (832)245-7314, www.JAMMConsulting.com
Eliminate junk email and reclaim your inbox.
Visit http://www.spammilter.com for details.

-----Original Message-----
From: Antonio Petrelli [mailto:antonio.petrelli@gmail.com] 
Sent: Tuesday, September 04, 2007 1:15 PM
To: users@tiles.apache.org
Subject: Re: Improvement: Do not create sessions in
ServletTilesRequestContext

2007/9/3, Neil Aggarwal <ne...@jammconsulting.com>:
> Antonio:
>
> I defer to your judgement since you know the code
> much better than I do.
>
> I appreciate your willingness to work on this
> issue.

Neil, can you check the code that I attached to the TILES-207 issue?
It is the "patch.diff" attachment (the bigger and more recent one).
I hope that I did not miss something.

Thanks
Antonio


RE: Improvement: Do not create sessions in ServletTilesRequestContext

Posted by Neil Aggarwal <ne...@JAMMConsulting.com>.
Antonio:

I just realized isEmpty needs to use the session:

    /** {@inheritDoc} */
    public boolean isEmpty() {
        return (size() < 1);
    }

Thanks,
	Neil


--
Neil Aggarwal, (832)245-7314, www.JAMMConsulting.com
Eliminate junk email and reclaim your inbox.
Visit http://www.spammilter.com for details.

-----Original Message-----
From: Antonio Petrelli [mailto:antonio.petrelli@gmail.com] 
Sent: Tuesday, September 04, 2007 1:15 PM
To: users@tiles.apache.org
Subject: Re: Improvement: Do not create sessions in
ServletTilesRequestContext

2007/9/3, Neil Aggarwal <ne...@jammconsulting.com>:
> Antonio:
>
> I defer to your judgement since you know the code
> much better than I do.
>
> I appreciate your willingness to work on this
> issue.

Neil, can you check the code that I attached to the TILES-207 issue?
It is the "patch.diff" attachment (the bigger and more recent one).
I hope that I did not miss something.

Thanks
Antonio


Re: Improvement: Do not create sessions in ServletTilesRequestContext

Posted by Antonio Petrelli <an...@gmail.com>.
2007/9/3, Neil Aggarwal <ne...@jammconsulting.com>:
> Antonio:
>
> I defer to your judgement since you know the code
> much better than I do.
>
> I appreciate your willingness to work on this
> issue.

Neil, can you check the code that I attached to the TILES-207 issue?
It is the "patch.diff" attachment (the bigger and more recent one).
I hope that I did not miss something.

Thanks
Antonio

RE: Improvement: Do not create sessions in ServletTilesRequestContext

Posted by Neil Aggarwal <ne...@JAMMConsulting.com>.
Antonio:

I defer to your judgement since you know the code
much better than I do.

I appreciate your willingness to work on this
issue.

Thank you,
	Neil 

--
Neil Aggarwal, (832)245-7314, www.JAMMConsulting.com
Eliminate junk email and reclaim your inbox.
Visit http://www.spammilter.com for details.

-----Original Message-----
From: Antonio Petrelli [mailto:antonio.petrelli@gmail.com] 
Sent: Monday, September 03, 2007 10:46 AM
To: users@tiles.apache.org
Subject: Re: Improvement: Do not create sessions in
ServletTilesRequestContext

2007/9/3, Neil Aggarwal <ne...@jammconsulting.com>:
>
> Antonio:
>
> Are you suggesting to create a ServletSessionScopeMap
> even when there is no session?
>
> HttpServletRequest.getSession(false) returns null when
> there is no session.  I think we should try to follow
> that.



It will be followed, but inside ServletSessionScopeMap.
The map will be created anyway, but it will be empty. But when someone adds
an attribute, it will be created. Returning a null Map, IMHO, prevents users
from creating their own session-scoped attributes.
If it is still not clear, I will try to create a patch and post it in the
TILES-207 issue, so we can discuss it.

Antonio


Re: Improvement: Do not create sessions in ServletTilesRequestContext

Posted by Antonio Petrelli <an...@gmail.com>.
2007/9/3, Neil Aggarwal <ne...@jammconsulting.com>:
>
> Antonio:
>
> Are you suggesting to create a ServletSessionScopeMap
> even when there is no session?
>
> HttpServletRequest.getSession(false) returns null when
> there is no session.  I think we should try to follow
> that.



It will be followed, but inside ServletSessionScopeMap.
The map will be created anyway, but it will be empty. But when someone adds
an attribute, it will be created. Returning a null Map, IMHO, prevents users
from creating their own session-scoped attributes.
If it is still not clear, I will try to create a patch and post it in the
TILES-207 issue, so we can discuss it.

Antonio

RE: Improvement: Do not create sessions in ServletTilesRequestContext

Posted by Neil Aggarwal <ne...@JAMMConsulting.com>.
Antonio:

Are you suggesting to create a ServletSessionScopeMap 
even when there is no session?

HttpServletRequest.getSession(false) returns null when
there is no session.  I think we should try to follow
that.

Thanks,
	Neil

--
Neil Aggarwal, (832)245-7314, www.JAMMConsulting.com
Eliminate junk email and reclaim your inbox.
Visit http://www.spammilter.com for details.

-----Original Message-----
From: Antonio Petrelli [mailto:antonio.petrelli@gmail.com] 
Sent: Monday, September 03, 2007 10:28 AM
To: users@tiles.apache.org
Subject: Re: Improvement: Do not create sessions in
ServletTilesRequestContext

2007/9/3, Neil Aggarwal <ne...@jammconsulting.com>:
>
> Antonio:
>
> If you look at the patch I put into the jira, it
> checks to make sure the session is not null.



Sorry I have not been clear (even with myself :-) )
I meant that, if someone tries to add an attribute in the session, the
session should be created.
So I think that the ServletSessionScopeMap class should hold a reference to
the HttpServletRequest, so it can create a session when it is necessary.

Antonio


Re: Improvement: Do not create sessions in ServletTilesRequestContext

Posted by Antonio Petrelli <an...@gmail.com>.
2007/9/3, Neil Aggarwal <ne...@jammconsulting.com>:
>
> Antonio:
>
> If you look at the patch I put into the jira, it
> checks to make sure the session is not null.



Sorry I have not been clear (even with myself :-) )
I meant that, if someone tries to add an attribute in the session, the
session should be created.
So I think that the ServletSessionScopeMap class should hold a reference to
the HttpServletRequest, so it can create a session when it is necessary.

Antonio

RE: Improvement: Do not create sessions in ServletTilesRequestContext

Posted by Neil Aggarwal <ne...@JAMMConsulting.com>.
Antonio:

If you look at the patch I put into the jira, it
checks to make sure the session is not null.

	Neil 



--
Neil Aggarwal, (832)245-7314, www.JAMMConsulting.com
Eliminate junk email and reclaim your inbox.
Visit http://www.spammilter.com for details.
-----Original Message-----
From: Antonio Petrelli [mailto:antonio.petrelli@gmail.com] 
Sent: Monday, September 03, 2007 1:58 AM
To: users@tiles.apache.org
Subject: Re: Improvement: Do not create sessions in
ServletTilesRequestContext

2007/9/3, Neil Aggarwal <ne...@jammconsulting.com>:
>
> Hello:
>
> I created this tiles improvement request:
> http://issues.apache.org/struts/browse/TILES-207
>
> Right now, ServletTilesRequestContext.getSessionScope() calls
> request.getSession() when it should be using
> request.getSession(false)
>
> I hope this is the correct way to report this.



Thanks for the report: however I think the solution is not complete, since
there is the need of checking if the session object is null.

Antonio


Re: Improvement: Do not create sessions in ServletTilesRequestContext

Posted by Antonio Petrelli <an...@gmail.com>.
2007/9/3, Neil Aggarwal <ne...@jammconsulting.com>:
>
> Hello:
>
> I created this tiles improvement request:
> http://issues.apache.org/struts/browse/TILES-207
>
> Right now, ServletTilesRequestContext.getSessionScope() calls
> request.getSession() when it should be using
> request.getSession(false)
>
> I hope this is the correct way to report this.



Thanks for the report: however I think the solution is not complete, since
there is the need of checking if the session object is null.

Antonio