You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Tomas Kolda <ko...@web2net.cz> on 2009/01/27 23:40:13 UTC

Session creation

Hi,

is there a simple way to detect which part or component of my page 
forces Session creation? I do not have @Persist or @ApplicationState in 
page class and it still create session.

Thanks
Tomas


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


Re: Session creation

Posted by Tomas Kolda <ko...@web2net.cz>.
Hi again,

I created completely new project: mvn archetype:create 
-DarchetypeGroupId=org.apache.tapestry -DarchetypeArtifactId=quickstart 
-DgroupId=org.test -DartifactId=web -DpackageName=org.test.web 
-Dversion=1.0.0-SNAPSHOT

And changed as says my last email. Complete project is in attachement. 
When you run mvn jetty:run and go to http://localhost:8080/web/ you will 
see, that it will create session. What is wrong? Normally I create an 
issue, but you all says that it works.

 >curl -I localhost:8080/web/
HTTP/1.1 200 OK
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Set-Cookie: JSESSIONID=vn3j9rjuqp8m;Path=/web
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Server: Jetty(6.1.9)

You see Cookie: JSESSIONID=vn3j9rjuqp8m;

Tomas

Tomas Kolda napsal(a):
> Yes restarted. I deleted all from Index, but form. What am I doing 
> wrong? Using 5.0.18, Jetty, Eclipse 3.4.
>
> Index.java:
> @Meta("tapestry.persistence-strategy=client")
> public class Index
> {
>    @Property
>    private String query;
> }
>
> Index.tml:
> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> <body>
> <t:form t:id="queryForm" t:autofocus="false">
>    <t:textField t:id="queryField" value="query" />
>    <t:submit t:id="search" value="Search"/>
> </t:form>
> </body>
> </html>
>
> Session listener callstack:
>    at 
> cz.faiyo.web.services.SessionListener.sessionCreated(SessionListener.java:23) 
>
>    at 
> org.mortbay.jetty.servlet.AbstractSessionManager.addSession(AbstractSessionManager.java:570) 
>
>    at 
> org.mortbay.jetty.servlet.AbstractSessionManager.newHttpSession(AbstractSessionManager.java:415) 
>
>    at org.mortbay.jetty.Request.getSession(Request.java:1040)
>    at 
> org.apache.tapestry5.internal.services.RequestImpl.getSession(RequestImpl.java:99) 
>
>    at $Request_11f1eb49d54.getSession($Request_11f1eb49d54.java)
>    at $Request_11f1eb49d21.getSession($Request_11f1eb49d21.java)
>    at 
> org.apache.tapestry5.internal.services.AbstractSessionPersistentFieldStrategy.postChange(AbstractSessionPersistentFieldStrategy.java:124) 
>
>    at 
> org.apache.tapestry5.internal.services.PersistentFieldManagerImpl.postChange(PersistentFieldManagerImpl.java:85) 
>
>    at 
> $PersistentFieldManager_11f1eb49d5a.postChange($PersistentFieldManager_11f1eb49d5a.java) 
>
>    at 
> org.apache.tapestry5.internal.structure.PageImpl.persistFieldChange(PageImpl.java:192) 
>
>    at 
> org.apache.tapestry5.internal.structure.InternalComponentResourcesImpl.persistFieldChange(InternalComponentResourcesImpl.java:257) 
>
>    at 
> org.apache.tapestry5.corelib.components.Form._$write_defaultTracker(Form.java) 
>
>    at 
> org.apache.tapestry5.corelib.components.Form.getDefaultTracker(Form.java:222) 
>
>    at $PropertyConduit_11f1eb49d83.get($PropertyConduit_11f1eb49d83.java)
> .....
> .....
>
>
> Thiago H. de Paula Figueiredo napsal(a):
>> Have you put this annotation in all pages with Form components and 
>> restarted you application (to clear the session)?
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

Re: Session creation

Posted by Tomas Kolda <ko...@web2net.cz>.
Yes restarted. I deleted all from Index, but form. What am I doing 
wrong? Using 5.0.18, Jetty, Eclipse 3.4.

Index.java:
@Meta("tapestry.persistence-strategy=client")
public class Index
{
    @Property
    private String query;
}

Index.tml:
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<body>
<t:form t:id="queryForm" t:autofocus="false">
    <t:textField t:id="queryField" value="query" />
    <t:submit t:id="search" value="Search"/>
</t:form>
</body>
</html>

Session listener callstack:
    at 
cz.faiyo.web.services.SessionListener.sessionCreated(SessionListener.java:23)
    at 
org.mortbay.jetty.servlet.AbstractSessionManager.addSession(AbstractSessionManager.java:570)
    at 
org.mortbay.jetty.servlet.AbstractSessionManager.newHttpSession(AbstractSessionManager.java:415)
    at org.mortbay.jetty.Request.getSession(Request.java:1040)
    at 
org.apache.tapestry5.internal.services.RequestImpl.getSession(RequestImpl.java:99)
    at $Request_11f1eb49d54.getSession($Request_11f1eb49d54.java)
    at $Request_11f1eb49d21.getSession($Request_11f1eb49d21.java)
    at 
org.apache.tapestry5.internal.services.AbstractSessionPersistentFieldStrategy.postChange(AbstractSessionPersistentFieldStrategy.java:124)
    at 
org.apache.tapestry5.internal.services.PersistentFieldManagerImpl.postChange(PersistentFieldManagerImpl.java:85)
    at 
$PersistentFieldManager_11f1eb49d5a.postChange($PersistentFieldManager_11f1eb49d5a.java)
    at 
org.apache.tapestry5.internal.structure.PageImpl.persistFieldChange(PageImpl.java:192)
    at 
