Re: Session Storage with Tapestry
If you are using Tapestry Hibernate it should just work if you put a Hibernate object into a SessionState variable. There is a configuration that contains the Hibernate entities so SessionState is able to store the primary key in the session and retrieve the object when needed. Services as well as pages/components should be able to lazy load from the SessionState object. Assuming you are using Tapestry Hibernate then somehow the object in your SessionState is disconnected from the Hibernate session. If you turn on show sql you should see the object fetched evertime you go to a new page. If you don't then something is wrong. On Wed, Mar 18, 2015 at 5:21 AM, Poggenpohl, Daniel daniel.poggenp...@isst.fraunhofer.de wrote: Hello again, a slightly different topic as the last but with the same undertones: I need a session storage where I store the currently logged on user. Reading about it in the documentation, they recommend using @SessionState because my user is a complex object, also containing lists of other entities. My user also is an entity in a database. So, when a user logs in, the appropriate entity is retrieved from the database, an AppSession object is created containing, among e.g. the time of login, the user object. Is this the right way to do it? Or should I only store the ID in the session? Now when the SessionState object is created, it can be used in any other page or component using the same SessionState annotation and the same type. Does it need to be the same name I'd say it doesn't, as I've not read otherwise. My user contains lazy collections of other entities. Every page of my app contains the layout component which provides the login area and serves to create the session object for the app, retrieving the user entity in the process. A page containing the layout component itself contains another component where these lazy collections are needed. The user logs in, the SessionState object is created, the user entity is stored inside the object. The page is requested again, and the component is initialized/rendered. The component contains a reference to the SessionState object. Inside the component, a tree should display objects of the lazy collection. To do this, a service receives the user. The service tries to access the lazy collection, but fails with a failed to lazily initialize a collection of role:. What I gather from this is, services don't operate within transactions? UPDATE: I tried to access the lazy collection from the component itself, but the error was the same. Even from the page, the error still was present. This leads me to the point that I may be doing something wrong using an entity in a session storage? Regards, Daniel Poggenpohl
Re: Session Storage with Tapestry
On Wed, 18 Mar 2015 07:21:06 -0300, Poggenpohl, Daniel daniel.poggenp...@isst.fraunhofer.de wrote: Hello again, Hi! I need a session storage where I store the currently logged on user. Reading about it in the documentation, they recommend using @SessionState because my user is a complex object, also containing lists of other entities. You need to use @SessionState because @Persist is only valid for a given page or component. Page1's @Persist private User user; is stored in a different session attribute than Page2's @Persist private User user;. If you want something persisted across pages, you need to use @SessionState. Being a complex object makes no difference about choosing one annotation or the other. My user also is an entity in a database. So, when a user logs in, the appropriate entity is retrieved from the database, an AppSession object is created containing, among e.g. the time of login, the user object. Is this the right way to do it? Or should I only store the ID in the session? This is extremely dependent on how you're going to use your user information. If you're going to show their name in every page, for example, and you store just the id, you'll be querying the database for the same information every request (unless you use some kind of cache between your page or component or mixin and your database). Now when the SessionState object is created, it can be used in any other page or component using the same SessionState annotation and the same type. Does it need to be the same name I'd say it doesn't, as I've not read otherwise. @SessionState is keyed by type, not by field name, so @SessionState private User user; and @SessionState private User currentUser; will point to the same object, stored in the same session attribute. To do this, a service receives the user. The service tries to access the lazy collection, but fails with a failed to lazily initialize a collection of role:. What I gather from this is, services don't operate within transactions? The error isn't related to transactions nor Tapestry at all. It's related to your Hibernate/JPA usage: one entity is loaded in one request, one Hibernate session/JPA entity manager instance. Then, in another request, another session/entity manager instance, you try to load some lazy field. You need to use the merge() method of org.hibernate.Session or EntityManager to reattach the entity to the current Hibernate session or JPA entity manager. Services operate within transactions as long as you use @CommitAfter (tapestry-hibernate or tapestry-jpa) or something like that (other library). -- Thiago H. de Paula Figueiredo Tapestry, Java and Hibernate consultant and developer http://machina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Session Storage with Tapestry
For this to work you need to store an entity in the SessionState. It looks like you are storing AppSession in the SessionState which contains the User entity. The simple way to fix this would be to add a lastLogin property to your User entity and then just make your SessionState a User object. If you don't want lastLogin in the database you'll need to persist it some other way. I usually make a service to hide all this stuff. I don't like having @SessionState everywhere because it makes it difficult to refactor. In this case you could make a service called UserSession with getAppSession() and getUser(). Then instead of putting User in AppSession just put both in the session. On Wednesday, March 18, 2015, Poggenpohl, Daniel daniel.poggenp...@isst.fraunhofer.de wrote: Hello again, oops, I didn't see this message, sorry. This here: http://tapestry.apache.org/5.3/apidocs/src-html/org/apache/tapestry5/jpa/JpaModule.html seems to indicate that the default for JpaSymbols.ENTITY_SESSION_STATE_PERSISTENCE_STRATEGY_ENABLED is true, which is part of why my changes do not make a difference. Another part seems to be what you say, that I need to directly annotate an entity with @SessionState. I've found this here: http://tapestry.apache.org/5.3/apidocs/src-html/org/apache/tapestry5/internal/hibernate/EntityApplicationStatePersistenceStrategy.html#line.40 public class EntityApplicationStatePersistenceStrategy extends SessionApplicationStatePersistenceStrategy { @Override public T T get(final ClassT ssoClass, final ApplicationStateCreatorT creator) { final Object persistedValue = getOrCreate(ssoClass, creator); if (persistedValue instanceof PersistedEntity) { final PersistedEntity persisted = (PersistedEntity) persistedValue; final Object restored = persisted.restore(entityManagerManager); // shall we maybe throw an exception instead? if (restored == null) { set(ssoClass, null); return (T) getOrCreate(ssoClass, creator); } return (T) restored; } return (T) persistedValue; } } Which tells me that entities contained in SSO annotated objects are basically out of luck, it seems. So, is my method of creating a session state object containing multiple values not a good way to do this? Or is it just that entities are used under-supported this way? Regards, Daniel P. -Ursprüngliche Nachricht- Von: Barry Books [mailto:trs...@gmail.com javascript:;] Gesendet: Mittwoch, 18. März 2015 12:05 An: Tapestry users Betreff: Re: Session Storage with Tapestry If you are using Tapestry Hibernate it should just work if you put a Hibernate object into a SessionState variable. There is a configuration that contains the Hibernate entities so SessionState is able to store the primary key in the session and retrieve the object when needed. Services as well as pages/components should be able to lazy load from the SessionState object. Assuming you are using Tapestry Hibernate then somehow the object in your SessionState is disconnected from the Hibernate session. If you turn on show sql you should see the object fetched evertime you go to a new page. If you don't then something is wrong. On Wed, Mar 18, 2015 at 5:21 AM, Poggenpohl, Daniel daniel.poggenp...@isst.fraunhofer.de javascript:; wrote: Hello again, a slightly different topic as the last but with the same undertones: I need a session storage where I store the currently logged on user. Reading about it in the documentation, they recommend using @SessionState because my user is a complex object, also containing lists of other entities. My user also is an entity in a database. So, when a user logs in, the appropriate entity is retrieved from the database, an AppSession object is created containing, among e.g. the time of login, the user object. Is this the right way to do it? Or should I only store the ID in the session? Now when the SessionState object is created, it can be used in any other page or component using the same SessionState annotation and the same type. Does it need to be the same name I'd say it doesn't, as I've not read otherwise. My user contains lazy collections of other entities. Every page of my app contains the layout component which provides the login area and serves to create the session object for the app, retrieving the user entity in the process. A page containing the layout component itself contains another component where these lazy collections are needed. The user logs in, the SessionState object is created, the user entity is stored inside the object. The page is requested again, and the component is initialized/rendered. The component contains a reference to the SessionState object. Inside the component, a tree should display objects
Re: session invalidate in tapestry
Hi Il 13/11/2014 15:24, Thiago H de Paula Figueiredo ha scritto: On Thu, 13 Nov 2014 12:16:03 -0200, Ivano Luberti lube...@archicoop.it wrote: Hi all, I have a question about session handling in Tapestry5. I have a @SessionState protected User user; Shouldn't it be @SessionState(create = false) so user isn't instantiated automatically and is null until you set the field? well in my case authentication and authorization is verified using information that are popultaed only after login, so from my point of view I had not advantage. Anyway I followed you on this. But nothing changed. that works as expected I wanted to perform some cleanup when calling a logout link: the action link listener is made as this: public Object onActionFromLink() { requestGlobals.getHTTPServletRequest().getSession().invalidate(); return Index.class; } You can (and should) @Inject Request. There's absolutely no reason in the last 5 years to use RequestGlobals to get the request object. You can also @Inject HttpServletRequest and HttpServletResponse directly if needed. @Inject private Request request; ... Session session = request.getSession(false); if (session != null) { session.invalidate(); } I have done also this but to no avail. So I try to explain what happens. I have the following class package it.archicoop.met.obliterazione.base; import it.archicoop.met.obliterazione.beans.User; import org.apache.tapestry5.annotations.Property; import org.apache.tapestry5.annotations.SessionState; import org.apache.tapestry5.ioc.annotations.Inject; public class BasePage implements IPage{ @SessionState(create=false) @Property protected User user; User is defined as this: package it.archicoop.met.obliterazione.beans; import javax.servlet.http.HttpSessionEvent; import javax.servlet.http.HttpSessionListener; public class User implements HttpSessionListener { public User() { } public void sessionCreated(HttpSessionEvent se) { System.out.println(session started +se.getSession().getId()); } public void sessionDestroyed(HttpSessionEvent se) { System.out.println(session ended +se.getSession().getId()); } } Then I have package it.archicoop.met.obliterazione.pages; public class Index extends BasePage { and package it.archicoop.met.obliterazione.pages; public class BarCode extends BasePage { Logout link is implemented using a component package it.archicoop.met.obliterazione.components; import it.archicoop.met.obliterazione.pages.Index; import org.apache.tapestry5.ioc.annotations.Inject; import org.apache.tapestry5.services.Request; import org.apache.tapestry5.services.Session; public class Logout { @Inject private Request request; public Object onActionFromLink() { Session session = request.getSession(false); if (session != null) { session.invalidate(); } return Index.class; } } public Object onActionFromLink() { Session session = request.getSession(false); if (session != null) { session.invalidate(); } return Index.class; } What happens startup app User constuctor called it.archicoop.met.obliterazione.beans.User@2a801059 When I call the Index page in the browser onPrepare is called session created it.archicoop.met.obliterazione.beans.User@2a801059 user field is null so constructor is called explicitly: it.archicoop.met.obliterazione.beans.User@50862b70 login form submission it.archicoop.met.obliterazione.beans.User@50862b70 Logout link BarCode is the container of the Logout component and user is null (WTF!?) after session.invalidate is called Session Destroyed it.archicoop.met.obliterazione.beans.User@2a801059 Since I redirect to Index, again onPrepare user is initially it.archicoop.met.obliterazione.beans.User@50862b70 then user null then recreated it.archicoop.met.obliterazione.beans.User@4c057cc6 SessionCreated called it.archicoop.met.obliterazione.beans.User@2a801059 So it seems that the field of type User is not persisted between different pages. And there is no relation between the user instances managed by the servlet containt via SessionListener interface and the one in the pages As I sadi before: there are other ways to centrailize session boundign and unbounding but I wanted to know if in Tapestry I can use the HTTPSessionListener inteface for object persisted in the session -- == dott. Ivano Mario Luberti Archimede Informatica societa' cooperativa a r. l. Sede Operativa Via Gereschi 36 - 56126- Pisa tel.: +39-050- 580959 tel/fax: +39-050-9711344 web: www.archicoop.it == - To
Re: session invalidate in tapestry
On Fri, 14 Nov 2014 09:25:47 -0200, Ivano Luberti lube...@archicoop.it wrote: Hi Hi! When I call the Index page in the browser onPrepare is called What's your onPrepare() method? You didn't post it here. By the way, you could print a stack trace inside the User constructor to know exactly which method is instantiating it. So it seems that the field of type User is not persisted between different pages. Yes, it is. But I guess you're using the same field for @SessionState (storing authentication information) and login form. If yes, that's exactly what's messing up with your code. As I sadi before: there are other ways to centrailize session boundign and unbounding Not in Tapestry itself. but I wanted to know if in Tapestry I can use the HTTPSessionListener inteface for object persisted in the session Yes, you can use it. -- Thiago H. de Paula Figueiredo Tapestry, Java and Hibernate consultant and developer http://machina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: session invalidate in tapestry
Il 14/11/2014 13:13, Thiago H de Paula Figueiredo ha scritto: On Fri, 14 Nov 2014 09:25:47 -0200, Ivano Luberti lube...@archicoop.it wrote: Hi Hi! When I call the Index page in the browser onPrepare is called What's your onPrepare() method? You didn't post it here. By the way, you could print a stack trace inside the User constructor to know exactly which method is instantiating it. Here is the code: is not onPrepare but setupRender , sorry, I had changed it from onPrepare but the result has not changed, anyway @Log public void setupRender(){ try { Loginform lf= user.getWsclient().getLoginForm(requestGlobal.getHTTPServletRequest().getRemoteAddr()); monumenti=lf.getMonumenti(); postazioni=lf.getPostazioni(); idMonumentoSelezionato=lf.getIdMonumentoSelezionato(); user.setIp(requestGlobal.getHTTPServletRequest().getRemoteAddr()); } catch (Exception e) { logger.debug(e.getMessage()); } } Here are the stack traces produced by the constuctor calls and sessionCreated and session destroyed methods You can see that 1) an instance A is created when tomcat starts up 2) instance A is bounded to the session when first page is visited 3) when first page is visited also instance B is created but not bound to any session 4) on logout instance A id unbound from session 5) on redirection to Index instance B is discarded and instance C is created but not attached to the session So B is created in the first page but not bound to the session while some way is visible across pages While A is created at server start-up (why?) but is not visible in the page. If from web.xml I remove listener listener-classit.archicoop.met.obliterazione.beans.User/listener-class /listener of course A is not created anymore but neither are called sessionCreated and sessionDestroy While B keep on behaving as described When I start the application an instance is created and printing a stack trace produces: I'm it.archicoop.met.obliterazione.beans.User@4e1a70b8 and I'm created here: it.archicoop.met.obliterazione.beans.User,init,34 sun.reflect.NativeConstructorAccessorImpl,newInstance0,-2 sun.reflect.NativeConstructorAccessorImpl,newInstance,39 sun.reflect.DelegatingConstructorAccessorImpl,newInstance,27 java.lang.reflect.Constructor,newInstance,513 java.lang.Class,newInstance0,357 java.lang.Class,newInstance,310 org.apache.catalina.core.StandardContext,listenerStart,4150 org.apache.catalina.core.StandardContext,start,4705 org.apache.catalina.core.ContainerBase,start,1057 org.apache.catalina.core.StandardHost,start,840 org.apache.catalina.core.ContainerBase,start,1057 org.apache.catalina.core.StandardEngine,start,463 org.apache.catalina.core.StandardService,start,525 org.apache.catalina.core.StandardServer,start,754 org.apache.catalina.startup.Catalina,start,595 sun.reflect.NativeMethodAccessorImpl,invoke0,-2 sun.reflect.NativeMethodAccessorImpl,invoke,39 sun.reflect.DelegatingMethodAccessorImpl,invoke,25 java.lang.reflect.Method,invoke,597 org.apache.catalina.startup.Bootstrap,start,289 org.apache.catalina.startup.Bootstrap,main,414 When I load the Index Page, first is invoked sessionCreated() [DEBUG] pages.Index [ENTER] setupRender() I'm bounded and I'm: it.archicoop.met.obliterazione.beans.User@4e1a70b8 in session 4CEC6E6D283C89FAEBCBEFF0D578E0DE it.archicoop.met.obliterazione.beans.User,sessionCreated,104 org.apache.catalina.session.StandardSession,tellNew,392 org.apache.catalina.session.StandardSession,setId,363 org.apache.catalina.session.StandardSession,setId,345 org.apache.catalina.session.ManagerBase,createSession,906 org.apache.catalina.session.StandardManager,createSession,292 org.apache.catalina.connector.Request,doGetSession,2448 org.apache.catalina.connector.Request,getSession,2157 org.apache.catalina.connector.RequestFacade,getSession,833 $HttpServletRequest_18d69c7688d1,getSession,-1 $HttpServletRequest_18d69c7688cf,getSession,-1 org.apache.tapestry5.internal.services.TapestrySessionFactoryImpl,getSession,44 $TapestrySessionFactory_18d69c7688cc,getSession,-1 org.apache.tapestry5.internal.services.RequestImpl,getSession,115 $Request_18d69c7688f3,getSession,-1 $Request_18d69c7688bb,getSession,-1 org.apache.tapestry5.internal.services.SessionApplicationStatePersistenceStrategy,getSession,38 org.apache.tapestry5.internal.services.SessionApplicationStatePersistenceStrategy,getOrCreate,49 org.apache.tapestry5.internal.services.SessionApplicationStatePersistenceStrategy,get,44 $ApplicationStatePersistenceStrategy_18d69c768994,get,-1 org.apache.tapestry5.internal.services.ApplicationStateManagerImpl$ApplicationStateAdapter,getOrCreate,50 org.apache.tapestry5.internal.services.ApplicationStateManagerImpl,get,133 $ApplicationStateManager_18d69c7688fa,get,-1
Re: session invalidate in tapestry
On Fri, 14 Nov 2014 15:27:51 -0200, Ivano Luberti lube...@archicoop.it wrote: So B is created in the first page but not bound to the session while some way is visible across pages While A is created at server start-up (why?) but is not visible in the page. If from web.xml I remove listener listener-classit.archicoop.met.obliterazione.beans.User/listener-class /listener If you declare your User class like this, for the listening itself, the servlet container will create a single User instance and invoke its methods. This is completely unrelated to Tapestry's @SessionState. Why are you doing that? Using the same class for this listener *and* as an @SessionState field makes no sense at all, at least at first. Shouldn't your User class implement HttpSessionBindingListener instead? -- Thiago H. de Paula Figueiredo Tapestry, Java and Hibernate consultant and developer http://machina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: session invalidate in tapestry
Oh God! Yes , I messed up with interfaces: too much time using PHP Thanks Thiago Il 14/11/2014 20:47, Thiago H de Paula Figueiredo ha scritto: On Fri, 14 Nov 2014 15:27:51 -0200, Ivano Luberti lube...@archicoop.it wrote: So B is created in the first page but not bound to the session while some way is visible across pages While A is created at server start-up (why?) but is not visible in the page. If from web.xml I remove listener listener-classit.archicoop.met.obliterazione.beans.User/listener-class /listener If you declare your User class like this, for the listening itself, the servlet container will create a single User instance and invoke its methods. This is completely unrelated to Tapestry's @SessionState. Why are you doing that? Using the same class for this listener *and* as an @SessionState field makes no sense at all, at least at first. Shouldn't your User class implement HttpSessionBindingListener instead? -- == dott. Ivano Mario Luberti Archimede Informatica societa' cooperativa a r. l. Sede Operativa Via Gereschi 36 - 56126- Pisa tel.: +39-050- 580959 tel/fax: +39-050-9711344 web: www.archicoop.it == - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: session invalidate in tapestry
On Fri, 14 Nov 2014 18:15:12 -0200, Ivano Luberti lube...@archicoop.it wrote: Oh God! Yes , I messed up with interfaces: too much time using PHP Hehehe. Actually, even without PHP messing up with your brain, it's easy to mistake one of the interfaces for the other . . . Thanks Thiago :D Il 14/11/2014 20:47, Thiago H de Paula Figueiredo ha scritto: On Fri, 14 Nov 2014 15:27:51 -0200, Ivano Luberti lube...@archicoop.it wrote: So B is created in the first page but not bound to the session while some way is visible across pages While A is created at server start-up (why?) but is not visible in the page. If from web.xml I remove listener listener-classit.archicoop.met.obliterazione.beans.User/listener-class /listener If you declare your User class like this, for the listening itself, the servlet container will create a single User instance and invoke its methods. This is completely unrelated to Tapestry's @SessionState. Why are you doing that? Using the same class for this listener *and* as an @SessionState field makes no sense at all, at least at first. Shouldn't your User class implement HttpSessionBindingListener instead? -- Thiago H. de Paula Figueiredo Tapestry, Java and Hibernate consultant and developer http://machina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: session invalidate in tapestry
On Thu, 13 Nov 2014 12:16:03 -0200, Ivano Luberti lube...@archicoop.it wrote: Hi all, I have a question about session handling in Tapestry5. I have a @SessionState protected User user; Shouldn't it be @SessionState(create = false) so user isn't instantiated automatically and is null until you set the field? that works as expected I wanted to perform some cleanup when calling a logout link: the action link listener is made as this: public Object onActionFromLink() { requestGlobals.getHTTPServletRequest().getSession().invalidate(); return Index.class; } You can (and should) @Inject Request. There's absolutely no reason in the last 5 years to use RequestGlobals to get the request object. You can also @Inject HttpServletRequest and HttpServletResponse directly if needed. @Inject private Request request; ... Session session = request.getSession(false); if (session != null) { session.invalidate(); } I don't know if this is important (I guess not) but the method is in a component and not direclty in a page (so that I can render the link only in protected pages ) No difference. Please change the @SessionState usage as I suggested and try again. -- Thiago H. de Paula Figueiredo Tapestry, Java and Hibernate consultant and developer http://machina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Session Cookie Remains after Tapestry Security Logout
On Sun, Nov 2, 2014 at 4:41 PM, Harry Zhou superha...@gmail.com wrote: The user is indeed logged out, and the session is indeed invalidated. Everything seems to work fine. 3. The Issue Upon closer inspection, I noticed that the session cookie created by user during login is still in the browser after logout. The browser repeatedly requests the session with the JSESSIONID: g3xfcskjnvf from the server, which has already been invalidated. Sure enough, the server stderrout log shows the following (trimmed for clarity) for each request made by the user after logout: INFO org.codehaus.wadi.core.contextualiser.HybridRelocater - Unknown session [g3xfcskjnvf] ERROR org.codehaus.wadi.core.manager.StandardManager - Could not acquire session [g3xfcskjnvf] Is it normal that the session cookie is not removed (by setting maxAge to 0, etc.) after the session is invalidated on the server side? If not, did I make a mistake in my way of logging the user out that causes the cookie to remain? First of all, requesting an invalid session should not have been logged as an error - it's a completely normal for a web application - a WARN or simply DEBUG would have suited much better (you could open an issue with Wadi on that). Anyway, tapestry-security doesn't explicitly remove JSESSIONID cookie on logout. It just invalidates the session and removes the rememberMe cookie. I didn't see that you are manually removing the JSESSIONID cookie anywhere in your code. If you are and it doesn't work, the headers must be rewritten after the fact. Whether it should be done automatically by the servlet implementation, I'm actually not sure if the spec says anything about it. We could check that out and if the behavior is left open, it'd be simple to add that as an enhancement to tapestry-security. Kalle
Re: Session Cookie Remains after Tapestry Security Logout
Kalle, Thank you so much for the quick reply, based on which we have done the following: 1. We surveyed several Tapestry sites (including the hotelbooking demo app) and confirmed that leaving the cookie after session invalidation is expected. 2. We then double confirmed that the leftover cookie is indeed the cause of server-side exception reporting -- as soon as the cookie is manually removed or re-issued by the server (as the result of a persistent page field, etc.), the server stops complaining. 3. We then decided that the issue was with the client's server environment, which ran Jetty 6, and confirmed with the client that it was an arbitrary choice. They provided a new Jetty 9 environment, under which we deployed the application, and the exceptions went away! So all is good! Thanks Kalle. Best, Harry On Mon, Nov 3, 2014 at 12:42 PM, Kalle Korhonen kalle.o.korho...@gmail.com wrote: On Sun, Nov 2, 2014 at 4:41 PM, Harry Zhou superha...@gmail.com wrote: The user is indeed logged out, and the session is indeed invalidated. Everything seems to work fine. 3. The Issue Upon closer inspection, I noticed that the session cookie created by user during login is still in the browser after logout. The browser repeatedly requests the session with the JSESSIONID: g3xfcskjnvf from the server, which has already been invalidated. Sure enough, the server stderrout log shows the following (trimmed for clarity) for each request made by the user after logout: INFO org.codehaus.wadi.core.contextualiser.HybridRelocater - Unknown session [g3xfcskjnvf] ERROR org.codehaus.wadi.core.manager.StandardManager - Could not acquire session [g3xfcskjnvf] Is it normal that the session cookie is not removed (by setting maxAge to 0, etc.) after the session is invalidated on the server side? If not, did I make a mistake in my way of logging the user out that causes the cookie to remain? First of all, requesting an invalid session should not have been logged as an error - it's a completely normal for a web application - a WARN or simply DEBUG would have suited much better (you could open an issue with Wadi on that). Anyway, tapestry-security doesn't explicitly remove JSESSIONID cookie on logout. It just invalidates the session and removes the rememberMe cookie. I didn't see that you are manually removing the JSESSIONID cookie anywhere in your code. If you are and it doesn't work, the headers must be rewritten after the fact. Whether it should be done automatically by the servlet implementation, I'm actually not sure if the spec says anything about it. We could check that out and if the behavior is left open, it'd be simple to add that as an enhancement to tapestry-security. Kalle -- Best Regards Harry Zhou
Re: Session Cookie Remains after Tapestry Security Logout
369... On Mon, Nov 3, 2014 at 12:39 PM, Harry Zhou superha...@gmail.com wrote: Kalle, Thank you so much for the quick reply, based on which we have done the following: 1. We surveyed several Tapestry sites (including the hotelbooking demo app) and confirmed that leaving the cookie after session invalidation is expected. 2. We then double confirmed that the leftover cookie is indeed the cause of server-side exception reporting -- as soon as the cookie is manually removed or re-issued by the server (as the result of a persistent page field, etc.), the server stops complaining. 3. We then decided that the issue was with the client's server environment, which ran Jetty 6, and confirmed with the client that it was an arbitrary choice. They provided a new Jetty 9 environment, under which we deployed the application, and the exceptions went away! So all is good! Thanks Kalle. Best, Harry On Mon, Nov 3, 2014 at 12:42 PM, Kalle Korhonen kalle.o.korho...@gmail.com wrote: On Sun, Nov 2, 2014 at 4:41 PM, Harry Zhou superha...@gmail.com wrote: The user is indeed logged out, and the session is indeed invalidated. Everything seems to work fine. 3. The Issue Upon closer inspection, I noticed that the session cookie created by user during login is still in the browser after logout. The browser repeatedly requests the session with the JSESSIONID: g3xfcskjnvf from the server, which has already been invalidated. Sure enough, the server stderrout log shows the following (trimmed for clarity) for each request made by the user after logout: INFO org.codehaus.wadi.core.contextualiser.HybridRelocater - Unknown session [g3xfcskjnvf] ERROR org.codehaus.wadi.core.manager.StandardManager - Could not acquire session [g3xfcskjnvf] Is it normal that the session cookie is not removed (by setting maxAge to 0, etc.) after the session is invalidated on the server side? If not, did I make a mistake in my way of logging the user out that causes the cookie to remain? First of all, requesting an invalid session should not have been logged as an error - it's a completely normal for a web application - a WARN or simply DEBUG would have suited much better (you could open an issue with Wadi on that). Anyway, tapestry-security doesn't explicitly remove JSESSIONID cookie on logout. It just invalidates the session and removes the rememberMe cookie. I didn't see that you are manually removing the JSESSIONID cookie anywhere in your code. If you are and it doesn't work, the headers must be rewritten after the fact. Whether it should be done automatically by the servlet implementation, I'm actually not sure if the spec says anything about it. We could check that out and if the behavior is left open, it'd be simple to add that as an enhancement to tapestry-security. Kalle -- Best Regards Harry Zhou
Re: session management and threads synchronization
hi, maybe this ancient article by Brian Goetz may help you: http://www.ibm.com/developerworks/library/j-jtp09238/index.html :) cheers, Kris On Sat, Jan 18, 2014 at 8:39 AM, Ilya Obshadko ilya.obsha...@gmail.comwrote: Hello, I have implemented persistent session management in my application (using cookies and session IDs in the database). Everything works fine, but sometimes I see Hibernate errors Batch update returned unexpected row count from update when committing database changes after setting up a new session. It turns out that it happens when user starts a request and then quickly initiates reload of the same page. So I suppose this is a threading issue (one thread has already started creating session ID record, then user interrupts the connection and starts another request while the previous one hasn't been completed). I have implemented simple synchronization, but not yet sure if it's done correctly. So the question is: how do I synchronize method that creates the session? Currently it's implemented inside my authentication service: public void setupSessionForUser ( User user ) { synchronized ( this ) { user.clearSessions (); SessionToken newSessionToken = SessionToken.create (); user.addSessionToken ( newSessionToken ); hibernateSession.save ( newSessionToken ); asm.set ( User.class, (User) hibernateSession.merge ( user ) ); cookies.writeCookieValue ( authcookiename, newSessionToken.toString () ); logger.info ( set up new session {} for {}, newSessionToken.toString (), user.getEmail () ); } } Is that correct to synchronize on *this*? Or should I synchronize on HTTP Session instance instead? Thanks in advance. -- Ilya Obshadko
Re: Session storage docs don't mention OptimizedSessionPersistedObject or ImmutableSessionPersistedObject
Lance, I've changed it so that the same Clustering Issues section is now included (via a Confluence {include} tag) in both the Session Storage and Persistent Page Data pages, since they apply to both. On Mon, Jan 7, 2013 at 7:53 PM, Howard Lewis Ship hls...@gmail.com wrote: Also, you are right, a cross-link to the OptimizedSessionPersistedObject, etc., JavaDoc would be useful. On Tue, Jan 8, 2013 at 12:52 AM, Howard Lewis Ship hls...@gmail.com wrote: How about if you request write access to the Confluence wiki and update the Session Storage page yourself? On Mon, Jan 7, 2013 at 10:41 AM, Lance Java lance.j...@googlemail.comwrote: I've just noticed that the session storage docs don't mention OptimizedSessionPersistedObject or ImmutableSessionPersistedObject. Should I file a jira for this? Or is this covered elsewhere in the docs? http://tapestry.apache.org/session-storage.html http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/annotations/ImmutableSessionPersistedObject.html http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/OptimizedSessionPersistedObject.html -- View this message in context: http://tapestry.1045711.n5.nabble.com/Session-storage-docs-don-t-mention-OptimizedSessionPersistedObject-or-ImmutableSessionPersistedObject-tp5719174.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Session Expiration - Ajax
I think that this area is where Tapestry actually needs usability improvement. Usually, with setupRender() doing all the initialization, when Ajax request gets called (much) later with an invalidated session, all sorts of NPEs would result. Of course this can be solved with onActivate() or null checks, but usually the best solution is just to redirect to the same page, and 'redraw' the page in a non-ajax way to re-initialize everything. If the page is protected by a login screen, the login screen redirection should result. This is fixed in the FlowLogix library, but I think stock Tapestry needs to incorporate this. FlowLogix @AJAX annotation / supporting code does this currently. On Jan 12, 2013, at 11:10 AM, Howard Lewis Ship wrote: In Tapestry, individual page and component fields, marked with the @Perist or @SessionState annotations, will be stored in the the HttpSession. Tapestry generates a unique session attribute key that identifies the name of the page, nested component id, and field name. If any request, Ajax or otherwise, is received after the session has been invalidated, Tapestry will simply proceed using default (typically, null) values for such fields. In some cases, the page may wish to inject the Request so as to query whether the session is invalidated ... though it may be easier to see if the specific field is null when it is not expected to be. Lance's note about a thread local map is actually a more recent optimization; once you have the basic infrastructure to intercept field access so as to store and retrieve data from the HttpSession, you can do the same trick to separate instances from their state. On Tue, Jan 8, 2013 at 8:54 PM, Shaun Thompson stho...@gmail.comjavascript:_e({}, 'cvml', 'stho...@gmail.com'); wrote: I'm currently evaluating component based frameworks, as we are using Wicket, and one of the problems we encounter is Ajax interactions after the http session has expired. If a user clicks on a component that is Ajax enabled - the framework throws a PageExpiration exception. For most applications, we want the request to still continue. The HelloWorld example from Tapestry doesn't appear to experience this. My questions are - For persistent data on a page where is this serialized to? - Are all Ajax interactions safe in this manner, form buttons, links, etc -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Session Expiration - Ajax
Simple answer to both of your questions - yes. Saying that, There are some things that can be handled better out of the box, Which are actually fixed in the FlowLogix library http://code.google.com/p/flowlogix/wiki/TapestryLibrary On Jan 8, 2013, at 3:38 PM, sthomps stho...@gmail.com wrote: I'm currently evaluating component based frameworks, as we are currently using Wicket, and one of the problems we encounter is Ajax interactions after the http session has expired. If a user clicks on a component that is Ajax enabled - the framework throws a PageExpiration exception. For most applications, we want the request to still continue on as normal. The HelloWorld example from Tapestry doesn't appear to experience this. My questions are - For persistent data on a page where is this serialized to? - Are all Ajax interactions safe in this manner, form buttons, links, etc -- View this message in context: http://tapestry.1045711.n5.nabble.com/Session-Expiration-Ajax-tp5719213.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Session Expiration - Ajax
Short answer: Forms, buttons, links and ajax actions in general do not require the session. You can do whatever you like in your ajax actions which *might* include accessing session state (eg via @Persist). There are a couple of core tapestry components that require the session but it's your choice to use them or not. Long Answer: Unlike wicket, tapestry does not require the session for component rendering. Tapestry pages and components are singletons. Tapestry performs a bit of a magic trick to transform page and component classes such that any request specific variables are written to and read from a thread local map. It's possible to create tapestry apps which never use the session and are able to use the URL to pass any id's etc required to lookup entities from the database etc. When a form is posted, the data used to render the form is serialized to a hidden field which is used to re-hydrate the data when the form is posted. In most cases, only the database id's are used. This recent thread discusses striving for zero session persistence where possible: http://tapestry.1045711.n5.nabble.com/Appropriate-recommended-usage-for-Persist-in-components-td5719116.html -- View this message in context: http://tapestry.1045711.n5.nabble.com/Session-Expiration-Ajax-tp5719213p5719214.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Session storage docs don't mention OptimizedSessionPersistedObject or ImmutableSessionPersistedObject
They are mentioned on this page: http://tapestry.apache.org/persistent-page-data.html -- View this message in context: http://tapestry.1045711.n5.nabble.com/Session-storage-docs-don-t-mention-OptimizedSessionPersistedObject-or-ImmutableSessionPersistedObject-tp5719174p5719178.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Session storage docs don't mention OptimizedSessionPersistedObject or ImmutableSessionPersistedObject
How about if you request write access to the Confluence wiki and update the Session Storage page yourself? On Mon, Jan 7, 2013 at 10:41 AM, Lance Java lance.j...@googlemail.comwrote: I've just noticed that the session storage docs don't mention OptimizedSessionPersistedObject or ImmutableSessionPersistedObject. Should I file a jira for this? Or is this covered elsewhere in the docs? http://tapestry.apache.org/session-storage.html http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/annotations/ImmutableSessionPersistedObject.html http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/OptimizedSessionPersistedObject.html -- View this message in context: http://tapestry.1045711.n5.nabble.com/Session-storage-docs-don-t-mention-OptimizedSessionPersistedObject-or-ImmutableSessionPersistedObject-tp5719174.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com
Re: Session storage docs don't mention OptimizedSessionPersistedObject or ImmutableSessionPersistedObject
Also, you are right, a cross-link to the OptimizedSessionPersistedObject, etc., JavaDoc would be useful. On Tue, Jan 8, 2013 at 12:52 AM, Howard Lewis Ship hls...@gmail.com wrote: How about if you request write access to the Confluence wiki and update the Session Storage page yourself? On Mon, Jan 7, 2013 at 10:41 AM, Lance Java lance.j...@googlemail.comwrote: I've just noticed that the session storage docs don't mention OptimizedSessionPersistedObject or ImmutableSessionPersistedObject. Should I file a jira for this? Or is this covered elsewhere in the docs? http://tapestry.apache.org/session-storage.html http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/annotations/ImmutableSessionPersistedObject.html http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/OptimizedSessionPersistedObject.html -- View this message in context: http://tapestry.1045711.n5.nabble.com/Session-storage-docs-don-t-mention-OptimizedSessionPersistedObject-or-ImmutableSessionPersistedObject-tp5719174.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com
Re: Session Timeout in Tapestry
Session timeout is handled at the servlet level using session-timeout parameter in web.xml On Dec 12, 2012, at 4:03 PM, mateen wrote: How can i set the Session Time out and redirect the user the login page, when a timeout occurs ? I know in JSF i could centrally handle the session state from faces config file. How can i do this in Tapestry ? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Session-Timeout-in-Tapestry-tp5718632.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Session Timeout in Tapestry
On Wed, 12 Dec 2012 08:33:46 -0200, mateen matee...@gmail.com wrote: How can i set the Session Time out and redirect the user the login page, when a timeout occurs ? Setting the session time is a web.xml configuration, completely separated from Tapestry. Redirecting to the login page automatically can be done in a couple different ways. I'd recommend implementing a RequestFilter. I know in JSF i could centrally handle the session state from faces config file. How can i do this in Tapestry ? I guess few people in this mailing list know JSF, so asking how to do something from JSF in Tapestry won't help you get good answers. For example, now, what do you mean by centrally handling the session state? PS: faces-config.xml sucks very hard. -- Thiago H. de Paula Figueiredo - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Session Timeout in Tapestry
Could you show me how to write a request filter in Tapestry -- View this message in context: http://tapestry.1045711.n5.nabble.com/Session-Timeout-in-Tapestry-tp5718632p5718639.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Session Timeout in Tapestry
For an example see http://jumpstart.doublenegative.com.au/jumpstart/examples/infrastructure/protectingpages Cheers, Geoff On 12/12/2012, at 11:01 PM, mateen wrote: Could you show me how to write a request filter in Tapestry -- View this message in context: http://tapestry.1045711.n5.nabble.com/Session-Timeout-in-Tapestry-tp5718632p5718639.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Session timeout alert.
The remaining time is something of a red herring: every client-to-server interaction resets the countdown, so from the perspective of the server processing a request, the remaining time will always be the full session timeout value. (I'm not sure how you pick this up from the container, but no doubt a google search will tell you that.) If you have AJAX components, this time will be somewhat pessimistic because AJAX requests will also reset the countdown. You might ignore this if you don't have a lot of AJAX; to intercept these might require some ugly monkey patching. Michael On 28 March 2012 12:14, George Christman gchrist...@cardaddy.com wrote: Hello, does tapestry provide a mechanism which monitors the amount of time left with a user session before timeout? Similar to a an online banking site, we need to alert the user when their session is about to expire and give them the option to renew the time or auto log them out. If it doesn't exist, I'm sure I could build the component, however I'm just not sure how to get the users remaining session time to trigger the alert. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Session-timeout-alert-tp5601037p5601037.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Session timeout alert.
In addition to the post before: Write a class which implemets javax.servlet.http.HttpSessionListener with something like this: @Override public void sessionCreated(final HttpSessionEvent se) { se.getSession().setMaxInactiveInterval(sessionTimeoutSeconds); } A search in this forum returns much hits. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Session-timeout-alert-tp5601037p5601125.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Session timeout alert.
Thanks guys, I'll take a look at your suggested solutions. I happened to find this jQuery plugin during my google searches that might integrate nicely with this task. http://philpalmieri.com/2009/09/jquery-session-auto-timeout-with-prompt/ -- View this message in context: http://tapestry.1045711.n5.nabble.com/Session-timeout-alert-tp5601037p5601246.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: session scoped services
2012-02-02, John Bush: I have a project where I need some services session scoped, not singletons or perthread. The reason is that I have some web services I use that need some session state for initialization. While the perthread approach works just fine, I don't want to be initializing that stuff with every request. Calling out to wslds and all the xml mumbo jumbo is resource intensive. Maybe it would be better to have the web service handling in a singleton service (and initializes wsld and xml stuff there) which is injected into the thread scoped - this might work as well. In Tapestry you can mix service scopes. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: session scoped services
If you have your service in the session it also means that there is the ioc registry attached to it, it could be a problem when you have a cluster, best practices is to store only serializable objects. Denis Feb 2, 2012 v 9:35 AM, Christian Köberl: 2012-02-02, John Bush: I have a project where I need some services session scoped, not singletons or perthread. The reason is that I have some web services I use that need some session state for initialization. While the perthread approach works just fine, I don't want to be initializing that stuff with every request. Calling out to wslds and all the xml mumbo jumbo is resource intensive. Maybe it would be better to have the web service handling in a singleton service (and initializes wsld and xml stuff there) which is injected into the thread scoped - this might work as well. In Tapestry you can mix service scopes. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: session scoped services
The thing is depending on the user I will be pointing to a different location for the wsdl. I'm creating an app that talks to a bunch of servers in our datacenter. Not sent with my iphone. On Feb 2, 2012 1:36 AM, Christian Köberl tapestry.christian.koeb...@gmail.com wrote: 2012-02-02, John Bush: I have a project where I need some services session scoped, not singletons or perthread. The reason is that I have some web services I use that need some session state for initialization. While the perthread approach works just fine, I don't want to be initializing that stuff with every request. Calling out to wslds and all the xml mumbo jumbo is resource intensive. Maybe it would be better to have the web service handling in a singleton service (and initializes wsld and xml stuff there) which is injected into the thread scoped - this might work as well. In Tapestry you can mix service scopes. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: session scoped services
Hi! On Wed, 01 Feb 2012 21:30:33 -0200, John Bush john.b...@rsmart.com wrote: then you need to use a builder method approach for ioc, b/c the autobinding is not aware of session scoped items, only proper services, at least that what I've seen in practice. Actually, you can defined the scope of an autobound service this way: binder.bind(Service.class, ServiceImpl.class).scope(yourScopeName). -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, 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
Re: Session Time-out
This is fully documented at http://tapestry.apache.org/overriding-exception-reporting.html I would use version 2 or 3 from that page http://tapestry.apache.org/overriding-exception-reporting.htmlregards Taha On Thu, Jun 2, 2011 at 7:19 PM, mwilliam...@kcp.com wrote: I have a problem with Tapestry 5 when the session times out. There is a security policy on my system that requires a session time-out after 30 minutes of non-use. I have a data entry page that can take a long time to complete with many submits. If the session times out and a user then enters more data and tries to submit they get this error. An unexpected application exception has occurred. org.apache.tapestry5.ioc.internal.OperationException Forms require that the request method be POST and that the t:formdata query parameter have values. Now I understand this error but my users will not. Is there a way to catch this exception so I can give them a more informative message. Michael Williamson Analyst Sr Applications Developer Phone: 816/997-5994 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Session Time-out
Also, it's usual in such forms to do a dummy ajax request from javascript every few minutes so that the session is extended On Thu, Jun 2, 2011 at 17:05, Taha Hafeez tawus.tapes...@gmail.com wrote: This is fully documented at http://tapestry.apache.org/overriding-exception-reporting.html I would use version 2 or 3 from that page http://tapestry.apache.org/overriding-exception-reporting.htmlregards Taha On Thu, Jun 2, 2011 at 7:19 PM, mwilliam...@kcp.com wrote: I have a problem with Tapestry 5 when the session times out. There is a security policy on my system that requires a session time-out after 30 minutes of non-use. I have a data entry page that can take a long time to complete with many submits. If the session times out and a user then enters more data and tries to submit they get this error. An unexpected application exception has occurred. org.apache.tapestry5.ioc.internal.OperationException Forms require that the request method be POST and that the t:formdata query parameter have values. Now I understand this error but my users will not. Is there a way to catch this exception so I can give them a more informative message. Michael Williamson Analyst Sr Applications Developer Phone: 816/997-5994 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Andreas Andreou - andy...@apache.org - http://blog.andyhot.gr Apache Tapestry PMC / http://chesstu.be owner Open Source / JEE Consulting - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Session Time-out
Sounds like a good case for a conversational page. Tynamo's tapestry-conversations (http://tynamo.org/tapestry-conversations+guide) allows you to set the max length of a conversation independent of the session timeout and a ajax keep-alive with a drop-in component. Kalle On Thu, Jun 2, 2011 at 7:08 AM, Andreas Andreou andre...@gmail.com wrote: Also, it's usual in such forms to do a dummy ajax request from javascript every few minutes so that the session is extended On Thu, Jun 2, 2011 at 17:05, Taha Hafeez tawus.tapes...@gmail.com wrote: This is fully documented at http://tapestry.apache.org/overriding-exception-reporting.html I would use version 2 or 3 from that page http://tapestry.apache.org/overriding-exception-reporting.htmlregards Taha On Thu, Jun 2, 2011 at 7:19 PM, mwilliam...@kcp.com wrote: I have a problem with Tapestry 5 when the session times out. There is a security policy on my system that requires a session time-out after 30 minutes of non-use. I have a data entry page that can take a long time to complete with many submits. If the session times out and a user then enters more data and tries to submit they get this error. An unexpected application exception has occurred. org.apache.tapestry5.ioc.internal.OperationException Forms require that the request method be POST and that the t:formdata query parameter have values. Now I understand this error but my users will not. Is there a way to catch this exception so I can give them a more informative message. Michael Williamson Analyst Sr Applications Developer Phone: 816/997-5994 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Andreas Andreou - andy...@apache.org - http://blog.andyhot.gr Apache Tapestry PMC / http://chesstu.be owner Open Source / JEE Consulting - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Session State not setting user?
@SessionState/@Property only works in Pages, Components and Mixins. To access session state objects in your services you need to inject the ApplicationStateManager g, kris Von:robnangle robnan...@gmail.com An: users@tapestry.apache.org Datum: 15.03.2011 12:28 Betreff:Session State not setting user? Hi, I am using at session state throughout my application but in one class it does not seem to be setting/getting the user in one class? Any idea's? public class JoinLeague { private Connection conn; private PreparedStatement prep; @Property @SessionState private User user; private PrivateLeague temp; private String user2; private String user3; private String user4; private String user5; private String user6; private String user7; private String user8; private String user9; private String user10; public JoinLeague() throws Exception { createDb(); conn.close(); } public void createDb() throws Exception { Handler handler = new Handler(); conn = handler.getConnection(); prep = handler.getPreparedStatement(); } public void assignUsers() throws Exception { try { createDb(); String statement = select * from private; prep = conn.prepareStatement(statement); ResultSet rs = (ResultSet) prep.executeQuery(); while(rs.next()) { temp = new PrivateLeague(); temp.setMem2(rs.getString(user2)); user2 = temp.getMem2(); temp.setMem3(rs.getString(user3)); user3 = temp.getMem3(); temp.setMem4(rs.getString(user4)); user4 = temp.getMem4(); temp.setMem5(rs.getString(user5)); user5 = temp.getMem5(); temp.setMem6(rs.getString(user6)); user6 = temp.getMem6(); temp.setMem7(rs.getString(user7)); user7 = temp.getMem7(); temp.setMem8(rs.getString(user8)); user8 = temp.getMem8(); temp.setMem9(rs.getString(user9)); user9 = temp.getMem9(); temp.setMem10(rs.getString(user10)); user10 = temp.getMem10(); } conn.close(); } catch (Exception e) { e.printStackTrace(); } } public void updateUsers() throws Exception { createDb(); if(user2 == null) { String statement1 = Update private set user2=?;; prep = conn.prepareStatement(statement1); prep.setString(1, user.getUsername()); prep.executeUpdate(); } else if(user3 == null){ String statement2 = Update private set user3=?;; prep = conn.prepareStatement(statement2); prep.setString(1, user.getUsername()); prep.executeUpdate(); } else if(user4 == null){ String statement3 = Update private set user4=?;; prep = conn.prepareStatement(statement3); prep.setString(1, user.getUsername()); prep.executeUpdate(); }
Re: Session State not setting user?
Cheers.. Is that difficult done? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Session-State-not-setting-user-tp3698456p3699526.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Session State not setting user?
just declare it in your constructor and create your service with tapestry ioc. take a look at the tapestry ioc documentation to see how injection works g, kris Von:robnangle robnan...@gmail.com An: users@tapestry.apache.org Datum: 15.03.2011 12:49 Betreff:Re: Session State not setting user? Cheers.. Is that difficult done? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Session-State-not-setting-user-tp3698456p3699526.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Session State not setting user?
@Inject private ApplicationStateManager stateManager; User user = stateManager.get(User.class); On Tue, 2011-03-15 at 12:54 +0100, Kristian Marinkovic wrote: just declare it in your constructor and create your service with tapestry ioc. take a look at the tapestry ioc documentation to see how injection works g, kris Von:robnangle robnan...@gmail.com An: users@tapestry.apache.org Datum: 15.03.2011 12:49 Betreff:Re: Session State not setting user? Cheers.. Is that difficult done? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Session-State-not-setting-user-tp3698456p3699526.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Session State not setting user?
Can it be used aswel as @SessionState? And in the other class how do i get the user then? Just inject it? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Session-State-not-setting-user-tp3698456p3701009.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: session id
Any idea on how to prevent these session ids from being part of the links created in this manner? You'll get a session id if you try to persist anything into the session, for instance if you use @ApplicationState as a page securing mechanisms might do. Tapestry calls encodeRedirectURL when you get the url out of the Link, if your application container uses url rewriting then it will append the jsessionid if the app server hasn't seen that cookies work. You could configure your app server to not do url rewriting, which may lead to things not working for users that don't want your cookies. or You could write a PageRenderLinkTransformer which returns a StatelessLink (copy LinkImpl and rename it) which never calls the encodeRedirectURL.. or something else that isn't fresh off the top of my head! Good luck! Josh On Fri, Feb 25, 2011 at 1:24 PM, Mark mark-li...@xeric.net wrote: I am using: Link link = pageRenderLinkSource.createPageRenderLinkWithContext(PageName, pageContext); To get a link to a page with a particular context that ties into a Facebook share component. This has worked well, but now I'm occasionally seeing it rendered with a jsessionid. Which of course I do not want in order to share it on facebook. It appears that that jsessionid started showing up once I started securing certain pages of the application, but I'm not sure if that is what is causing it. Any idea on how to prevent these session ids from being part of the links created in this manner? Mark - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: session id
Ah ok. That explains why I see it sometimes and not others. This is what I ended up doing: Link link = pageRenderLinkSource.createPageRenderLinkWithContext(page, context); link.removeParameter(jsessionid); return link; Any problems with that? Mark On Fri, Feb 25, 2011 at 4:28 PM, Josh Canfield joshcanfi...@gmail.com wrote: Any idea on how to prevent these session ids from being part of the links created in this manner? You'll get a session id if you try to persist anything into the session, for instance if you use @ApplicationState as a page securing mechanisms might do. Tapestry calls encodeRedirectURL when you get the url out of the Link, if your application container uses url rewriting then it will append the jsessionid if the app server hasn't seen that cookies work. You could configure your app server to not do url rewriting, which may lead to things not working for users that don't want your cookies. or You could write a PageRenderLinkTransformer which returns a StatelessLink (copy LinkImpl and rename it) which never calls the encodeRedirectURL.. or something else that isn't fresh off the top of my head! Good luck! Josh On Fri, Feb 25, 2011 at 1:24 PM, Mark mark-li...@xeric.net wrote: I am using: Link link = pageRenderLinkSource.createPageRenderLinkWithContext(PageName, pageContext); To get a link to a page with a particular context that ties into a Facebook share component. This has worked well, but now I'm occasionally seeing it rendered with a jsessionid. Which of course I do not want in order to share it on facebook. It appears that that jsessionid started showing up once I started securing certain pages of the application, but I'm not sure if that is what is causing it. Any idea on how to prevent these session ids from being part of the links created in this manner? Mark - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: session id
On Fri, 25 Feb 2011 20:36:55 -0300, Mark mark-li...@xeric.net wrote: Ah ok. That explains why I see it sometimes and not others. This is what I ended up doing: Link link = pageRenderLinkSource.createPageRenderLinkWithContext(page, context); link.removeParameter(jsessionid); return link; Any problems with that? It won't work, as the jsessionid is not a query parameter. Invoke one of the to*URI() methods and remove the jsessionid. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, 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
Re: session id
It won't work, as the jsessionid is not a query parameter. By that Thiago means that it's not a query parameter managed by the Link, so you can't remove it. The jsessionid query parameter is added by the servlet container when you call to*URI. Josh On Fri, Feb 25, 2011 at 3:43 PM, Thiago H. de Paula Figueiredo thiag...@gmail.com wrote: On Fri, 25 Feb 2011 20:36:55 -0300, Mark mark-li...@xeric.net wrote: Ah ok. That explains why I see it sometimes and not others. This is what I ended up doing: Link link = pageRenderLinkSource.createPageRenderLinkWithContext(page, context); link.removeParameter(jsessionid); return link; Any problems with that? It won't work, as the jsessionid is not a query parameter. Invoke one of the to*URI() methods and remove the jsessionid. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, 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 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: session is NULL
@Inject is for pages. Make your DAO a Tapestry service and inject the session to it via its constructor. Kalle I guess not... Since the DAO is a service, you can either @Inject fields, pass thru construtuctor call or build them. ___ Everton Agner Ramos 2010/11/10 Anas Mughal anasmug...@yahoo.com Yes, that worked. I wish to thank everyone for their help! Tapestry is great! Coming from the Spring world, I do not miss those verbose Spring configuration files! --Anas Mughal http://anas-mughal.com --- On Wed, 11/10/10, Rich M rich...@moremagic.com wrote: From: Rich M rich...@moremagic.com Subject: Re: session is NULL To: Tapestry users users@tapestry.apache.org Date: Wednesday, November 10, 2010, 10:34 AM On 11/10/2010 03:42 AM, Anas Mughal wrote: I have setup my DAO as a Tapestry service in the AppModule as: public class AppModule { public static void bind(ServiceBinder binder) { binder.bind(BranchDAO.class, BranchHibernateDAO.class); } } Then, I try to inject the session as follows: public class BranchHibernateDAO implements BranchDAO { @Inject private Session session; @SuppressWarnings(unchecked) public Object find( Class c , BigDecimal id) { return session.get(c, id); } } I still get a NULL session. Following the suggestion by Kalle, I injected the session to a page. Then, passed the session to my DAO in the contructor. That worked! However, I would rather keep the code cleaner by injecting the session directly into the DAO. To use the DAO, you will want the following setup. public class BranchHibernateDAO implements BranchDAO { private Session session; public BranchHibernateDAO(Session session){ this.session = session; } ... } then in your page class: @Inject private BranchHibernateDAO bhdao; You do not need to initialize the BranchHibernateDAO yourself. Tapestry-IoC will initialize the BranchHibernateDAO lazily behind the scenes the first time you access it in the web application. In this case, that would be when you navigate to the page relating to your page class, where the DAO is injected. The convention for services, is that when they are setup in the bind method of the AppModule (or whatever your module is called), Tapestry will inject the appropriate objects to its constructor when it initializes the service. This convention will keep your page classes cleaner. Any suggestion would be greatly appreciated. --- On Wed, 11/10/10, Kalle Korhonenkalle.o.korho...@gmail.com wrote: From: Kalle Korhonenkalle.o.korho...@gmail.com Subject: Re: session is NULL To: Tapestry usersusers@tapestry.apache.org Date: Wednesday, November 10, 2010, 1:48 AM @Inject is for pages. Make your DAO a Tapestry service and inject the session to it via its constructor. Kalle On Tue, Nov 9, 2010 at 9:52 PM, Anas Mughalanasmug...@yahoo.com wrote: I have setup my Tapestry project using the Maven archetype. Then, I setup my hibernate.cfg.xml file with references to my hibernate mapping files. (I am not using annotations for hibernate.) Now, I have setup a simple DAO object to try to retrieve an object from the database: public class BranchDAO { @Inject private Session session; @SuppressWarnings(unchecked) public Object find( Class c , BigDecimal id) { return session.get(c, id); // session is NULL here } } I get a NULL pointer exception because my session does not seem to be initialized. Searching online, I came accross: http://wiki.apache.org/tapestry/SessionPagePersistence I have not setup any hivemind configuration or any of the suggested classes on that wiki page. Please advise me what do I need to be able to fetch objects using Tapestry-Hibernate. I don't know where to place the hivemind configuration file -- if I need it. I am new to Tapestry. Please bear with me. Thank you for your kind assistance. --Anas Mughal http://anas-mughal.com - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: session is NULL
I initially had a constructor that accepted a session. That worked fine. Then, I took out the constructor and simply injected the session. That is working fine as well. Now, I am injecting my delegate as service into my page. The DAO is injected to my delegate. Then, the session is injected into my DAO. That is working well for me. (No constructors.) Best Regards. --Anas Mughal http://anas-mughal.com --- On Thu, 11/11/10, Everton Agner ton.ag...@gmail.com wrote: From: Everton Agner ton.ag...@gmail.com Subject: Re: session is NULL To: Tapestry users users@tapestry.apache.org Date: Thursday, November 11, 2010, 8:23 AM @Inject is for pages. Make your DAO a Tapestry service and inject the session to it via its constructor. Kalle I guess not... Since the DAO is a service, you can either @Inject fields, pass thru construtuctor call or build them. ___ Everton Agner Ramos 2010/11/10 Anas Mughal anasmug...@yahoo.com Yes, that worked. I wish to thank everyone for their help! Tapestry is great! Coming from the Spring world, I do not miss those verbose Spring configuration files! --Anas Mughal http://anas-mughal.com --- On Wed, 11/10/10, Rich M rich...@moremagic.com wrote: From: Rich M rich...@moremagic.com Subject: Re: session is NULL To: Tapestry users users@tapestry.apache.org Date: Wednesday, November 10, 2010, 10:34 AM On 11/10/2010 03:42 AM, Anas Mughal wrote: I have setup my DAO as a Tapestry service in the AppModule as: public class AppModule { public static void bind(ServiceBinder binder) { binder.bind(BranchDAO.class, BranchHibernateDAO.class); } } Then, I try to inject the session as follows: public class BranchHibernateDAO implements BranchDAO { �...@inject private Session session; @SuppressWarnings(unchecked) public Object find( Class c , BigDecimal id) { return session.get(c, id); } } I still get a NULL session. Following the suggestion by Kalle, I injected the session to a page. Then, passed the session to my DAO in the contructor. That worked! However, I would rather keep the code cleaner by injecting the session directly into the DAO. To use the DAO, you will want the following setup. public class BranchHibernateDAO implements BranchDAO { private Session session; public BranchHibernateDAO(Session session){ this.session = session; } ... } then in your page class: @Inject private BranchHibernateDAO bhdao; You do not need to initialize the BranchHibernateDAO yourself. Tapestry-IoC will initialize the BranchHibernateDAO lazily behind the scenes the first time you access it in the web application. In this case, that would be when you navigate to the page relating to your page class, where the DAO is injected. The convention for services, is that when they are setup in the bind method of the AppModule (or whatever your module is called), Tapestry will inject the appropriate objects to its constructor when it initializes the service. This convention will keep your page classes cleaner. Any suggestion would be greatly appreciated. --- On Wed, 11/10/10, Kalle Korhonenkalle.o.korho...@gmail.com wrote: From: Kalle Korhonenkalle.o.korho...@gmail.com Subject: Re: session is NULL To: Tapestry usersusers@tapestry.apache.org Date: Wednesday, November 10, 2010, 1:48 AM @Inject is for pages. Make your DAO a Tapestry service and inject the session to it via its constructor. Kalle On Tue, Nov 9, 2010 at 9:52 PM, Anas Mughalanasmug...@yahoo.com wrote: I have setup my Tapestry project using the Maven archetype. Then, I setup my hibernate.cfg.xml file with references to my hibernate mapping files. (I am not using annotations for hibernate.) Now, I have setup a simple DAO object to try to retrieve an object from the database: public class BranchDAO { @Inject private Session session; @SuppressWarnings(unchecked) public Object find( Class c , BigDecimal id) { return session.get(c, id); // session is NULL here } } I get a NULL pointer exception because my session does not seem to be initialized. Searching online, I came accross: http://wiki.apache.org/tapestry/SessionPagePersistence I have not setup any hivemind configuration or any of the suggested classes on that wiki page. Please advise me what do I need to be able to fetch objects using Tapestry-Hibernate. I don't know where to place the hivemind configuration file -- if I need it. I am new to Tapestry. Please bear with me. Thank you for your kind assistance. --Anas Mughal http://anas-mughal.com - To unsubscribe, e-mail: users-unsubscr
Re: session is NULL
I have setup my DAO as a Tapestry service in the AppModule as: public class AppModule { public static void bind(ServiceBinder binder) { binder.bind(BranchDAO.class, BranchHibernateDAO.class); } } Then, I try to inject the session as follows: public class BranchHibernateDAO implements BranchDAO { @Inject private Session session; �...@suppresswarnings(unchecked) public Object find( Class c , BigDecimal id) { return session.get(c, id); } } I still get a NULL session. Following the suggestion by Kalle, I injected the session to a page. Then, passed the session to my DAO in the contructor. That worked! However, I would rather keep the code cleaner by injecting the session directly into the DAO. Any suggestion would be greatly appreciated. --- On Wed, 11/10/10, Kalle Korhonen kalle.o.korho...@gmail.com wrote: From: Kalle Korhonen kalle.o.korho...@gmail.com Subject: Re: session is NULL To: Tapestry users users@tapestry.apache.org Date: Wednesday, November 10, 2010, 1:48 AM @Inject is for pages. Make your DAO a Tapestry service and inject the session to it via its constructor. Kalle On Tue, Nov 9, 2010 at 9:52 PM, Anas Mughal anasmug...@yahoo.com wrote: I have setup my Tapestry project using the Maven archetype. Then, I setup my hibernate.cfg.xml file with references to my hibernate mapping files. (I am not using annotations for hibernate.) Now, I have setup a simple DAO object to try to retrieve an object from the database: public class BranchDAO { @Inject private Session session; @SuppressWarnings(unchecked) public Object find( Class c , BigDecimal id) { return session.get(c, id); // session is NULL here } } I get a NULL pointer exception because my session does not seem to be initialized. Searching online, I came accross: http://wiki.apache.org/tapestry/SessionPagePersistence I have not setup any hivemind configuration or any of the suggested classes on that wiki page. Please advise me what do I need to be able to fetch objects using Tapestry-Hibernate. I don't know where to place the hivemind configuration file -- if I need it. I am new to Tapestry. Please bear with me. Thank you for your kind assistance. --Anas Mughal http://anas-mughal.com - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: session is NULL
Kindly visit my post. http://tapestry.1045711.n5.nabble.com/T5-Working-Tapestry-Hibernate-with-DAO-td3229905.html#a3229905 http://tapestry.1045711.n5.nabble.com/T5-Working-Tapestry-Hibernate-with-DAO-td3229905.html#a3229905 -- View this message in context: http://tapestry.1045711.n5.nabble.com/session-is-NULL-tp3258165p3258344.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: session is NULL
On Wed, Nov 10, 2010 at 9:42 AM, Anas Mughal anasmug...@yahoo.com wrote: I have setup my DAO as a Tapestry service in the AppModule as: [...] Then, I try to inject the session as follows: public class BranchHibernateDAO implements BranchDAO { @Inject private Session session; @SuppressWarnings(unchecked) public Object find( Class c , BigDecimal id) { return session.get(c, id); } } I still get a NULL session. Following the suggestion by Kalle, I injected the session to a page. Then, passed the session to my DAO in the contructor. That worked! However, I would rather keep the code cleaner by injecting the session directly into the DAO. Any suggestion would be greatly appreciated. How do you access an instance of BranchHibernateDAO? I suspect that you might create it using 'new'. That is not correct. Use Tapestry injections instead, e.g. in your page or component: @Inject private BranchDAO dao; Regards, Cezary
Re: session is NULL
On 11/10/2010 03:42 AM, Anas Mughal wrote: I have setup my DAO as a Tapestry service in the AppModule as: public class AppModule { public static void bind(ServiceBinder binder) { binder.bind(BranchDAO.class, BranchHibernateDAO.class); } } Then, I try to inject the session as follows: public class BranchHibernateDAO implements BranchDAO { @Inject private Session session; @SuppressWarnings(unchecked) public Object find( Class c , BigDecimal id) { return session.get(c, id); } } I still get a NULL session. Following the suggestion by Kalle, I injected the session to a page. Then, passed the session to my DAO in the contructor. That worked! However, I would rather keep the code cleaner by injecting the session directly into the DAO. To use the DAO, you will want the following setup. public class BranchHibernateDAO implements BranchDAO { private Session session; public BranchHibernateDAO(Session session){ this.session = session; } ... } then in your page class: @Inject private BranchHibernateDAO bhdao; You do not need to initialize the BranchHibernateDAO yourself. Tapestry-IoC will initialize the BranchHibernateDAO lazily behind the scenes the first time you access it in the web application. In this case, that would be when you navigate to the page relating to your page class, where the DAO is injected. The convention for services, is that when they are setup in the bind method of the AppModule (or whatever your module is called), Tapestry will inject the appropriate objects to its constructor when it initializes the service. This convention will keep your page classes cleaner. Any suggestion would be greatly appreciated. --- On Wed, 11/10/10, Kalle Korhonenkalle.o.korho...@gmail.com wrote: From: Kalle Korhonenkalle.o.korho...@gmail.com Subject: Re: session is NULL To: Tapestry usersusers@tapestry.apache.org Date: Wednesday, November 10, 2010, 1:48 AM @Inject is for pages. Make your DAO a Tapestry service and inject the session to it via its constructor. Kalle On Tue, Nov 9, 2010 at 9:52 PM, Anas Mughalanasmug...@yahoo.com wrote: I have setup my Tapestry project using the Maven archetype. Then, I setup my hibernate.cfg.xml file with references to my hibernate mapping files. (I am not using annotations for hibernate.) Now, I have setup a simple DAO object to try to retrieve an object from the database: public class BranchDAO { @Inject private Session session; @SuppressWarnings(unchecked) public Object find( Class c , BigDecimal id) { return session.get(c, id); // session is NULL here } } I get a NULL pointer exception because my session does not seem to be initialized. Searching online, I came accross: http://wiki.apache.org/tapestry/SessionPagePersistence I have not setup any hivemind configuration or any of the suggested classes on that wiki page. Please advise me what do I need to be able to fetch objects using Tapestry-Hibernate. I don't know where to place the hivemind configuration file -- if I need it. I am new to Tapestry. Please bear with me. Thank you for your kind assistance. --Anas Mughal http://anas-mughal.com - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: session is NULL
Yes, that worked. I wish to thank everyone for their help! Tapestry is great! Coming from the Spring world, I do not miss those verbose Spring configuration files! --Anas Mughal http://anas-mughal.com --- On Wed, 11/10/10, Rich M rich...@moremagic.com wrote: From: Rich M rich...@moremagic.com Subject: Re: session is NULL To: Tapestry users users@tapestry.apache.org Date: Wednesday, November 10, 2010, 10:34 AM On 11/10/2010 03:42 AM, Anas Mughal wrote: I have setup my DAO as a Tapestry service in the AppModule as: public class AppModule { public static void bind(ServiceBinder binder) { binder.bind(BranchDAO.class, BranchHibernateDAO.class); } } Then, I try to inject the session as follows: public class BranchHibernateDAO implements BranchDAO { �...@inject private Session session; @SuppressWarnings(unchecked) public Object find( Class c , BigDecimal id) { return session.get(c, id); } } I still get a NULL session. Following the suggestion by Kalle, I injected the session to a page. Then, passed the session to my DAO in the contructor. That worked! However, I would rather keep the code cleaner by injecting the session directly into the DAO. To use the DAO, you will want the following setup. public class BranchHibernateDAO implements BranchDAO { private Session session; public BranchHibernateDAO(Session session){ this.session = session; } ... } then in your page class: @Inject private BranchHibernateDAO bhdao; You do not need to initialize the BranchHibernateDAO yourself. Tapestry-IoC will initialize the BranchHibernateDAO lazily behind the scenes the first time you access it in the web application. In this case, that would be when you navigate to the page relating to your page class, where the DAO is injected. The convention for services, is that when they are setup in the bind method of the AppModule (or whatever your module is called), Tapestry will inject the appropriate objects to its constructor when it initializes the service. This convention will keep your page classes cleaner. Any suggestion would be greatly appreciated. --- On Wed, 11/10/10, Kalle Korhonenkalle.o.korho...@gmail.com wrote: From: Kalle Korhonenkalle.o.korho...@gmail.com Subject: Re: session is NULL To: Tapestry usersusers@tapestry.apache.org Date: Wednesday, November 10, 2010, 1:48 AM @Inject is for pages. Make your DAO a Tapestry service and inject the session to it via its constructor. Kalle On Tue, Nov 9, 2010 at 9:52 PM, Anas Mughalanasmug...@yahoo.com wrote: I have setup my Tapestry project using the Maven archetype. Then, I setup my hibernate.cfg.xml file with references to my hibernate mapping files. (I am not using annotations for hibernate.) Now, I have setup a simple DAO object to try to retrieve an object from the database: public class BranchDAO { @Inject private Session session; @SuppressWarnings(unchecked) public Object find( Class c , BigDecimal id) { return session.get(c, id); // session is NULL here } } I get a NULL pointer exception because my session does not seem to be initialized. Searching online, I came accross: http://wiki.apache.org/tapestry/SessionPagePersistence I have not setup any hivemind configuration or any of the suggested classes on that wiki page. Please advise me what do I need to be able to fetch objects using Tapestry-Hibernate. I don't know where to place the hivemind configuration file -- if I need it. I am new to Tapestry. Please bear with me. Thank you for your kind assistance. --Anas Mughal http://anas-mughal.com - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: session is NULL
Hi Anas; Have you added the tapestry-hibernate dependency on your pom.xml? On Wed, Nov 10, 2010 at 12:52 AM, Anas Mughal anasmug...@yahoo.com wrote: I have setup my Tapestry project using the Maven archetype. Then, I setup my hibernate.cfg.xml file with references to my hibernate mapping files. (I am not using annotations for hibernate.) Now, I have setup a simple DAO object to try to retrieve an object from the database: public class BranchDAO { @Inject private Session session; @SuppressWarnings(unchecked) public Object find( Class c , BigDecimal id) { return session.get(c, id); // session is NULL here } } I get a NULL pointer exception because my session does not seem to be initialized. Searching online, I came accross: http://wiki.apache.org/tapestry/SessionPagePersistence I have not setup any hivemind configuration or any of the suggested classes on that wiki page. Please advise me what do I need to be able to fetch objects using Tapestry-Hibernate. I don't know where to place the hivemind configuration file -- if I need it. I am new to Tapestry. Please bear with me. Thank you for your kind assistance. --Anas Mughal http://anas-mughal.com
Re: session is NULL
Yes, tapestry-hibernate dependency is added: dependency groupIdorg.apache.tapestry/groupId artifactIdtapestry-hibernate/artifactId version5.2.2/version /dependency And, it is being resolved and included successfully in the project. The hibernate configuration seems to be picked up properly as well. (There was a problem with the path to the mapping files. After fixing it, now there is no error with respect to the hibernate configuration.) I don't know how to resolve the session object being NULL in my simple DAO below. Thanks for your help! -- Anas Mughal http://anas-mughal.com --- On Wed, 11/10/10, Josh Kamau joshnet2...@gmail.com wrote: From: Josh Kamau joshnet2...@gmail.com Subject: Re: session is NULL To: Tapestry users users@tapestry.apache.org Date: Wednesday, November 10, 2010, 1:04 AM Hi Anas; Have you added the tapestry-hibernate dependency on your pom.xml? On Wed, Nov 10, 2010 at 12:52 AM, Anas Mughal anasmug...@yahoo.com wrote: I have setup my Tapestry project using the Maven archetype. Then, I setup my hibernate.cfg.xml file with references to my hibernate mapping files. (I am not using annotations for hibernate.) Now, I have setup a simple DAO object to try to retrieve an object from the database: public class BranchDAO { �...@inject private Session session; �...@suppresswarnings(unchecked) public Object find( Class c , BigDecimal id) { return session.get(c, id); // session is NULL here } } I get a NULL pointer exception because my session does not seem to be initialized. Searching online, I came accross: http://wiki.apache.org/tapestry/SessionPagePersistence I have not setup any hivemind configuration or any of the suggested classes on that wiki page. Please advise me what do I need to be able to fetch objects using Tapestry-Hibernate. I don't know where to place the hivemind configuration file -- if I need it. I am new to Tapestry. Please bear with me. Thank you for your kind assistance. --Anas Mughal http://anas-mughal.com
Re: session is NULL
Anas, Your Dao must be a service managed by tapestry for it to benefit from the injection of the rest of tapestry services. To ensure that , make sure you bind it in the application module. If you used the archetype to generate the application, then there is module class in the services directory. The class is well commented with an example on how to bind a service Something like bind(MyDaoInterface.class , MyDaoInterfaceImplementation.class); regards. On Wed, Nov 10, 2010 at 1:40 AM, Anas Mughal anasmug...@yahoo.com wrote: Yes, tapestry-hibernate dependency is added: dependency groupIdorg.apache.tapestry/groupId artifactIdtapestry-hibernate/artifactId version5.2.2/version /dependency And, it is being resolved and included successfully in the project. The hibernate configuration seems to be picked up properly as well. (There was a problem with the path to the mapping files. After fixing it, now there is no error with respect to the hibernate configuration.) I don't know how to resolve the session object being NULL in my simple DAO below. Thanks for your help! -- Anas Mughal http://anas-mughal.com --- On Wed, 11/10/10, Josh Kamau joshnet2...@gmail.com wrote: From: Josh Kamau joshnet2...@gmail.com Subject: Re: session is NULL To: Tapestry users users@tapestry.apache.org Date: Wednesday, November 10, 2010, 1:04 AM Hi Anas; Have you added the tapestry-hibernate dependency on your pom.xml? On Wed, Nov 10, 2010 at 12:52 AM, Anas Mughal anasmug...@yahoo.com wrote: I have setup my Tapestry project using the Maven archetype. Then, I setup my hibernate.cfg.xml file with references to my hibernate mapping files. (I am not using annotations for hibernate.) Now, I have setup a simple DAO object to try to retrieve an object from the database: public class BranchDAO { @Inject private Session session; @SuppressWarnings(unchecked) public Object find( Class c , BigDecimal id) { return session.get(c, id); // session is NULL here } } I get a NULL pointer exception because my session does not seem to be initialized. Searching online, I came accross: http://wiki.apache.org/tapestry/SessionPagePersistence I have not setup any hivemind configuration or any of the suggested classes on that wiki page. Please advise me what do I need to be able to fetch objects using Tapestry-Hibernate. I don't know where to place the hivemind configuration file -- if I need it. I am new to Tapestry. Please bear with me. Thank you for your kind assistance. --Anas Mughal http://anas-mughal.com
Re: session is NULL
@Inject is for pages. Make your DAO a Tapestry service and inject the session to it via its constructor. Kalle On Tue, Nov 9, 2010 at 9:52 PM, Anas Mughal anasmug...@yahoo.com wrote: I have setup my Tapestry project using the Maven archetype. Then, I setup my hibernate.cfg.xml file with references to my hibernate mapping files. (I am not using annotations for hibernate.) Now, I have setup a simple DAO object to try to retrieve an object from the database: public class BranchDAO { @Inject private Session session; @SuppressWarnings(unchecked) public Object find( Class c , BigDecimal id) { return session.get(c, id); // session is NULL here } } I get a NULL pointer exception because my session does not seem to be initialized. Searching online, I came accross: http://wiki.apache.org/tapestry/SessionPagePersistence I have not setup any hivemind configuration or any of the suggested classes on that wiki page. Please advise me what do I need to be able to fetch objects using Tapestry-Hibernate. I don't know where to place the hivemind configuration file -- if I need it. I am new to Tapestry. Please bear with me. Thank you for your kind assistance. --Anas Mughal http://anas-mughal.com - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Session concurrency
On Mon, 01 Nov 2010 11:43:28 -0200, Paulo Andrade p...@mega.ist.utl.pt wrote: Hello, Hi! Sorry if this an easy question, It isn't. Actually, it's not even a Tapestry-only problem, but of stateful web applications too. but I'm new to tapestry and couldn't quite figure out how does tapestry handle sessions. Tapestry just delegates to an HttpSession. If two request for the same session arrive simultaneously, will the session object be accessed concurrently in two threads? Yes, as in (almost) any other Java web app. Take the following code: __ @SessionState Foo someSessionObject; bool someSessionObjectExists; if( !someSessionObjectExists ){ someSessionObject = getSomeSessionObject(); } You can use @SessionState(create = null) and check if someSessionObject is null directly. If two request with the same session execute that if statement the getSomeSessionObject() might be called twice and thus creating two objects. Yes, but only one will be used, as both will be mapped to the same session attribute name. Coming form WebObjects I usually don't have to worry about this because I know that two threads are never accessing the same Session object simultaneously. All session access is serialized. So how does this work with tapestry? Tapestry nor the Servlet API synchronize access to the session. PS: I'm playing with Tapestry 5.2. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. Consultor, desenvolvedor e instrutor em Java, Tapestry e Hibernate Coordenador e professor da Especialização em Engenharia de Software com Ênfase em Java da Faculdade Pitágoras http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: session share problem in multiple-tab browser
really cool,I find out tapestry-conversation component:http://tynamo.org/tapestry-conversations+guide here is its announcement:http://tapestry-users.832.n2.nabble.com/ANNOUNCEMENT-New-releases-of-conversations-and-hibernate-seedentity-modules-td4738484.html#a4738484 On Tue, Aug 10, 2010 at 2:59 PM, cleverpig greatclever...@gmail.com wrote: Hi,dear all! I sometime use @Persist annotation to make object store in session. such as: public class PageNav2 { �...@persist(session) �...@property private Paging paging; �...@setuprender void onLoad(){ if (paging==null) paging = new Paging(); } ... } In modern browsers,multiple page tab is very popular. In firefox or google chrome,if I opened one page with some object saved in session,and then open the same page in new page tab. The object which I created in first time would be shared to second page. When we use tapestry at e-business or e-commerce application,there will raising problem with re-submit or breaking data consistency. Because client can visit same object of session to modify its status in many time via multiple page tab. Which kind of method can fix it? Change to give up session at this occasion,instead of using form-post necessary data? Or we have a way like Jboss Seam's conversation to manage session? -- cleverpig(Dan) Location: Beijing Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China Zipcode: 100031 MSN: great_liu...@hotmail.com QQ: 149291732 Skype: cleverpigatmatrix Facebook ID:cleverpig Blog: cleverpig.name/dan/ Tags: del.icio.us/cleverpig Twitter: twitter.com/cleverpig 新浪微博: t.sina.com.cn/cleverpig Organization: www.beijing-open-party.org or...@facebook: http://www.facebook.com/group.php?gid=8159558294 -- cleverpig(Dan) Location: Beijing Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China Zipcode: 100031 MSN: great_liu...@hotmail.com QQ: 149291732 Skype: cleverpigatmatrix Facebook ID:cleverpig Blog: cleverpig.name/dan/ Tags: del.icio.us/cleverpig Twitter: twitter.com/cleverpig 新浪微博: t.sina.com.cn/cleverpig Organization: www.beijing-open-party.org or...@facebook: http://www.facebook.com/group.php?gid=8159558294 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: session expired error
it took me some time to realize you're using Tapestry 4 please add the version number next time. there are basically two simple ways to influence the session expiration: 1) change the timeout in your web.xml session-config session-timeout10/session-timeout /session-config 2) create a component, that is placed on every page that performs some ajax requests to a hidden page to keep the session active. as long as the browser is open the session wont expire. g, kris Von:asianCoolz second_co...@yahoo.com An: users@tapestry.apache.org Datum: 23.04.2010 03:40 Betreff:session expired error Is below error caused by session expired http://utilitybase.com/paste/29788 if yes, how to extend the tapestry user session? or better way to resolve this? - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Session State Object Creating Itself
Never mind. One onActivate was canceling out the other. I should probably stop coding and go to bed. :) Mark On Sep 16, 2009, at 10:25 PM, Mark W. Shead wrote: I have an abstract class that is extended by pages that require a login. This seems to work except for on the page where I actually manage the users. It appears that the session state object is creating itself. There is a user session state object. If someone tries to go to an authenticated page, userExists is checked. If it is false then the browser is redirected to the login page. It appears that the user session state object is being created on its own somehow which lets you access the page without logging in. The properties of this phantom user object are all set to ApplicationStateManager. (For example user.username is set to ApplicationStateManager.) Is this a bug or am I misunderstanding how things work? It seems to work fine on other pages that don't deal with user management. Am I somehow creating the session state object using some sort of convention I'm unaware of? Mark public class AbstractAuthenticatedPage { @Inject private Logger _logger; @Property @SessionState private User user; private boolean userExists; @InjectPage private Login loginPage; Object onActivate() { if(!userExists) { _logger.debug(User does not exist, sending to login page); loginPage.setNext(this.getClass()); return loginPage; } return null; } } public class ManageUsers extends AbstractAuthenticatedPage{ @Inject private IDataSource ds; @Property private User aUser; @Persist(flash) @Property private User newUser; public Object onActivate() { newUser = new User(); return null; } public ListUser getAllUsers() { return ds.getAllUsers(); } public void onSuccessFromNewUserForm() { ds.addUser(newUser); newUser = new User(); } public void onActionFromRemoveUser(String userName) { ds.deleteUser(userName); } } - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Session lost when cookies disabled?
Sorry, I was wrong. In my case the problem was that redirectTo url was created before session. And thus before putting jsessionid in url. So the login was working fine - it was appending jsessionid to the url and then my code was redirecting to the old redirectTo url without jsessionid. On Mon, Jul 27, 2009 at 9:52 AM, Sergey Didenko sergey.dide...@gmail.comwrote: I have the same bug. I tried to catch it. It seems that ApplicationStateManager does not trigger url based session tracking when setting a session object from a service. But it works ok if there a write to session from a component. I will create a JIRA if there is no objections. Regards, Sergey.
Re: Session creation
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-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Session creation
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-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Session creation
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-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Session creation
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-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Session creation
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-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Session creation
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-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Session creation
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-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Session creation
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 thiag...@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-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Andreas Andreou - andy...@apache.org - http://blog.andyhot.gr Tapestry / Tacos developer Open Source / JEE Consulting - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Session bleedings in Tapestry5
Hello namesake, Since I've never heared about this too, I searched the Mailing List and JIRA and didn't find any issue which you could've meant. Where did you hear that? - Tobias [EMAIL PROTECTED] schrieb: I have heard there are some issues with Session bleedings in Tapestry5. Will those issues be fixed by November? I would like to go live with a T5 application by November/December Thanks! Tobias - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Session bleedings in Tapestry5
I have never come across such a problem either, and we have done a lot of testing for this. Your problem sounds like it has little to do with the session and more to do with page pooling, i.e.: how you initialize your pages. The golden rule there is that your fields must always be private, and then should be referenced by public accessors, having a public field in a page is like using a static variable which may explain your problem. -- 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: [EMAIL PROTECTED] To: users@tapestry.apache.org Sent: Monday, 20 October, 2008 2:53:17 PM GMT +02:00 Athens, Beirut, Bucharest, Istanbul Subject: Re: Session bleedings in Tapestry5 I quote from a chat protocol with a developer: Take for eg, if there are 10 users at present using our website, then first user clicks on 1st page, and 5th user clicks on 2nd page, and 3 rd person clicks on 3 page and using it. And if the user 1 is clcked on 8 page at that time user 3 want to goto another page say 5, then he also gets 8 instead of 5. As first user requested that page. :( Original-Nachricht Datum: Mon, 20 Oct 2008 13:32:16 +0200 Von: Tobias Wehrum [EMAIL PROTECTED] An: Tapestry users users@tapestry.apache.org Betreff: Re: Session bleedings in Tapestry5 Hello namesake, Since I've never heared about this too, I searched the Mailing List and JIRA and didn't find any issue which you could've meant. Where did you hear that? - Tobias [EMAIL PROTECTED] schrieb: I have heard there are some issues with Session bleedings in Tapestry5. Will those issues be fixed by November? I would like to go live with a T5 application by November/December Thanks! Tobias - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Session bleedings in Tapestry5
I've also never come across this kind of problem. It would be interesting to see the code that caused what the developer said was happening. As others have suggested, it's easy to do this if you are using statics (or if your private vars get initialized by statics in the setup phase). On Mon, Oct 20, 2008 at 8:41 AM, Peter Stavrinides [EMAIL PROTECTED] wrote: I have never come across such a problem either, and we have done a lot of testing for this. Your problem sounds like it has little to do with the session and more to do with page pooling, i.e.: how you initialize your pages. The golden rule there is that your fields must always be private, and then should be referenced by public accessors, having a public field in a page is like using a static variable which may explain your problem. -- 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: [EMAIL PROTECTED] To: users@tapestry.apache.org Sent: Monday, 20 October, 2008 2:53:17 PM GMT +02:00 Athens, Beirut, Bucharest, Istanbul Subject: Re: Session bleedings in Tapestry5 I quote from a chat protocol with a developer: Take for eg, if there are 10 users at present using our website, then first user clicks on 1st page, and 5th user clicks on 2nd page, and 3 rd person clicks on 3 page and using it. And if the user 1 is clcked on 8 page at that time user 3 want to goto another page say 5, then he also gets 8 instead of 5. As first user requested that page. :( Original-Nachricht Datum: Mon, 20 Oct 2008 13:32:16 +0200 Von: Tobias Wehrum [EMAIL PROTECTED] An: Tapestry users users@tapestry.apache.org Betreff: Re: Session bleedings in Tapestry5 Hello namesake, Since I've never heared about this too, I searched the Mailing List and JIRA and didn't find any issue which you could've meant. Where did you hear that? - Tobias [EMAIL PROTECTED] schrieb: I have heard there are some issues with Session bleedings in Tapestry5. Will those issues be fixed by November? I would like to go live with a T5 application by November/December Thanks! Tobias - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Session bleedings in Tapestry5
I quote from a chat protocol with a developer: Take for eg, if there are 10 users at present using our website, then first user clicks on 1st page, and 5th user clicks on 2nd page, and 3 rd person clicks on 3 page and using it. And if the user 1 is clcked on 8 page at that time user 3 want to goto another page say 5, then he also gets 8 instead of 5. As first user requested that page. :( Original-Nachricht Datum: Mon, 20 Oct 2008 13:32:16 +0200 Von: Tobias Wehrum [EMAIL PROTECTED] An: Tapestry users users@tapestry.apache.org Betreff: Re: Session bleedings in Tapestry5 Hello namesake, Since I've never heared about this too, I searched the Mailing List and JIRA and didn't find any issue which you could've meant. Where did you hear that? - Tobias [EMAIL PROTECTED] schrieb: I have heard there are some issues with Session bleedings in Tapestry5. Will those issues be fixed by November? I would like to go live with a T5 application by November/December Thanks! Tobias - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Session bleedings in Tapestry5
Tapestyr5 or 4 ? Here, this developer means Tapestry5 Original-Nachricht Datum: Mon, 20 Oct 2008 08:46:15 -0400 Von: Daniel Jue [EMAIL PROTECTED] An: Tapestry users users@tapestry.apache.org Betreff: Re: Session bleedings in Tapestry5 I've also never come across this kind of problem. It would be interesting to see the code that caused what the developer said was happening. As others have suggested, it's easy to do this if you are using statics (or if your private vars get initialized by statics in the setup phase). On Mon, Oct 20, 2008 at 8:41 AM, Peter Stavrinides [EMAIL PROTECTED] wrote: I have never come across such a problem either, and we have done a lot of testing for this. Your problem sounds like it has little to do with the session and more to do with page pooling, i.e.: how you initialize your pages. The golden rule there is that your fields must always be private, and then should be referenced by public accessors, having a public field in a page is like using a static variable which may explain your problem. -- 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: [EMAIL PROTECTED] To: users@tapestry.apache.org Sent: Monday, 20 October, 2008 2:53:17 PM GMT +02:00 Athens, Beirut, Bucharest, Istanbul Subject: Re: Session bleedings in Tapestry5 I quote from a chat protocol with a developer: Take for eg, if there are 10 users at present using our website, then first user clicks on 1st page, and 5th user clicks on 2nd page, and 3 rd person clicks on 3 page and using it. And if the user 1 is clcked on 8 page at that time user 3 want to goto another page say 5, then he also gets 8 instead of 5. As first user requested that page. :( Original-Nachricht Datum: Mon, 20 Oct 2008 13:32:16 +0200 Von: Tobias Wehrum [EMAIL PROTECTED] An: Tapestry users users@tapestry.apache.org Betreff: Re: Session bleedings in Tapestry5 Hello namesake, Since I've never heared about this too, I searched the Mailing List and JIRA and didn't find any issue which you could've meant. Where did you hear that? - Tobias [EMAIL PROTECTED] schrieb: I have heard there are some issues with Session bleedings in Tapestry5. Will those issues be fixed by November? I would like to go live with a T5 application by November/December Thanks! Tobias - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Session bleedings in Tapestry5
I currently use Tapestry 5.0.13 (soon to be upgraded) in a live system used by plenty of people at once and I have not had this issue at all. [EMAIL PROTECTED] wrote: Tapestyr5 or 4 ? Here, this developer means Tapestry5 Original-Nachricht Datum: Mon, 20 Oct 2008 08:46:15 -0400 Von: Daniel Jue [EMAIL PROTECTED] An: Tapestry users users@tapestry.apache.org Betreff: Re: Session bleedings in Tapestry5 I've also never come across this kind of problem. It would be interesting to see the code that caused what the developer said was happening. As others have suggested, it's easy to do this if you are using statics (or if your private vars get initialized by statics in the setup phase). On Mon, Oct 20, 2008 at 8:41 AM, Peter Stavrinides [EMAIL PROTECTED] wrote: I have never come across such a problem either, and we have done a lot of testing for this. Your problem sounds like it has little to do with the session and more to do with page pooling, i.e.: how you initialize your pages. The golden rule there is that your fields must always be private, and then should be referenced by public accessors, having a public field in a page is like using a static variable which may explain your problem. -- 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: [EMAIL PROTECTED] To: users@tapestry.apache.org Sent: Monday, 20 October, 2008 2:53:17 PM GMT +02:00 Athens, Beirut, Bucharest, Istanbul Subject: Re: Session bleedings in Tapestry5 I quote from a chat protocol with a developer: Take for eg, if there are 10 users at present using our website, then first user clicks on 1st page, and 5th user clicks on 2nd page, and 3 rd person clicks on 3 page and using it. And if the user 1 is clcked on 8 page at that time user 3 want to goto another page say 5, then he also gets 8 instead of 5. As first user requested that page. :( Original-Nachricht Datum: Mon, 20 Oct 2008 13:32:16 +0200 Von: Tobias Wehrum [EMAIL PROTECTED] An: Tapestry users users@tapestry.apache.org Betreff: Re: Session bleedings in Tapestry5 Hello namesake, Since I've never heared about this too, I searched the Mailing List and JIRA and didn't find any issue which you could've meant. Where did you hear that? - Tobias [EMAIL PROTECTED] schrieb: I have heard there are some issues with Session bleedings in Tapestry5. Will those issues be fixed by November? I would like to go live with a T5 application by November/December Thanks! Tobias - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Session bleedings in Tapestry5
This might be possible if a field was marked with @Retain instead of @Persist. @Retain marks fields that are safe to share between different users, things like computed DateFormats. Interestingly, I've never used @Retain in one of my applications. Fields that store user-specific data that must span requests should use @Persist. On Mon, Oct 20, 2008 at 4:53 AM, [EMAIL PROTECTED] wrote: I quote from a chat protocol with a developer: Take for eg, if there are 10 users at present using our website, then first user clicks on 1st page, and 5th user clicks on 2nd page, and 3 rd person clicks on 3 page and using it. And if the user 1 is clcked on 8 page at that time user 3 want to goto another page say 5, then he also gets 8 instead of 5. As first user requested that page. :( Original-Nachricht Datum: Mon, 20 Oct 2008 13:32:16 +0200 Von: Tobias Wehrum [EMAIL PROTECTED] An: Tapestry users users@tapestry.apache.org Betreff: Re: Session bleedings in Tapestry5 Hello namesake, Since I've never heared about this too, I searched the Mailing List and JIRA and didn't find any issue which you could've meant. Where did you hear that? - Tobias [EMAIL PROTECTED] schrieb: I have heard there are some issues with Session bleedings in Tapestry5. Will those issues be fixed by November? I would like to go live with a T5 application by November/December Thanks! Tobias - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Session bleedings in Tapestry5
I've never heard of that? I suspect that this is due to the fact that the T5 page pool is forgotten and @Retain is used or something similar? Page cannot contain ANY instance variables, excluding the ones that are same regardless of the session (user) accessing the page or maintained by T5. Same applies to components. Also instance variables are cleaned if not marked with @Retain when page is returned to page pool. - Ville toby78 wrote: I have heard there are some issues with Session bleedings in Tapestry5. Will those issues be fixed by November? I would like to go live with a T5 application by November/December Thanks! Tobias - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Access-to-HttpSessions-tp20051371p20067243.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Session bleedings in Tapestry5
Thanks for the quick reply. Good to hear that this is not an issue in T5. Original-Nachricht Datum: Mon, 20 Oct 2008 06:52:54 -0700 Von: Howard Lewis Ship [EMAIL PROTECTED] An: Tapestry users users@tapestry.apache.org Betreff: Re: Session bleedings in Tapestry5 This might be possible if a field was marked with @Retain instead of @Persist. @Retain marks fields that are safe to share between different users, things like computed DateFormats. Interestingly, I've never used @Retain in one of my applications. Fields that store user-specific data that must span requests should use @Persist. On Mon, Oct 20, 2008 at 4:53 AM, [EMAIL PROTECTED] wrote: I quote from a chat protocol with a developer: Take for eg, if there are 10 users at present using our website, then first user clicks on 1st page, and 5th user clicks on 2nd page, and 3 rd person clicks on 3 page and using it. And if the user 1 is clcked on 8 page at that time user 3 want to goto another page say 5, then he also gets 8 instead of 5. As first user requested that page. :( Original-Nachricht Datum: Mon, 20 Oct 2008 13:32:16 +0200 Von: Tobias Wehrum [EMAIL PROTECTED] An: Tapestry users users@tapestry.apache.org Betreff: Re: Session bleedings in Tapestry5 Hello namesake, Since I've never heared about this too, I searched the Mailing List and JIRA and didn't find any issue which you could've meant. Where did you hear that? - Tobias [EMAIL PROTECTED] schrieb: I have heard there are some issues with Session bleedings in Tapestry5. Will those issues be fixed by November? I would like to go live with a T5 application by November/December Thanks! Tobias - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: session-less forms
the @Meta(tapestry.persistence-strategy=X) works beautifully... no more sessions till logged in. On Mon, Apr 7, 2008 at 7:14 PM, Robert Zeigler [EMAIL PROTECTED] wrote: On Apr 7, 2008, at 4/712:53 PM , Fernando Padilla wrote: so.. the client strategy stores it in a cookie? Client strategy stores it in the url. Not sure how that would play out for myspace, etc. Robert Yeah, I don't really have access to those either :) ps - This is for integration with GoogleGadgets/OpenSocial/MySpace/Hi5. So it's basically a portlet hosted on a different site. And the requests to my server are being proxied by MySpace/Hi5 so we don't have access to cookies from the client side.. pps - I am using Zones and Form/Zones, so I'm rendering on the same request as the submit, and at first glance that seems to be working. I just wanted to make sure persist/session requirement wasn't going to bite me later.. ppps - So if we're doing the render on the same request as submit, we don't really have to store the Validation object in the session right? Howard Lewis Ship wrote: The approach I would take would be to configure the Form to store its persistent fields on the client, rather than in the Session. On your PAGE, you can add a @Meta annotation for this: @Meta(tapestry.persistence-strategy=client) public class MyPage { ... This sets the default persistence strategy for the entire page to be client. Since in most cases, @Persist is used without a specific strategy, even nested components (such as Form) will inherit a default persistent strategy from their container. I haven't tried this yet myself ... give it a try and report back! On Mon, Apr 7, 2008 at 5:05 AM, Peter Stavrinides [EMAIL PROTECTED] wrote: If I understand correctly you need to pass data completely independent of session state... then your options are hidden form fields, and or URL parameters. Of course then you would have to reinitialize your properties manually after posting, which is not such big a deal! Fernando Padilla wrote: I have a requirement to not depend on HttpSession, but the Form component has a @Persist field that Tapestry wants to store in a session. What are some options to avoid this? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: session-less forms
If I understand correctly you need to pass data completely independent of session state... then your options are hidden form fields, and or URL parameters. Of course then you would have to reinitialize your properties manually after posting, which is not such big a deal! Fernando Padilla wrote: I have a requirement to not depend on HttpSession, but the Form component has a @Persist field that Tapestry wants to store in a session. What are some options to avoid this? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: session-less forms
The approach I would take would be to configure the Form to store its persistent fields on the client, rather than in the Session. On your PAGE, you can add a @Meta annotation for this: @Meta(tapestry.persistence-strategy=client) public class MyPage { ... This sets the default persistence strategy for the entire page to be client. Since in most cases, @Persist is used without a specific strategy, even nested components (such as Form) will inherit a default persistent strategy from their container. I haven't tried this yet myself ... give it a try and report back! On Mon, Apr 7, 2008 at 5:05 AM, Peter Stavrinides [EMAIL PROTECTED] wrote: If I understand correctly you need to pass data completely independent of session state... then your options are hidden form fields, and or URL parameters. Of course then you would have to reinitialize your properties manually after posting, which is not such big a deal! Fernando Padilla wrote: I have a requirement to not depend on HttpSession, but the Form component has a @Persist field that Tapestry wants to store in a session. What are some options to avoid this? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: session-less forms
so.. the client strategy stores it in a cookie? Yeah, I don't really have access to those either :) ps - This is for integration with GoogleGadgets/OpenSocial/MySpace/Hi5. So it's basically a portlet hosted on a different site. And the requests to my server are being proxied by MySpace/Hi5 so we don't have access to cookies from the client side.. pps - I am using Zones and Form/Zones, so I'm rendering on the same request as the submit, and at first glance that seems to be working. I just wanted to make sure persist/session requirement wasn't going to bite me later.. ppps - So if we're doing the render on the same request as submit, we don't really have to store the Validation object in the session right? Howard Lewis Ship wrote: The approach I would take would be to configure the Form to store its persistent fields on the client, rather than in the Session. On your PAGE, you can add a @Meta annotation for this: @Meta(tapestry.persistence-strategy=client) public class MyPage { ... This sets the default persistence strategy for the entire page to be client. Since in most cases, @Persist is used without a specific strategy, even nested components (such as Form) will inherit a default persistent strategy from their container. I haven't tried this yet myself ... give it a try and report back! On Mon, Apr 7, 2008 at 5:05 AM, Peter Stavrinides [EMAIL PROTECTED] wrote: If I understand correctly you need to pass data completely independent of session state... then your options are hidden form fields, and or URL parameters. Of course then you would have to reinitialize your properties manually after posting, which is not such big a deal! Fernando Padilla wrote: I have a requirement to not depend on HttpSession, but the Form component has a @Persist field that Tapestry wants to store in a session. What are some options to avoid this? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: session-less forms
On Apr 7, 2008, at 4/712:53 PM , Fernando Padilla wrote: so.. the client strategy stores it in a cookie? Client strategy stores it in the url. Not sure how that would play out for myspace, etc. Robert Yeah, I don't really have access to those either :) ps - This is for integration with GoogleGadgets/OpenSocial/MySpace/ Hi5. So it's basically a portlet hosted on a different site. And the requests to my server are being proxied by MySpace/Hi5 so we don't have access to cookies from the client side.. pps - I am using Zones and Form/Zones, so I'm rendering on the same request as the submit, and at first glance that seems to be working. I just wanted to make sure persist/session requirement wasn't going to bite me later.. ppps - So if we're doing the render on the same request as submit, we don't really have to store the Validation object in the session right? Howard Lewis Ship wrote: The approach I would take would be to configure the Form to store its persistent fields on the client, rather than in the Session. On your PAGE, you can add a @Meta annotation for this: @Meta(tapestry.persistence-strategy=client) public class MyPage { ... This sets the default persistence strategy for the entire page to be client. Since in most cases, @Persist is used without a specific strategy, even nested components (such as Form) will inherit a default persistent strategy from their container. I haven't tried this yet myself ... give it a try and report back! On Mon, Apr 7, 2008 at 5:05 AM, Peter Stavrinides [EMAIL PROTECTED] wrote: If I understand correctly you need to pass data completely independent of session state... then your options are hidden form fields, and or URL parameters. Of course then you would have to reinitialize your properties manually after posting, which is not such big a deal! Fernando Padilla wrote: I have a requirement to not depend on HttpSession, but the Form component has a @Persist field that Tapestry wants to store in a session. What are some options to avoid this? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: session-less forms
I have a requirement to not depend on HttpSession, but the Form component has a @Persist field that Tapestry wants to store in a session. What are some options to avoid this? I may have posted this before, but here it is again. I think it's a pretty good solution. I created a session persistence strategy that only stores non-null values, and extended the Form to only store the validation if there are errors... The changes to the existing classes are minor. Here's the code. import org.apache.tapestry.ValidationTracker; import org.apache.tapestry.ValidationTrackerImpl; import org.apache.tapestry.annotations.Persist; /** * Overrides the core [EMAIL PROTECTED] org.apache.tapestry.corelib.components.Form} in order to store the validation tracker only * when there is something to track. * p/ * Created by IntelliJ IDEA. * User: joshcanfield * Date: Oct 26, 2007 */ public class Form extends org.apache.tapestry.corelib.components.Form { @Persist(nonnull) private ValidationTracker _tracker; private ValidationTracker _nonPersistedTracker; public ValidationTracker getDefaultTracker() { if (_nonPersistedTracker == null) { if (_tracker != null) { // _tracker is loaded via injection magic when it's in the session _nonPersistedTracker = _tracker; } else { _nonPersistedTracker = new ValidationTrackerImpl(); } } return _nonPersistedTracker; } public void setDefaultTracker(ValidationTracker defaultTracker) { _nonPersistedTracker = defaultTracker; } protected void onAction() { if (_nonPersistedTracker.getHasErrors()) { _tracker = _nonPersistedTracker; } else { _tracker = null; } } } import org.apache.tapestry.internal.services.PersistentFieldChangeImpl; import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newList; import static org.apache.tapestry.ioc.internal.util.Defense.notBlank; import org.apache.tapestry.services.PersistentFieldChange; import org.apache.tapestry.services.PersistentFieldStrategy; import org.apache.tapestry.services.Request; import org.apache.tapestry.services.Session; import java.util.Collection; import java.util.Collections; import java.util.List; /** * Created by IntelliJ IDEA. * User: joshcanfield * Date: Oct 26, 2007 */ public class NonNullSessionPersistentFieldStrategy implements PersistentFieldStrategy { /** * Prefix used to identify keys stored in the session. */ static final String PREFIX = nonnull:; private final Request _request; protected NonNullSessionPersistentFieldStrategy(Request request) { _request = request; } public final CollectionPersistentFieldChange gatherFieldChanges(String pageName) { Session session = _request.getSession(false); if (session == null) return Collections.emptyList(); ListPersistentFieldChange result = newList(); String fullPrefix = PREFIX + pageName + :; for (String name : session.getAttributeNames(fullPrefix)) { PersistentFieldChange change = buildChange(name, session.getAttribute(name)); result.add(change); } return result; } public void discardChanges(String pageName) { Session session = _request.getSession(false); if (session == null) return; String fullPrefix = PREFIX + pageName + :; for (String name : session.getAttributeNames(fullPrefix)) { session.setAttribute(name, null); } } private PersistentFieldChange buildChange(String name, Object attribute) { // TODO: Regexp is probably too expensive for what we need here. Maybe an IOC InternalUtils // method for this purpose? String[] chunks = name.split(:); // Will be empty string for the root component String componentId = chunks[2]; String fieldName = chunks[3]; return new PersistentFieldChangeImpl(componentId, fieldName, attribute); } public final void postChange(String pageName, String componentId, String fieldName, Object newValue) { notBlank(pageName, pageName); notBlank(fieldName, fieldName); StringBuilder builder = new StringBuilder(PREFIX); builder.append(pageName); builder.append(':'); if (componentId != null) builder.append(componentId); builder.append(':'); builder.append(fieldName); // because we don't want to create a session when the object is null Session session = _request.getSession(newValue != null); if (session != null) { session.setAttribute(builder.toString(), newValue); } } } Add this to your app module: public void contributePersistentFieldManager( MappedConfigurationString, PersistentFieldStrategy
Re: Session in ServiceEncoder's?
On 21.01.2008, at 17:24, Kaspar Fischer wrote: Hi, Can I inject the current session into a service encoder? Any idea how I could achieve this? Many thanks! Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Session in ServiceEncoder's?
This seems to work: service-point id=myencoder interface=org.apache.tapestry.engine.ServiceEncoder invoke-factory construct class=org.myorg.tapestry.myproject.serviceencoders.DBObjectServiceEncod er set property=pageName value=node / set-object property=applicationStateManager value=service:tapestry.state.ApplicationStateManager / /construct /invoke-factory /service-point and in the service encoder class: ... private ApplicationStateManager applicationStateManager; ... public void setApplicationStateManager(ApplicationStateManager applicationStateManager) { this.applicationStateManager = applicationStateManager; } ... ... = (...) this.applicationStateManager.get(whatever you need); ... Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Session Creation...
I had similar issues changing from an HTTPs login page to a normal HTTP session for speed. I gave up in the end (for now.) I was using Tomcat, and it kept randomly creating a new session when switching back and forth. But, I'd bet it's really your servlet container that's doing this, not Tapestry. Norman Franke ASD, Inc. On Dec 26, 2007, at 10:41 PM, Steven Woolley wrote: I am having an issue where a new session is being created by a plugin within a page that already has a session. I need to use just one session for both the page and the plugin. I've tried appending the jsessionid to all the requests made by the plugin, but a new session is still created (and the session id from the url is apparently ignored in favor of the cookie's new session ids). Is there a way to work around this, either by forcing the url sessionid to be used, or something else? Thanks, Steve - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Session and application scope
How can i instanciate an Application Object? @ApplicationState private MyObject objectName_; how i use a request @Inject private RequestGlobals requestGlobals_; Then you have access to the Servlet API with things like: HttpServletRequest request = requestGlobals.getHTTPServletRequest(); Gianluigi wrote: Hi to all, i'm a JSP developer and i want to know a more on Tapestry 5, it seem very cool! :) Only a question, how i use a request or a Session in Tapestry 5? How can i instanciate an Application Object? in JSP i wrote : HttpSession session and session.setProperty(Key); and in Tapestry 5? Thanks a lot Muzero ___ L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: http://it.docs.yahoo.com/nowyoucan.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Session and application scope
On 10/23/07, Gianluigi [EMAIL PROTECTED] wrote: Only a question, how i use a request or a Session in Tapestry 5? How can i instanciate an Application Object? in JSP i wrote : HttpSession session and session.setProperty(Key); and in Tapestry 5? Take a look at application state: http://tapestry.formos.com/nightly/tapestry5/tapestry-core/guide/appstate.html -- Massimo http://meridio.blogspot.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: session state vs application state?
Hi Robert, Anyway, if you create a class with static methods and attributes, your object will be shared for entire application. public class ListaEstatica { private static ListUsuario _lista; public static ListUsuario getLista() { if (_lista==null) _lista=new ArrayListUsuario(0); return _lista; } public static void add(Usuario usuario) { getLista().add(usuario); } } Marcus
Re: session state vs application state?
I'm thinking that you are going to run into problems with this technique. While page instances are thread safe, your page class will definitely be used by multiple threads. If you are adding to _lista while iterating over it then you are going to get an ConcurrentModificationException. Performing actions on this list are going to require considering synchronization issues. Of course, this consideration is going to be required of any object that you store at the application level (in the servlet context for instance) if you are doing anything other than read only operations. Josh On 9/25/07, Marcus [EMAIL PROTECTED] wrote: Hi Robert, Anyway, if you create a class with static methods and attributes, your object will be shared for entire application. public class ListaEstatica { private static ListUsuario _lista; public static ListUsuario getLista() { if (_lista==null) _lista=new ArrayListUsuario(0); return _lista; } public static void add(Usuario usuario) { getLista().add(usuario); } } Marcus -- -- TheDailyTube.com. Sign up and get the best new videos on the internet delivered fresh to your inbox.
Re: session state vs application state?
Hi Josh, I agree with your comment. Add synchronization to add method is a good practice. Marcus
Re: session state vs application state?
On 9/25/07, Marcus [EMAIL PROTECTED] wrote: Hi Josh, I agree with your comment. Add synchronization to add method is a good practice. Marcus Synchronizing add won't solve the problem. Any time you are going to structurally change the list then any iterator becomes invalid and will fail-fast by throwing an exception. Check out the java5 concurrent package for some thread safe data structures http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/package-summary.html -- -- TheDailyTube.com. Sign up and get the best new videos on the internet delivered fresh to your inbox.
Re: session state vs application state?
Josh, Again, I agree, every method that change the _lista should be synchronized. Marcus
Re: session state vs application state?
You really want your object to be stored in the ServletContext. In Tapestry terms, that would be possible as a new (as in, not yet provided by the framework) ApplicationStatePersistenceStrategy. Feel free to add a JIRA Issue (and a patch!). On 9/24/07, Robert A. Decker [EMAIL PROTECTED] wrote: I've read: http://tapestry.apache.org/tapestry5/tapestry-core/guide/appstate.html I understand that when using an ApplicationState it's really more of a Session state (the default way). What if I want to store something that's shared across all sessions as more of what I would think of as an ApplicationState? Do I just create a static variable somewhere? Sorry for the basic questions I've been asking. I'm new to Tapestry and still trying to figure out the standard ways of doing some basic stuff. R - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Howard M. Lewis Ship Partner and Senior Architect at Feature50 Creator Apache Tapestry and Apache HiveMind
Re: session variables and links
Hi Michele, 1. Why would you do this? For example, you would normally do something like this in your mypage.html: t:actionlink t:id=name context=xxxLink text/t:actionlink and something like this in your mypage.java: @Persist String myName; public void onActionFromName(String name) { myName = name; } 2. You can create a page in your java app, and call an init function before you redirect to it, e.g. see ( http://tapestry.apache.org/tapestry5/tapestry-core/index.html) or @InjectPage private Start _startPage; // this page needs to exist in the folder myapp.pages/Start.java, often with accompanying src/main/webapp/WEB-INF/Start.html. private Object onActionFromGoToStarttPage() { _startPage.setName(name); return _startPage; } Cheers Erik On 9/4/07, Michele Russo [EMAIL PROTECTED] wrote: Hello, I'm a new user of Tapestry. Please could you help me in solving the following problems: 1) I would like to extract an attribute from an url. For instance, if I've the following url: http://foo?name=xxx I want to extract the name and insert it as a session variable. 2) Next, I would like to create a link to an external page passing the session name to it. I would very grateful if someone could provide me a piece of sample code. Regards, Michele - - L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail
Re: Session timeout and callback
The listener parameters won't have the state of your page (in most instances). . What you have to do is implement IExternalPage ( http://tapestry.apache.org/tapestry4.1/apidocs/org/apache/tapestry/IExternalPage.html) on your page class like so: @Persist public abstract void setUserId(String madeUpId); public void activateExternalPage(Object[] parameters, IRequestCycle cycle) { String userId = (String)parameters[0]; setUserId(userId); } The parameters that you give in the ExternalCallback constructor will be the same values passed back into your page in the activateExternalPage method. Sometimes it's possible to automate the process a little more but with the many varied ways people use state schemes it's probably best to start with this first and then move out from there. On 4/27/07, Simon Raveh [EMAIL PROTECTED] wrote: Hi, I'm developing an application using Tapestry 4 and I have a question regarding session timeout. when the session timeout I'm trying to create a callback object to an IExternaLPage using this code in my pageValidate method Callback callback = new ExternalCallback(pageName, getPageName(),getRequestCycle().getListenerParameters()); Login login = getLogin(); login.setCallback(callback); throw new PageRedirectException(login); The problem is that getListenerParameters is always null. What or how can I restore the state of the page after Login. Thanks, Simon -- Jesse Kuhnert Tapestry/Dojo team member/developer Open source based consulting work centered around dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
Re: Session invalidate question
This is great Matt! thanks. Matt Larson wrote: Peter, I have encountered a similar problem, and I think that the problem was not in my code, but in where I was doing the session.invalidate(). In trying to remove a cookie on logout, I found that I needed to do the invalidation in an IEngineService. You can then do a redirect to whatever page you want at that time. This may not fit your needs, but what I did was to create my own service via this configuration point in Hivemind: service-point id=LogoutService interface=org.apache.tapestry.engine.IEngineService invoke-factory construct class=tapestry.LogoutService set-service property=request service-id=tapestry.globals.HttpServletRequest / set-service property=response service-id=tapestry.globals.HttpServletResponse / set-object property=servletPath value=app-property:org.apache.tapestry.servlet-path / set-object property=linkFactory value=infrastructure:linkFactory / /construct /invoke-factory /service-point contribution configuration-id=tapestry.services.FactoryServices service name=logout object=service:LogoutService / /contribution Then in my service method of my engine class, I did the cookie handling and the session.invalidate() using parts of the code from Tapestry's logout service: public void service(IRequestCycle cycle) throws IOException { HttpSession session = _request.getSession(false); if (session != null) { try { session.invalidate(); } catch (IllegalStateException ex) { logger.warn(Exception thrown invalidating HttpSession., ex); // Otherwise, ignore it. } } [do cookie handling] _response.sendRedirect(page_to_redirect_to.html); } Hope that helps. Cheers, Matt Peter Stavrinides wrote: Hi Everyone, I want to redirect to a page (other than my home page) and invalidate the session there. After i call invalidate I get an exception that states the session has already been invalidated, even if I invalidate the session on the target page in pageEndRender. The question is how do I delay the invalidate on the target page long enough to prevent this exception. For Example: public void pageEndRender(PageEvent e) { if (getRequest().getSession(false) != null){ try { //some clean up code here getRequest().getSession(false).invalidate(); } catch (Exception ex){ //XXX -Exception still appears at runtime in tomcat which cannot be caught } } } Produces The following stack trace: WARN - Exception during post-request cleanup: setAttribute: Session already invalidated - org.apache.tapestry.error.RequestExceptionReporterImpl (45) java.lang.IllegalStateException: setAttribute: Session already invalidated at org.apache.catalina.session.StandardSession.setAttribute(StandardSession.java:1251) at org.apache.catalina.session.StandardSession.setAttribute(StandardSession.java:1233) at org.apache.catalina.session.StandardSessionFacade.setAttribute(StandardSessionFacade.java:129) at org.apache.tapestry.web.ServletWebSession.setAttribute(ServletWebSession.java:62) at org.apache.tapestry.engine.state.SessionScopeManager.store(SessionScopeManager.java:90) at $StateObjectPersistenceManager_1122965794b.store($StateObjectPersistenceManager_1122965794b.java) at org.apache.tapestry.engine.state.StateObjectManagerImpl.store(StateObjectManagerImpl.java:56) at org.apache.tapestry.engine.state.ApplicationStateManagerImpl.flush(ApplicationStateManagerImpl.java:87) at $ApplicationStateManager_1122965778e.flush($ApplicationStateManager_1122965778e.java) at $ApplicationStateManager_1122965778f.flush($ApplicationStateManager_1122965778f.java) at org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:283) at org.apache.tapestry.services.impl.InvokeEngineTerminator.service(InvokeEngineTerminator.java:54) at $WebRequestServicer_1122965784e.service($WebRequestServicer_112296578 etc Thanks Peter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Peter Stavrinides Albourne Partners (Cyprus) Ltd Tel: +357 22 750652 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.
Re: Session invalidate question
Peter, I have encountered a similar problem, and I think that the problem was not in my code, but in where I was doing the session.invalidate(). In trying to remove a cookie on logout, I found that I needed to do the invalidation in an IEngineService. You can then do a redirect to whatever page you want at that time. This may not fit your needs, but what I did was to create my own service via this configuration point in Hivemind: service-point id=LogoutService interface=org.apache.tapestry.engine.IEngineService invoke-factory construct class=tapestry.LogoutService set-service property=request service-id=tapestry.globals.HttpServletRequest / set-service property=response service-id=tapestry.globals.HttpServletResponse / set-object property=servletPath value=app-property:org.apache.tapestry.servlet-path / set-object property=linkFactory value=infrastructure:linkFactory / /construct /invoke-factory /service-point contribution configuration-id=tapestry.services.FactoryServices service name=logout object=service:LogoutService / /contribution Then in my service method of my engine class, I did the cookie handling and the session.invalidate() using parts of the code from Tapestry's logout service: public void service(IRequestCycle cycle) throws IOException { HttpSession session = _request.getSession(false); if (session != null) { try { session.invalidate(); } catch (IllegalStateException ex) { logger.warn(Exception thrown invalidating HttpSession., ex); // Otherwise, ignore it. } } [do cookie handling] _response.sendRedirect(page_to_redirect_to.html); } Hope that helps. Cheers, Matt Peter Stavrinides wrote: Hi Everyone, I want to redirect to a page (other than my home page) and invalidate the session there. After i call invalidate I get an exception that states the session has already been invalidated, even if I invalidate the session on the target page in pageEndRender. The question is how do I delay the invalidate on the target page long enough to prevent this exception. For Example: public void pageEndRender(PageEvent e) { if (getRequest().getSession(false) != null){ try { //some clean up code here getRequest().getSession(false).invalidate(); } catch (Exception ex){ //XXX -Exception still appears at runtime in tomcat which cannot be caught } } } Produces The following stack trace: WARN - Exception during post-request cleanup: setAttribute: Session already invalidated - org.apache.tapestry.error.RequestExceptionReporterImpl (45) java.lang.IllegalStateException: setAttribute: Session already invalidated at org.apache.catalina.session.StandardSession.setAttribute(StandardSession.java:1251) at org.apache.catalina.session.StandardSession.setAttribute(StandardSession.java:1233) at org.apache.catalina.session.StandardSessionFacade.setAttribute(StandardSessionFacade.java:129) at org.apache.tapestry.web.ServletWebSession.setAttribute(ServletWebSession.java:62) at org.apache.tapestry.engine.state.SessionScopeManager.store(SessionScopeManager.java:90) at $StateObjectPersistenceManager_1122965794b.store($StateObjectPersistenceManager_1122965794b.java) at org.apache.tapestry.engine.state.StateObjectManagerImpl.store(StateObjectManagerImpl.java:56) at org.apache.tapestry.engine.state.ApplicationStateManagerImpl.flush(ApplicationStateManagerImpl.java:87) at $ApplicationStateManager_1122965778e.flush($ApplicationStateManager_1122965778e.java) at $ApplicationStateManager_1122965778f.flush($ApplicationStateManager_1122965778f.java) at org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:283) at org.apache.tapestry.services.impl.InvokeEngineTerminator.service(InvokeEngineTerminator.java:54) at $WebRequestServicer_1122965784e.service($WebRequestServicer_112296578 etc Thanks Peter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: session persistance?
Yes, from what I understand persist is just to keep value between request. so every-time you request the page the object is in this case recreated. If you want to keep this object across a session you need ASO (see T5 doc on persistence). You can also (but will not be kept a session level) perform a test in your class to instantiate only once the object and keep it for the page or request only. SP On Apr 9, 2007, at 3:34 AM, Patrick Moore wrote: Hi there -- does anyone have some thoughts on why: @Persist @InitialValue(new java.util.HashSet()) public abstract SetLong getFollowUpMessages(); public abstract void setFollowUpMessages(SetLong set); keeps on resetting the set to a new HashSet between http requests? It looks like according to the @Persist documentation this is the correct way to set an initial value if there is no value already in the session. But it seems not to be the case... -Pat - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: session persistance?
That is correct behavior, and if you update the property (not the set stored in the property), then the Set will be stored into the session, and restored on the next request. On 4/8/07, Patrick Moore [EMAIL PROTECTED] wrote: Hi there -- does anyone have some thoughts on why: @Persist @InitialValue(new java.util.HashSet()) public abstract SetLong getFollowUpMessages(); public abstract void setFollowUpMessages(SetLong set); keeps on resetting the set to a new HashSet between http requests? It looks like according to the @Persist documentation this is the correct way to set an initial value if there is no value already in the session. But it seems not to be the case... -Pat -- Howard M. Lewis Ship TWD Consulting, Inc. Independent J2EE / Open-Source Java Consultant Creator and PMC Chair, Apache Tapestry Creator, Apache HiveMind Professional Tapestry training, mentoring, support and project work. http://howardlewisship.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]