org.apache.tapestry5.internal.structure.InternalComponentResourcesImpl.persistFieldChange(InternalComponentResourcesImpl.java:257)
    at 
org.apache.tapestry5.corelib.components.Form._$write_defaultTracker(Form.java)
    at 
org.apache.tapestry5.corelib.components.Form.getDefaultTracker(Form.java:222)
    at $PropertyConduit_11f1eb49d83.get($PropertyConduit_11f1eb49d83.java)
.....
.....


Thiago H. de Paula Figueiredo napsal(a):
> Have you put this annotation in all pages with Form components and 
> restarted you application (to clear the session)?
>

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


Re: Session creation

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Have you put this annotation in all pages with Form components and  
restarted you application (to clear the session)?

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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


Re: Session creation

Posted by Kalle Korhonen <ka...@gmail.com>.
Layout's still a component (unless you have a page named Layout), need to be
in the page class. I can verify the meta annotation works ok.

Kalle


On Wed, Jan 28, 2009 at 10:48 AM, Tomas Kolda <ko...@web2net.cz> wrote:

> Hmm, I do not know what I'm doing wrong, but it does not work. It still
> create session.
>
> @Meta("tapestry.persistence-strategy=client")
> public class Layout {
>
>   @Component
>   private Form queryForm;
>
> ......
>
>
> Thiago H. de Paula Figueiredo napsal(a):
>
>> Em Wed, 28 Jan 2009 15:04:35 -0300, Tomas Kolda <ko...@web2net.cz>
>> escreveu:
>>
>>  Meta did not work, because I can't use it on component variable. It can
>>> be used only to @Target(TYPE). Maybe you have different version.
>>>
>>
>> Put it in the page class at which the Form component is used. I was wrong
>> when I suggested to put the annotation in the component. I'm sorry.
>>
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Session creation

Posted by Tomas Kolda <ko...@web2net.cz>.
Hmm, I do not know what I'm doing wrong, but it does not work. It still 
create session.

@Meta("tapestry.persistence-strategy=client")
public class Layout {

    @Component
    private Form queryForm;

......


Thiago H. de Paula Figueiredo napsal(a):
> Em Wed, 28 Jan 2009 15:04:35 -0300, Tomas Kolda <ko...@web2net.cz> 
> escreveu:
>
>> Meta did not work, because I can't use it on component variable. It 
>> can be used only to @Target(TYPE). Maybe you have different version.
>
> Put it in the page class at which the Form component is used. I was 
> wrong when I suggested to put the annotation in the component. I'm sorry.
>

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


Re: Session creation

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Wed, 28 Jan 2009 15:04:35 -0300, Tomas Kolda <ko...@web2net.cz>  
escreveu:

> Meta did not work, because I can't use it on component variable. It can  
> be used only to @Target(TYPE). Maybe you have different version.

Put it in the page class at which the Form component is used. I was wrong  
when I suggested to put the annotation in the component. I'm sorry.

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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


Re: Session creation

Posted by Tomas Kolda <ko...@web2net.cz>.
Thank you,

yes problem is in Form. I do not know how to switch off persistence of 
validation so I will use standard <form> tag.

Meta did not work, because I can't use it on component variable. It can 
be used only to @Target(TYPE). Maybe you have different version.

Also thanks to Andreas Andreou for Session listener. Great tool to find 
out why session is created.

Tomas


Thiago H. de Paula Figueiredo napsal(a):
> Em Tue, 27 Jan 2009 19:40:13 -0300, Tomas Kolda <ko...@web2net.cz> 
> escreveu:
>
>> is there a simple way to detect which part or component of my page 
>> forces Session creation? I do not have @Persist or @ApplicationState 
>> in page class and it still create session.
>
> I wish I knew, but, by default, the Form component uses the session to 
> store validation info.
> Try putting @Meta("tapestry.persistence-strategy=client") in your page 
> classes or in your components instances. Something like
>
> @Component
> @Meta("tapestry.persistence-strategy=client")
> private Form form;
>

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


Re: Session creation

Posted by Andreas Andreou <an...@di.uoa.gr>.
Use httpsessionlistener

http://www.xyzws.com/servletfaq/when-do-i-use-httpsessionlistener/7

In the sessionCreated method, just create an Exception and log it to examine
the traces - or even throw it if you don't want any sessions at all
and want to be
100% sure :)

On Wed, Jan 28, 2009 at 1:49 AM, Thiago H. de Paula Figueiredo
<th...@gmail.com> wrote:
> Em Tue, 27 Jan 2009 19:40:13 -0300, Tomas Kolda <ko...@web2net.cz> escreveu:
>
>> is there a simple way to detect which part or component of my page forces
>> Session creation? I do not have @Persist or @ApplicationState in page class
>> and it still create session.
>
> I wish I knew, but, by default, the Form component uses the session to store
> validation info.
> Try putting @Meta("tapestry.persistence-strategy=client") in your page
> classes or in your components instances. Something like
>
> @Component
> @Meta("tapestry.persistence-strategy=client")
> private Form form;
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java consultant, developer, and instructor
> http://www.arsmachina.com.br/thiago
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
Tapestry / Tacos developer
Open Source / JEE Consulting

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


Re: Session creation

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Tue, 27 Jan 2009 19:40:13 -0300, Tomas Kolda <ko...@web2net.cz>  
escreveu:

> is there a simple way to detect which part or component of my page  
> forces Session creation? I do not have @Persist or @ApplicationState in  
> page class and it still create session.

I wish I knew, but, by default, the Form component uses the session to  
store validation info.
Try putting @Meta("tapestry.persistence-strategy=client") in your page  
classes or in your components instances. Something like

@Component
@Meta("tapestry.persistence-strategy=client")
private Form form;

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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