Style and variant
Hi all, we have a site where some pages/components implement variant V. Now there is a requirement to sell a mainly reskinned version S of this site to a customer. So my first thought was to implement this site-wide variant S as a style. But soon I realised that _V wouldn't match variant V for site S. That is, that there is no default site for variations of a component. So, if I had: MyComponent MyComponent_V I'm now forced to duplicate MyComponent_V in MyComponent_S_V even if there is no difference at all for that component in both sites (which is the common case). Also, as ComponentStringResourceLoader directly instantiates ResourceNameIterator, there is no simple hook to customise the resolution sequence. One should reimplement ComponentStringResourceLoader and its subclass ClassStringResourceLoader in order to get such simple change in the resolution algorithm. This is done mostly by copypaste. I think that: i. style and variations are not treated very orthogonally, MyComponent above matches both the default style and S, but MyComponent_V matches only the default site. IMO this violates the rule of least surprise, I would expected: MyComponent_V_S then MyComponent_V then MyComponent_S then MyComponent. Anyway, I agree this is arguable, because of the ambiguity between MyComponent_V and MyComponent_S: it's not very clear which should go first. But in this case, the impossibility to define a sequence that is good for everyone reinforces next point (ii). ii. ResourceNameIterator should be configurable (that is, I expect some ioc here). Also style and variation shouldn't be merged at one single parameter at this point; this falls under ResourceNameIterator responsability instead. What do you think? Kind regards -Carlos - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: null lastPage at restoreAfterSerialization
Matej, forget what I said yesterday about session lastAccessedDate, I've debugged it in detail and tomcat is doing its part fine, I was confused by a sequence of logs that implied that the session was swapped out before a page was added to its pagemap. But later I found out that this wasn't the usual pattern so I included more log output here and there. And now it seems as if the pagemap instance that is swapped out isn't the same one where the page was first put. Below I copied the pertinent fragments of code and one example of output showing the anomaly: 1) What follows is in order to identify each pagemap instance (with thisNum): private static final class SecondLevelCachePageMap extends PageMap { private static int pageMapNum = 0; private int thisNum; private SecondLevelCachePageMap(String sessionId, Application application, String name) { synchronized (SecondLevelCachePageMap.class) { thisNum = pageMapNum++; } } 2) Now for the logging part a) First when a page is put into the pagemap public void put(Page page) { if (!page.isPageStateless()) { Session session = getSession(); String sessionId = session.getId(); if (sessionId != null !session.isSessionInvalidated()) { // the id could have changed from null during request this.sessionId = sessionId; log.error(put + sessionId + + thisNum); getStore().storePage(sessionId, page); setLastPage(page); dirty(); } } } b) Then when a pagemap is swapped out (writeObject): private void writeObject(java.io.ObjectOutputStream s) throws IOException { s.defaultWriteObject(); IPageStore store = getPageStore(); if (sessionId != null store instanceof IClusteredPageStore == false) { -- if (lastPage == null) log.error(writeObject1 + sessionId + + thisNum); -- Object page = lastPage; if (store instanceof ISerializationAwarePageStore) { page = (ISerializationAwarePageStore)store).prepareForSerialization(... -- if (page == null) log.error(writeObject2 + sessionId + + thisNum); -- } } . } Finally, the output looks like: 2008-11-22 04:43:58,841 PAGE 19ACC6B64E22346D494E742A0E859B52 29 other pages in other sessions follows 2008-11-22 04:44:00,486 put 33932E31AE77206B5E556266170B4827 33 2008-11-22 04:44:00,201 put C6423FDD58C4B31C080700E4455F158C and about 120 secs later: 2008-11-22 04:46:36,432 writeObject1 19ACC6B64E22346D494E742A0E859B52 30 2008-11-22 04:46:36,432 writeObject2 19ACC6B64E22346D494E742A0E859B52 30 In every case I've seen the instance num for the writeObject1/2 logs was one plus the num for the put log in the same session. I think that here the second pagemap (30) is created with a default lastPage = null that never is assigned a non null page, because put is being called on the first pagemap (29) instead. I still don't know where the second pagemap is created, but I'm getting closer. HIH -Carlos On Thu, Nov 20, 2008 at 3:05 AM, Carlos Pita [EMAIL PROTECTED] wrote: Hi Matej, I'm browsing your changes. Please notice that according to my own debugging it's lastPage itself that is null and not only the result of prepareForSerialization. So I don't think the warning PageStore prepared non-null page as null for serialization will ever be reached. Anyway, I will add other warnings and keep you informed of the output as soon as I can. This is really tricky to debug because up til today I'm only able to reproduce it at full scale in a production environment. Do you have any idea why a lastPage would be null after 120 secs of the request that created the session? Specially for sessions that don't survive that first request. An exception that could avoid request cycle to detach the session maybe? Thanks! -Carlos On Wed, Nov 19, 2008 at 7:18 PM, Matej Knopp [EMAIL PROTECTED] wrote: This really is weird. I added couple of warnings and null check to 1.4 trunk. I wonder if that helps it though. -Matej On Wed, Nov 19, 2008 at 12:44 PM, Carlos Pita [EMAIL PROTECTED] wrote: The last one of the saga for now, I badly need to sleep. I've been sampling tomcat work dir every second: i=0; while [[ i -le 300 ]]; do echo $i; ls -lt /u01/tomcatWork/_ /tmp/work$i; sleep 1; i=$((i + 1)); done Then I greped a number of session ids corresponding to restoreAfterSerialization errors and every one of them appears in zero or one samples at most. With maxIdleTime = 120 secs the pattern is this: /u01/tomcatWork/_/wicketServlet-fileStore/sessionid created at T - 120 secs /u01/tomcatWork/_/sessionid.session swapped out at T - serialized restoreAfterSerialization error expired at ~T - deserialized The life span of /u01/tomcatWork/_/sessionid.session is of a fraction of a second. So the problem seems to be definitely related to short lived sessions that are removed immediately after being swapped out. The session is removed sooner than expected because of the exception that is thrown attempting to deserialize the lastPage. This is clear
null lastPage at restoreAfterSerialization
Hi all, as I've a requirement to maintain long lived sessions (~120s) I'm using tomcat's PersistentManager to avoid keeping lots of sessions in memory, each one with its own lastPage. I'm observing, specially in a heavy loaded production environment, permanent errors with a trace like Nov 19, 2008 1:56:20 AM org.apache.catalina.session.StoreBase processExpires SEVERE: Session: 115F3CD5A33E7D941AF8971FA62DE270; java.lang.IllegalArgumentException: Unknown object type null at org.apache.wicket.protocol.http.pagestore.DiskPageStore.restoreAfterSerialization(DiskPageStore.java:1214) at org.apache.wicket.protocol.http.SecondLevelCacheSessionStore$SecondLevelCachePageMap.readObject(SecondLevelCacheSessionStore.java:409) at sun.reflect.GeneratedMethodAccessor85.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1849) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351) at org.apache.catalina.session.StandardSession.readObject(StandardSession.java:1441) at org.apache.catalina.session.StandardSession.readObjectData(StandardSession.java:942) at org.apache.catalina.session.FileStore.load(FileStore.java:296) at org.apache.catalina.session.StoreBase.processExpires(StoreBase.java:195) at org.apache.catalina.session.PersistentManagerBase.processExpires(PersistentManagerBase.java:553) at org.apache.catalina.session.ManagerBase.backgroundProcess(ManagerBase.java:667) I've managed myself to reproduced this error in a more controlled environment and I discovered that tomcat's manager background thread is swapping out the session at a moment where lastPage == null. SecondLevelCacheSessionStore$SecondLevelCachePageMap [line: 380] if (sessionId != null store instanceof IClusteredPageStore == false) { Object page = lastPage; if (store instanceof ISerializationAwarePageStore)--- conditional breakpoint if page == null { Daemon Thread [ContainerBackgroundProcessor[StandardEngine[Catalina]]] (Suspended (breakpoint at line 380 in SecondLevelCacheSessionStore$SecondLevelCachePageMap)) SecondLevelCacheSessionStore$SecondLevelCachePageMap.writeObject(ObjectOutputStream) line: 380 GeneratedMethodAccessor139.invoke(Object, Object[]) line: not available DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25 Method.invoke(Object, Object...) line: 597 ObjectStreamClass.invokeWriteObject(Object, ObjectOutputStream) line: 945 ObjectOutputStream.writeSerialData(Object, ObjectStreamClass) line: 1461 ObjectOutputStream.writeOrdinaryObject(Object, ObjectStreamClass, boolean) line: 1392 ObjectOutputStream.writeObject0(Object, boolean) line: 1150 ObjectOutputStream.writeObject(Object) line: 326 StandardSession.writeObject(ObjectOutputStream) line: 1517 StandardSession.writeObjectData(ObjectOutputStream) line: 959 FileStore.save(Session) line: 372 PersistentManager(PersistentManagerBase).writeSession(Session) line: 868 PersistentManager(PersistentManagerBase).swapOut(Session) line: 839 PersistentManager(PersistentManagerBase).processMaxIdleSwaps() line: 1058 PersistentManager(PersistentManagerBase).processPersistenceChecks() line: 570 PersistentManager(PersistentManagerBase).processExpires() line: 551 PersistentManager(ManagerBase).backgroundProcess() line: 667 StandardContext(ContainerBase).backgroundProcess() line: 1316 ContainerBase$ContainerBackgroundProcessor.processChildren(Container, ClassLoader) line: 1601 ContainerBase$ContainerBackgroundProcessor.processChildren(Container, ClassLoader) line: 1610 ContainerBase$ContainerBackgroundProcessor.processChildren(Container, ClassLoader) line: 1610 ContainerBase$ContainerBackgroundProcessor.run() line: 1590 Thread.run() line: 619 I've configured a minIdleTime of 120 seconds so I don't think tomcat swaps the session out while it's still being accessed, in an invalid intermediate state. The code for processMaxIdleSwaps looks fine: protected void processMaxIdleSwaps() { if (!isStarted() || maxIdleSwap 0) return; Session sessions[] = findSessions(); long timeNow =
Re: null lastPage at restoreAfterSerialization
Another fact that could be relevant is that this only happens upon processexpires, but never for swapin, which seems to suggest that the span of the sessions that fail to restore is just one request (maybe the ones coming from bots that don't support cookies). Best regards -Carlos On Wed, Nov 19, 2008 at 7:13 AM, Carlos Pita [EMAIL PROTECTED] wrote: Hi all, as I've a requirement to maintain long lived sessions (~120s) I'm using tomcat's PersistentManager to avoid keeping lots of sessions in memory, each one with its own lastPage. I'm observing, specially in a heavy loaded production environment, permanent errors with a trace like Nov 19, 2008 1:56:20 AM org.apache.catalina.session.StoreBase processExpires SEVERE: Session: 115F3CD5A33E7D941AF8971FA62DE270; java.lang.IllegalArgumentException: Unknown object type null at org.apache.wicket.protocol.http.pagestore.DiskPageStore.restoreAfterSerialization(DiskPageStore.java:1214) at org.apache.wicket.protocol.http.SecondLevelCacheSessionStore$SecondLevelCachePageMap.readObject(SecondLevelCacheSessionStore.java:409) at sun.reflect.GeneratedMethodAccessor85.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1849) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351) at org.apache.catalina.session.StandardSession.readObject(StandardSession.java:1441) at org.apache.catalina.session.StandardSession.readObjectData(StandardSession.java:942) at org.apache.catalina.session.FileStore.load(FileStore.java:296) at org.apache.catalina.session.StoreBase.processExpires(StoreBase.java:195) at org.apache.catalina.session.PersistentManagerBase.processExpires(PersistentManagerBase.java:553) at org.apache.catalina.session.ManagerBase.backgroundProcess(ManagerBase.java:667) I've managed myself to reproduced this error in a more controlled environment and I discovered that tomcat's manager background thread is swapping out the session at a moment where lastPage == null. SecondLevelCacheSessionStore$SecondLevelCachePageMap [line: 380] if (sessionId != null store instanceof IClusteredPageStore == false) { Object page = lastPage; if (store instanceof ISerializationAwarePageStore)--- conditional breakpoint if page == null { Daemon Thread [ContainerBackgroundProcessor[StandardEngine[Catalina]]] (Suspended (breakpoint at line 380 in SecondLevelCacheSessionStore$SecondLevelCachePageMap)) SecondLevelCacheSessionStore$SecondLevelCachePageMap.writeObject(ObjectOutputStream) line: 380 GeneratedMethodAccessor139.invoke(Object, Object[]) line: not available DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25 Method.invoke(Object, Object...) line: 597 ObjectStreamClass.invokeWriteObject(Object, ObjectOutputStream) line: 945 ObjectOutputStream.writeSerialData(Object, ObjectStreamClass) line: 1461 ObjectOutputStream.writeOrdinaryObject(Object, ObjectStreamClass, boolean) line: 1392 ObjectOutputStream.writeObject0(Object, boolean) line: 1150 ObjectOutputStream.writeObject(Object) line: 326 StandardSession.writeObject(ObjectOutputStream) line: 1517 StandardSession.writeObjectData(ObjectOutputStream) line: 959 FileStore.save(Session) line: 372 PersistentManager(PersistentManagerBase).writeSession(Session) line: 868 PersistentManager(PersistentManagerBase).swapOut(Session) line: 839 PersistentManager(PersistentManagerBase).processMaxIdleSwaps() line: 1058 PersistentManager(PersistentManagerBase).processPersistenceChecks() line: 570 PersistentManager(PersistentManagerBase).processExpires() line: 551 PersistentManager(ManagerBase).backgroundProcess() line: 667 StandardContext(ContainerBase).backgroundProcess() line: 1316 ContainerBase$ContainerBackgroundProcessor.processChildren(Container, ClassLoader) line: 1601 ContainerBase$ContainerBackgroundProcessor.processChildren(Container, ClassLoader) line: 1610 ContainerBase$ContainerBackgroundProcessor.processChildren(Container, ClassLoader) line: 1610 ContainerBase$ContainerBackgroundProcessor.run() line: 1590 Thread.run() line: 619 I've configured a minIdleTime of 120 seconds so I don't think tomcat swaps the session out
Re: null lastPage at restoreAfterSerialization
The last one of the saga for now, I badly need to sleep. I've been sampling tomcat work dir every second: i=0; while [[ i -le 300 ]]; do echo $i; ls -lt /u01/tomcatWork/_ /tmp/work$i; sleep 1; i=$((i + 1)); done Then I greped a number of session ids corresponding to restoreAfterSerialization errors and every one of them appears in zero or one samples at most. With maxIdleTime = 120 secs the pattern is this: /u01/tomcatWork/_/wicketServlet-fileStore/sessionid created at T - 120 secs /u01/tomcatWork/_/sessionid.session swapped out at T - serialized restoreAfterSerialization error expired at ~T - deserialized The life span of /u01/tomcatWork/_/sessionid.session is of a fraction of a second. So the problem seems to be definitely related to short lived sessions that are removed immediately after being swapped out. The session is removed sooner than expected because of the exception that is thrown attempting to deserialize the lastPage. This is clear from inspection of tomcat's StoreBase.processExpires: try { StandardSession session = (StandardSession) load(keys[i]); -- load fails . if (session.isValid()) { continue; -- ideally we should be here } . remove(session.getIdInternal()); } catch (Exception e) { . remove(keys[i]); -- but instead /u01/tomcatWork/_/sessionid.session is prematurely removed here } HIH -Carlos On Wed, Nov 19, 2008 at 7:34 AM, Carlos Pita [EMAIL PROTECTED] wrote: Another fact that could be relevant is that this only happens upon processexpires, but never for swapin, which seems to suggest that the span of the sessions that fail to restore is just one request (maybe the ones coming from bots that don't support cookies). Best regards -Carlos On Wed, Nov 19, 2008 at 7:13 AM, Carlos Pita [EMAIL PROTECTED] wrote: Hi all, as I've a requirement to maintain long lived sessions (~120s) I'm using tomcat's PersistentManager to avoid keeping lots of sessions in memory, each one with its own lastPage. I'm observing, specially in a heavy loaded production environment, permanent errors with a trace like Nov 19, 2008 1:56:20 AM org.apache.catalina.session.StoreBase processExpires SEVERE: Session: 115F3CD5A33E7D941AF8971FA62DE270; java.lang.IllegalArgumentException: Unknown object type null at org.apache.wicket.protocol.http.pagestore.DiskPageStore.restoreAfterSerialization(DiskPageStore.java:1214) at org.apache.wicket.protocol.http.SecondLevelCacheSessionStore$SecondLevelCachePageMap.readObject(SecondLevelCacheSessionStore.java:409) at sun.reflect.GeneratedMethodAccessor85.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1849) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351) at org.apache.catalina.session.StandardSession.readObject(StandardSession.java:1441) at org.apache.catalina.session.StandardSession.readObjectData(StandardSession.java:942) at org.apache.catalina.session.FileStore.load(FileStore.java:296) at org.apache.catalina.session.StoreBase.processExpires(StoreBase.java:195) at org.apache.catalina.session.PersistentManagerBase.processExpires(PersistentManagerBase.java:553) at org.apache.catalina.session.ManagerBase.backgroundProcess(ManagerBase.java:667) I've managed myself to reproduced this error in a more controlled environment and I discovered that tomcat's manager background thread is swapping out the session at a moment where lastPage == null. SecondLevelCacheSessionStore$SecondLevelCachePageMap [line: 380] if (sessionId != null store instanceof IClusteredPageStore == false) { Object page = lastPage; if (store instanceof ISerializationAwarePageStore)--- conditional breakpoint if page == null { Daemon Thread [ContainerBackgroundProcessor[StandardEngine[Catalina]]] (Suspended (breakpoint at line 380 in SecondLevelCacheSessionStore$SecondLevelCachePageMap)) SecondLevelCacheSessionStore$SecondLevelCachePageMap.writeObject(ObjectOutputStream) line: 380 GeneratedMethodAccessor139.invoke(Object, Object[]) line: not available DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25 Method.invoke(Object, Object...) line: 597 ObjectStreamClass.invokeWriteObject(Object
Re: null lastPage at restoreAfterSerialization
Hi Matej, I'm browsing your changes. Please notice that according to my own debugging it's lastPage itself that is null and not only the result of prepareForSerialization. So I don't think the warning PageStore prepared non-null page as null for serialization will ever be reached. Anyway, I will add other warnings and keep you informed of the output as soon as I can. This is really tricky to debug because up til today I'm only able to reproduce it at full scale in a production environment. Do you have any idea why a lastPage would be null after 120 secs of the request that created the session? Specially for sessions that don't survive that first request. An exception that could avoid request cycle to detach the session maybe? Thanks! -Carlos On Wed, Nov 19, 2008 at 7:18 PM, Matej Knopp [EMAIL PROTECTED] wrote: This really is weird. I added couple of warnings and null check to 1.4 trunk. I wonder if that helps it though. -Matej On Wed, Nov 19, 2008 at 12:44 PM, Carlos Pita [EMAIL PROTECTED] wrote: The last one of the saga for now, I badly need to sleep. I've been sampling tomcat work dir every second: i=0; while [[ i -le 300 ]]; do echo $i; ls -lt /u01/tomcatWork/_ /tmp/work$i; sleep 1; i=$((i + 1)); done Then I greped a number of session ids corresponding to restoreAfterSerialization errors and every one of them appears in zero or one samples at most. With maxIdleTime = 120 secs the pattern is this: /u01/tomcatWork/_/wicketServlet-fileStore/sessionid created at T - 120 secs /u01/tomcatWork/_/sessionid.session swapped out at T - serialized restoreAfterSerialization error expired at ~T - deserialized The life span of /u01/tomcatWork/_/sessionid.session is of a fraction of a second. So the problem seems to be definitely related to short lived sessions that are removed immediately after being swapped out. The session is removed sooner than expected because of the exception that is thrown attempting to deserialize the lastPage. This is clear from inspection of tomcat's StoreBase.processExpires: try { StandardSession session = (StandardSession) load(keys[i]); -- load fails . if (session.isValid()) { continue; -- ideally we should be here } . remove(session.getIdInternal()); } catch (Exception e) { . remove(keys[i]); -- but instead /u01/tomcatWork/_/sessionid.session is prematurely removed here } HIH -Carlos On Wed, Nov 19, 2008 at 7:34 AM, Carlos Pita [EMAIL PROTECTED] wrote: Another fact that could be relevant is that this only happens upon processexpires, but never for swapin, which seems to suggest that the span of the sessions that fail to restore is just one request (maybe the ones coming from bots that don't support cookies). Best regards -Carlos On Wed, Nov 19, 2008 at 7:13 AM, Carlos Pita [EMAIL PROTECTED] wrote: Hi all, as I've a requirement to maintain long lived sessions (~120s) I'm using tomcat's PersistentManager to avoid keeping lots of sessions in memory, each one with its own lastPage. I'm observing, specially in a heavy loaded production environment, permanent errors with a trace like Nov 19, 2008 1:56:20 AM org.apache.catalina.session.StoreBase processExpires SEVERE: Session: 115F3CD5A33E7D941AF8971FA62DE270; java.lang.IllegalArgumentException: Unknown object type null at org.apache.wicket.protocol.http.pagestore.DiskPageStore.restoreAfterSerialization(DiskPageStore.java:1214) at org.apache.wicket.protocol.http.SecondLevelCacheSessionStore$SecondLevelCachePageMap.readObject(SecondLevelCacheSessionStore.java:409) at sun.reflect.GeneratedMethodAccessor85.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1849) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351) at org.apache.catalina.session.StandardSession.readObject(StandardSession.java:1441) at org.apache.catalina.session.StandardSession.readObjectData(StandardSession.java:942) at org.apache.catalina.session.FileStore.load(FileStore.java:296) at org.apache.catalina.session.StoreBase.processExpires(StoreBase.java:195) at org.apache.catalina.session.PersistentManagerBase.processExpires(PersistentManagerBase.java:553) at org.apache.catalina.session.ManagerBase.backgroundProcess(ManagerBase.java:667) I've managed myself to reproduced this error in a more controlled environment and I
Re: Wicket Widget
Hi, you are working with html. seems like a resonable approach from our end of things. I agree. Well, I've postprocessed the output through a couple of regexps because the task was too simple to be done by xslt or dom machinery. But now I've hit another problem: links are generated relative to current page, which is not desired when finally embedding the gadget in its host. Is there a way to force wicket to generate absolute urls for the page being rendered? I mean for ajax events, js and css references, image srcs... everywhere. Thanks again. Best regards -Carlos i would say just run it through xslt to transform it to whatever you need. -igor On Tue, Jul 8, 2008 at 8:53 AM, Carlos Pita [EMAIL PROTECTED] wrote: Hi all, I'm looking for a fine and dandy (or just fine) way to create widgets for igoogle, facebook and others. I would like to reuse our wicket components and pages because the widgets are not that different from our site but a shrunk version of it. The main problem I'm facing is that wicket output seems to unavoidably consist of html (with corresponding head and body tags) while widgets are required to conform to different syntaxes by their respective hosts in order to be embedded. Is there a way to generate xml so that stylesheets and javascript appear inside the main tag, this being an arbitrarily chosen one, other than postprocessing the html output? Another more general way to put the question is if there is a way to produce a more or less arbitrary xml from the markup templates. But I guess the answer is no because of how wicket components handle header tags (js, css contributions). In that case, what would you recommend? A postprocessing behavior? Thank you in advance Best regards -Carlos - 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]
Wicket Widget
Hi all, I'm looking for a fine and dandy (or just fine) way to create widgets for igoogle, facebook and others. I would like to reuse our wicket components and pages because the widgets are not that different from our site but a shrunk version of it. The main problem I'm facing is that wicket output seems to unavoidably consist of html (with corresponding head and body tags) while widgets are required to conform to different syntaxes by their respective hosts in order to be embedded. Is there a way to generate xml so that stylesheets and javascript appear inside the main tag, this being an arbitrarily chosen one, other than postprocessing the html output? Another more general way to put the question is if there is a way to produce a more or less arbitrary xml from the markup templates. But I guess the answer is no because of how wicket components handle header tags (js, css contributions). In that case, what would you recommend? A postprocessing behavior? Thank you in advance Best regards -Carlos - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Page serialization and reloading don't get on
You should be aware that you now disabled the serialization, which may cause problems on your production environment if you don't pay Of course, I'm proposing this just for development environments that use the reloading filter. Thanks for the remark, anyway. Perhaps I should have been clearer, as I'm throwing this in the open. Regards -Carlos Martijn On 2/19/08, Carlos Pita [EMAIL PROTECTED] wrote: Just in case someone else is having the same problem, I solved it for the time being overriding @Override protected ISessionStore newSessionStore() { return new HttpSessionStore(this); } in my app. The default configuration of my jetty embedded launcher seems to keep the session in memory, so it works out of the box. But other servers could offer other default session store strategies. Regards -Carlos On Feb 19, 2008 6:02 PM, Carlos Pita [EMAIL PROTECTED] wrote: Hi all, I've finally taken the time to trace some insidious reloading filter bugs that tend to show up as: org.apache.wicket.WicketRuntimeException: Parameter clazz must be an instance of com.livra.cereza.web.user.login.LoginPage, but is a com.livra.cereza.web.layout.CerezaPage at org.apache.wicket.markup.MarkupCache.getMarkup(MarkupCache.java:269) The frequency of these bugs have lately reached a level that rendered the reloading filter almost useless. The problem is simple: pages are loaded by the reloading classloader, then serialized into diskpagestore, then deserialized (diskpagestore.sessionentry.loadpage) in the context of a page loaded by another classloader. So they change their classloaders from one request to the next. markupcache tries to compare page classes from different classloaders, one coming directly or indirectly from the store, the other not, and the history ends in an exception trace that starts like the one above. Workarounds that come into my mind: *) deserialize pages in the context of the wicketfilter classloader, *) use in-memory store for working with the reloading classloader. What do you think? Jean Baptiste? Thank you in advance Regards -Carlos - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Buy Wicket in Action: http://manning.com/dashorst Apache Wicket 1.3.1 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.1 - 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: Page serialization and reloading don't get on
Something like this will do the trick: class PickyHttpSessionStore extends HttpSessionStore { public PickyHttpSessionStore(Application application) { super(application); } @Override public void setAttribute(Request request, String name, Object value) { try { ObjectOutputStream stream = new ObjectOutputStream(new ByteArrayOutputStream()); stream.writeObject(value); stream.close(); } catch (IOException exception) { throw new RuntimeException(Unable to serialize value, exception); } super.setAttribute(request, name, value); } } That said, this will only show error log entries, because of the catch in RequestCycle: try { getSession().requestDetached(); } catch (RuntimeException re) { log.error(there was an error detaching the request from the session + session + ., re); } I would like to see an error page instead, errors of this kind end up showing themselves as obscure page expiration issues that are hard to trace if you don't know where to look. Regards -Carlos On Feb 19, 2008 7:59 PM, Carlos Pita [EMAIL PROTECTED] wrote: Of course, I'm proposing this just for development environments that use the reloading filter. Thanks for the remark, anyway. Perhaps I should have been clearer, as I'm throwing this in the open. Of course it is only a concern when you will deploy with the disk store, and develop with the memory store. If you deploy using the memory store, there isn't much of a problem I suppose. Mh, now that I think about it twice, a drawback of this approach is that you won't be getting page expiration errors and unable to serialize logs due to non-serializable components until production time. Maybe a better alternative is to code a new dummy session store that keeps the session in memory but at the same time being picky about serialization issues, in order to detect errors earlier. I'll wrote something like this and post it later. Regards -Carlos Martijn -- Buy Wicket in Action: http://manning.com/dashorst Apache Wicket 1.3.1 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.1 - 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]
Reloading on demand (a different approach to reloading)
Hi all, I have worked out a reloading classloader (loosely inspired by Jean Baptiste's one) that reloads classes upon entering of an http request, instead of monitoring and reloading on saved changes. There are 2 observations that motivated me to implement this variant: 1) the current reloading classloader does a considerable amount of unnecessary work reloading every tiny change. Normally I make more than one change to one or more files before refreshing the browser page to see the results. And I tend to hit ctrl-s multiple times even while staying in the same file to refresh ide assistance information. This is perceived as a loop of reloadings in the reloading classloader log output and use to be slow, just as if the reloader is cycling out of control. Sometimes it's faster to restart the app. 2) the last change to code occurs immediately before refreshing the browser page. So there's no significant idle time before the last source code edition and the following page refresh, that is, no idle time that a monitoring background reloader could take advantage of. You will have to wait a bit in both cases to see the changes taking effect. So on-demand reloading will reload all changes since last request, dropping one classloader and reinitializing the app just once between request and request. Of course, if no change occurs in the middle reloading won't take place. On the overall this will be faster and less resource intensive, and there is no perceivable latency added by the on-demand approach (due to (2)). Moreover, the changed resource scanning step that happens on every request represents no appreciable overhead. In practice I've been using this for a while with results that confirm the above. I will like to wait a bit more before firmly concluding anything, but if your are interested below is the untested, unreliable code, which is quite simple in fact: public class ExampleServlet extends WicketServlet { @Override protected WicketFilter newWicketFilter() { return new WicketReloadingFilter() {{ watch(com\\.livra\\.(cereza|common)\\.web.*); // -- patterns are regexps ignore(com\\.livra\\.cereza\\.web.CerezaClient); }}; } } - Filter that uses the reloader public class WicketReloadingFilter extends WicketFilter { private ClassReloader classReloader; private FilterConfig filterConfig; public WicketReloadingFilter() { classReloader = new ClassReloader(getClass().getClassLoader()); } public void ignore(String pattern) { classReloader.ignore(pattern); } public void watch(String pattern) { classReloader.watch(pattern); } @Override public void init(FilterConfig filterConfig) throws ServletException { this.filterConfig = filterConfig; super.init(filterConfig); } @Override public void doGet(HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws ServletException, IOException { if (classReloader.hasChanges()) { classReloader = classReloader.clone(); try { super.init(filterConfig); } catch (ServletException e) { throw new RuntimeException(e); } } super.doGet(servletRequest, servletResponse); } @Override protected ClassLoader getClassLoader() { return classReloader; } } - Reloader itself public class ClassReloader extends URLClassLoader { @SuppressWarnings(unused) private static Logger logger = Logger.getLogger(ClassReloader.class); private ListPattern watchPatterns = new ArrayListPattern(); private ListPattern ignorePatterns = new ArrayListPattern(); private long lastReload; private SetClass? loadedClasses = new HashSetClass?(); public ClassReloader(ClassLoader parent) { super(new URL[] {}, parent); lastReload = new Date().getTime(); EnumerationURL resources; try { resources = parent.getResources(); } catch (IOException exception) { throw new RuntimeException(exception); } while (resources.hasMoreElements()) { addURL(resources.nextElement()); } } public void watch(String pattern) { watchPatterns.add(Pattern.compile(pattern)); } public void ignore(String pattern) { ignorePatterns.add(Pattern.compile(pattern)); } @Override public Class? loadClass(String name) throws ClassNotFoundException { Class? clazz = findLoadedClass(name); if (clazz == null mustWatch(name)) { try { clazz = super.findClass(name); loadedClasses.add(clazz); } catch (ClassNotFoundException exception) {} }
Mounting shared resources
Hi all, is it possible to alias resource paths like /resources/scope/name to simply, say, /mount_point/name? I know there is a scope alias for shared resources, but that only works for the scope (class) part of the path, so it can't get shorter that /resources/alias/path. Then there is the mountSharedResource method, but it works on resource by resource basis. Instead, I need to alias the path for a big number of resources (for example, static images for my application). Ideally, I would like my images, following the previous example, to be requested as: wicket:linkimg src=img/some_image.gif//wicket:link Any chance to get this? Thank you in advance. Regards, Carlos - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Mounting shared resources
Hi edvin, pictures are not my only goal, I would like to serve compressed js and css also, and to take advantage of wicket resource caching (http header generation). Anyway, I wrote a simple requesttargeturlcodingstrategy that fulfills my needs. If anyone is interested, here it is: public class SharedResourcesRequestTargetUrlCodingStrategy extends AbstractRequestTargetUrlCodingStrategy { private String keyPrefix; public SharedResourcesRequestTargetUrlCodingStrategy(String mountPath, Class? scope) { this(mountPath, scope, mountPath.substring(1)); } public SharedResourcesRequestTargetUrlCodingStrategy(String mountPath, Class? scope, String namePrefix) { super(mountPath); this.keyPrefix = scope.getCanonicalName() + / + namePrefix; } public IRequestTarget decode(RequestParameters requestParameters) { String name = requestParameters.getPath ().substring(getMountPath().length()); requestParameters.setResourceKey(keyPrefix + name); return new SharedResourceRequestTarget(requestParameters); } public CharSequence encode(IRequestTarget requestTarget) { String key = ((ISharedResourceRequestTarget)requestTarget).getResourceKey(); return getMountPath() + key.substring(keyPrefix.length()); } public boolean matches(IRequestTarget requestTarget) { if (!(requestTarget instanceof ISharedResourceRequestTarget)) return false; String key = ((ISharedResourceRequestTarget)requestTarget).getResourceKey(); return key.startsWith(keyPrefix); } } Thank you Regards -Carlos On Feb 1, 2008 6:31 PM, Edvin Syse [EMAIL PROTECTED] wrote: Then there is the mountSharedResource method, but it works on resource by resource basis. Instead, I need to alias the path for a big number of resources (for example, static images for my application). Ideally, I would like my images, following the previous example, to be requested as: wicket:linkimg src=img/some_image.gif//wicket:link If your goal is just to supply static pictures and don't have programmatically control over them, why don't you just create an img-folder in your webroot? Then pictures will be served by your container instead of Wicket :) -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Experiences with ReloadingWicketFilter
A time ago I filed a bug relating markup inheritance with the reloading servlet (although inline frames are involved too in my somewhat contrived example). Enjoy the cocktail here https://issues.apache.org/jira/browse/WICKET-965.https://issues.apache.org/jira/browse/WICKET-965 Regards, Carlos On 9/25/07, Peter Thomas [EMAIL PROTECTED] wrote: On 9/25/07, Jean-Baptiste Quenot [EMAIL PROTECTED] wrote: * Peter Thomas: Soto confirmmy understanding,when usingthe ReloadingWicketFilter, when you make a change to a Page you have to re-trace navigation to a point prior to where the Page is loaded. Is that correct? You have to make sure you're not using an instance of a page loaded in a previous classloader, ie make sure not to keep an instance of a page across reloads. I'm justhoping that something canbe done (or un-done) to improve the developer experience when using ReloadingWicketFilter. To be honest ReloadingWicketFilter is a hack to work around how the JVM loads classes, and it is bootstrapped during the Wicket application initialization. If ReloadingWicketFilter is causing more problems than it is meant to solve, we might simply want to remove it from Wicket, especially if it proves to be unreliable in complex setups. Unless you're willing to turn your hope into contribution? That's a little harsh. Have a look in the JIRA and I've repeatedly said how much I appreciate the RWF and even the way it works now (even citing it as the reason for not moving to groovy!). Thanks for the gentle reminder that I should quit whining about this. I'm not a master of classloading and it is unlikely I contribute anything in this area. Have you seen my suggestion to clear your session cookie before reloading the page BTW? All this is very complicated I realize, but there's not much we can do to simplify reloading. -- I saw your suggestion on clearing cookies, thanks. I'll say this one last time and then shut up - I completely understand that this is a hack and all - but it used to work the way I expected and at least one other user felt the same. I was just pushing my luck (at the risk of losing mailing-list karma) because as the other user said, once you have experienced page refresh reload of classes it is very hard to go back. But you are saying nothing more can be done, and I respect the opinion of the Wicket committers on this and I can live with how it is now. I completely appreciate the work that you and other Wicket committers have put into RWF and it is a huge time saver in its current form. Thanks, Peter.
Re: More extend points
You can use border/body in a similar way than child/extend. Also, if the form incarnations haven't a lot of common markup between them, you can use the form as the webmarkupcontainer it is and put its logic in one place but the markup everywhere the form is. Regards, Carlos On 9/14/07, fero [EMAIL PROTECTED] wrote: Hi, is it possible to have more than one wicket:extend on one page. I want to make an universal page with form. This form has some common features, but I want to extend it. I want to extend the page as well (to put some panels under the form) but not always. I don't want to code a Form as a Panel and extend this form, because then I will have too many html files. Thanks Fero -- View this message in context: http://www.nabble.com/More-extend-points-tf4442899.html#a12676475 Sent from the Wicket - User mailing list archive at Nabble.com. - 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: How to create my own components with HiddenFiled and TextField
What about PropertyModel with TextField and HiddenField, the usual way? add(new HiddenField(hiddenField, new PropertyModel(bean, property1))); add(new TextField(displayField, new PropertyModel(bean, property2))); Regards, Carlos On 9/13/07, Kevin Liu [EMAIL PROTECTED] wrote: Hi! I wanna create my own components with HiddenField and TextField This is HTML: wicket:panel input type=hidden wicket:id=hiddenFiled/input input type=text wicket:id=displayField/input /wicket:panel But I have no idea about which kind of IModel to use to bind a POJO. Thank you~ -Kevin Liu - Moody friends. Drama queens. Your life? Nope! - their life, your story. Play Sims Stories at Yahoo! Games. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: PageLink and markup inheritance problem
Sorry for the delay Igor, not exactly what you asked for but I have filed a new bug with an attached example that is probably closely related to this issue. https://issues.apache.org/jira/browse/WICKET-965 Regards, Carlos On 9/7/07, Igor Vaynberg [EMAIL PROTECTED] wrote: can you build a quickstart that reproduces it? -igor On 9/7/07, Carlos Pita [EMAIL PROTECTED] wrote: I'm getting the exception below when following a PageLink, but not with a BookmarkablePageLink. This wasn't happening with previous 1.3 snapshots (I updated my wicket copy this morning). The PageLink is created by the (id,class) constructor this way: new PageLink(id, ChangePasswordPage.class) ChangePasswordPage is a MyAccountLayout, markup inheritance takes place here. The markup is fine as I can open the page by the name it's mounted or using the bookmarkable link, as I said before. Any ideas? Thank you in advance Carlos --- Unexpected RuntimeException WicketMessage: Markup of type 'html' for component 'com.livra.web.user.myaccount.ChangePasswordPage' not found. Enable debug messages for org.apache.wicket.util.resource to get a list of all filenames tried: [Page class = com.livra.web.user.myaccount.ChangePasswordPage, id = 8, version = 0] Root cause: org.apache.wicket.WicketRuntimeException: Parameter clazz must be an instance of com.livra.web.user.myaccount.ChangePasswordPage, but is a com.livra.web.user.myaccount.MyAccountLayout at org.apache.wicket.markup.MarkupCache.getMarkup(MarkupCache.java:270) at org.apache.wicket.markup.loader.InheritedMarkupMarkupLoader.checkForMarkupInheritance (InheritedMarkupMarkupLoader.java:99) at org.apache.wicket.markup.loader.InheritedMarkupMarkupLoader.loadMarkup( InheritedMarkupMarkupLoader.java:65) at org.apache.wicket.markup.loader.DefaultMarkupLoader.loadMarkup( DefaultMarkupLoader.java:56) at org.apache.wicket.markup.MarkupCache.loadMarkup(MarkupCache.java:415) at o - 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: PageLink and markup inheritance problem
Mh... my checkout is less than a week old, but I will update it tomorrow and try the example again. Maybe it was fixed these days. Regards, Carlos On 9/12/07, Gerolf Seitz [EMAIL PROTECTED] wrote: i tried the example you attached to the issue, but there is no exception thrown. i tried it with beta3 and latest trunk. both work as expected. gerolf On 9/13/07, Carlos Pita [EMAIL PROTECTED] wrote: Sorry for the delay Igor, not exactly what you asked for but I have filed a new bug with an attached example that is probably closely related to this issue. https://issues.apache.org/jira/browse/WICKET-965 Regards, Carlos On 9/7/07, Igor Vaynberg [EMAIL PROTECTED] wrote: can you build a quickstart that reproduces it? -igor On 9/7/07, Carlos Pita [EMAIL PROTECTED] wrote: I'm getting the exception below when following a PageLink, but not with a BookmarkablePageLink. This wasn't happening with previous 1.3 snapshots (I updated my wicket copy this morning). The PageLink is created by the (id,class) constructor this way: new PageLink(id, ChangePasswordPage.class) ChangePasswordPage is a MyAccountLayout, markup inheritance takes place here. The markup is fine as I can open the page by the name it's mounted or using the bookmarkable link, as I said before. Any ideas? Thank you in advance Carlos --- Unexpected RuntimeException WicketMessage: Markup of type 'html' for component 'com.livra.web.user.myaccount.ChangePasswordPage' not found. Enable debug messages for org.apache.wicket.util.resource to get a list of all filenames tried: [Page class = com.livra.web.user.myaccount.ChangePasswordPage, id = 8, version = 0] Root cause: org.apache.wicket.WicketRuntimeException: Parameter clazz must be an instance of com.livra.web.user.myaccount.ChangePasswordPage, but is a com.livra.web.user.myaccount.MyAccountLayout at org.apache.wicket.markup.MarkupCache.getMarkup(MarkupCache.java :270) at org.apache.wicket.markup.loader.InheritedMarkupMarkupLoader.checkForMarkupInheritance (InheritedMarkupMarkupLoader.java:99) at org.apache.wicket.markup.loader.InheritedMarkupMarkupLoader.loadMarkup( InheritedMarkupMarkupLoader.java:65) at org.apache.wicket.markup.loader.DefaultMarkupLoader.loadMarkup( DefaultMarkupLoader.java:56) at org.apache.wicket.markup.MarkupCache.loadMarkup(MarkupCache.java :415) at o - 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: Default focus behavior for ajax request
behavior if the event is onblur. Can you submit RFE? Done. I filed it as minor improvement https://issues.apache.org/jira/browse/WICKET-957. Because currently there is no way during ajax processing to determine that the event was a focus related one. I think that it's good to Maybe setting focusComponent to null by default for any AjaxEventBehavior whose event happens to be onblur or onchange will be enough. Even if done at the AjaxFormComponentUpdatingBehavior imo this will be a great relief for people who are implementing their first wicket ajax-validated forms and haven't a clue about the cause of such a strange focus behavior that suddenly possesses their browsers. Regards, Carlos - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Default focus behavior for ajax request
Dunno. Up till now my workaround is to set focusComponent to null at the server-side for validation purposes. I'm not suggesting that this should be wicket's approach or something similar, of course. Regards, Carlos On 9/11/07, Johan Compagner [EMAIL PROTECTED] wrote: see my comments in that issue. Its not that we have to do something on the serverside this is a clientside issue. johan On 9/11/07, Carlos Pita [EMAIL PROTECTED] wrote: behavior if the event is onblur. Can you submit RFE? Done. I filed it as minor improvement https://issues.apache.org/jira/browse/WICKET-957. Because currently there is no way during ajax processing to determine that the event was a focus related one. I think that it's good to Maybe setting focusComponent to null by default for any AjaxEventBehavior whose event happens to be onblur or onchange will be enough. Even if done at the AjaxFormComponentUpdatingBehavior imo this will be a great relief for people who are implementing their first wicket ajax-validated forms and haven't a clue about the cause of such a strange focus behavior that suddenly possesses their browsers. Regards, Carlos - 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: How to get a list of the connected users ?
Maybe you can write a session listener to intercept session destruction (give a look at servlet api, in particular HttpSessionListener). For sessions that do have an associated (logged in) user you can set the isConnected flag to false then. I wouldn't recommend keeping these flags in a persistent store anyway. A session manager that keeps an in-memory transient set of logged in users feels better to me. The users themselves need not to be kept all the time in memory, of course, that would swallow up resources. This way, if your application hangs up your currently logged in users state will disappear together with your sessions. Regards, Carlos On 9/11/07, landry soules [EMAIL PROTECTED] wrote: Hello, I have to display a list of the connected users in a page of my app. I know it sounds definitely dumb, but i don't know how to achieve this... Users login to my site (i extended AuthenticatedWebApplication), and then i update a isConnected flag in users table. Thus i display the connected users in a list view, retrieved by the isConnected flag. It implies of course that users will use a logoff button when they leave, which i don't believe they will do... I'm aware it's not a Wicket related problem, but a more generally web apps problem, but what is the best solution to deal with this ? Thanks for your answers. - 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: Accessing to session scope attribute
From wicket.Session javadoc: Arbitrary objects can be attached to a Session by installing a session factory on your Application class which creates custom Session subclasses that have typesafe properties specific to the application (see Application for details). To discourage non-typesafe access to Session properties, no setProperty() or getProperty() method is provided. That said, if you still want to set type unsafe properties, you can always access the HttpSession as ((WebRequest)getRequest()).getHttpServletRequest().getSession(). Also, if you use spring to manage your application layer you may want (I don't :)) to use a session scoped bean. Regards, Carlos On 9/11/07, Chris Colman [EMAIL PROTECTED] wrote: I need to store some data on a per session basis. What's the best approach in a wicket environment? 1. Should I create my own session factory and create a custom session class that stores the data as an attribute? OR 2. Go the old fashioned route and retrieve the J2?E HttpSession and store it in that using setAttribute(name, object); BTW how do we get access to the J2?E session in Wicket? OR 3. Something else I haven't thought of yet... - 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: Any way to apply wicket:link to a with contained img?
From my own experience most of the times the images in those links are taken from properties of some entity (say product or user) that is ultimately comming from a model, not just static resources. So you can't avoid the code counterpart anyway. Reagrds, Carlos On 9/11/07, mchack [EMAIL PROTECTED] wrote: I think it's a common case in most if not all web apps (hyperlinked images). It is so common that having to add code would cumbersome. I appreciate the component oriented aspect of the framework but really want to use it for more leveraged UI elements. I guess what I am looking to build is something analogous to the wicket:link tag that will work when encapsulating an aimg../ sequence. I assume this is possible and will review the code behind the wicket:link component. This will make it possible to achieve the appropriate behavior directly in the markup. Thanks Carlos Pita-4 wrote: If it's such a common case in your application write a (trivial) component for it, and add it to your hierarchy with a oneliner where it's needed. That's what componentization is mostly about, after all. Regards, Carlos -- View this message in context: http://www.nabble.com/Any-way-to-apply-wicket%3Alink-to-%3Ca%3E-with-contained-%3Cimg%3E--tf4425113.html#a12625672 Sent from the Wicket - User mailing list archive at Nabble.com. - 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: FileUpload with AjaxSubmit not working
Maybe you want to try this. Regards, Carlos On 8/30/07, Carlos Pita [EMAIL PROTECTED] wrote: Hi all, here is a hopefully functional example showing how to use an iframe to upload a file and afterwards call a behavior on a component belonging to the top frame, so that an ajax action could be carried on in consequence (maybe to get rid of the iframe, or to show an informative message, or whatever). This is along the same venue as other examples that are around the web, like http://www.air4web.com/files/upload/. I don't have the time to write a proper wiki page just right now, so I simply attach the example here. Hope it helps. Regards, Carlos - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FileUpload with AjaxSubmit not working
With the attachment, of course :). On 9/10/07, Carlos Pita [EMAIL PROTECTED] wrote: Maybe you want to try this. Regards, Carlos On 8/30/07, Carlos Pita [EMAIL PROTECTED] wrote: Hi all, here is a hopefully functional example showing how to use an iframe to upload a file and afterwards call a behavior on a component belonging to the top frame, so that an ajax action could be carried on in consequence (maybe to get rid of the iframe, or to show an informative message, or whatever). This is along the same venue as other examples that are around the web, like http://www.air4web.com/files/upload/. I don't have the time to write a proper wiki page just right now, so I simply attach the example here. Hope it helps. Regards, Carlos upload.tgz Description: GNU Zip compressed data - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Setting up a very simple login page
private Employee e; [...] public LoginForm(final String id) { super(id); setModel(new CompoundPropertyModel(e)); Notice that your model is null. Regards, Carlos On 9/10/07, Cristina [EMAIL PROTECTED] wrote: Hello, I'm trying to set up a simple login page where the password is retrieved from the DB if the username exists. The page is rendered as it should but I get a *WicketMessage: Null object setting value: bsouza with expression: login* when I enter a valid login (bsouza) and his password. Since the code is quite short I'll reproduce it below: public class LoginPage extends JDJStaticPage { private Employee e; private TextField login; private PasswordTextField pword; public LoginPage() { add(new FeedbackPanel(feedback)); add(new LoginForm(form)); } private class LoginForm extends Form { public LoginForm(final String id) { super(id); setModel(new CompoundPropertyModel(e)); add(login = new TextField(login)); add(pword = new PasswordTextField(pword)); login.setRequired(true); } protected void onSubmit() { e = (Employee) SERVICE.findEmployeeByLogin(userLogin()); if (e != null) { // login is valid... if (userPword().equalsIgnoreCase(e.getPword())) { // password is correct... // setResponsePage(Home.class); // doesn't exist yet... } } else { error(Unable to sign you in.); // shows up in FeedbackPanel? } } private String userLogin() { return (login.getModelObjectAsString()); } private String userPword() { return(pword.getModelObjectAsString()); } } } Thanks for your help, Cristina -- View this message in context: http://www.nabble.com/Setting-up-a-very-simple-login-page-tf4419382.html#a12605286 Sent from the Wicket - User mailing list archive at Nabble.com. - 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]
Default focus behavior for ajax request
Hi, why is the default behavior for ajax requests to force focus into some component (normally the one which triggered the event that caused the request, I guess)? This produces some bizarre situations when onfocus or onblur are used for ajax validation. For example, if the form component to be validated gets its focus transferred to some browser ui widget (for example, the location bar), triggering an onblur validation this way, it immediately recaptures focus after validation has been completed (making it impossible to type text at the location bar unless your fingers happen to be faster than the ajax rtt, to follow the example). A similar problem occurs with tinymce editor, at least. This behavior can be circumvented explicitly setting target.focusComponent(null) for validation purposes, but why is it not this way in the first place, at least for the focus related events? Is there any rationale behind this that I'm missing? Regards, Carlos - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
quechup.com spam
Hola / Hi, queria pedir disculpas y advertir a todo aquel que haya recibido una invitacion mia para quechup.com. Yo me registre por una invitacion que a mi vez recibi de un contacto de confianza, sin prestar demasiada atencion al procedimiento y sin saber muy bien de que se trataba. En determinado paso, la registracion brinda la posibilidad de averiguar que contactos de gmail se encuentran ya registrados en el sitio, y es claro que luego usan de mala fe los contactos importados para spamear (http://groups.google.es/group/Gmail-Users/browse_thread/thread/656ae3699f1c06d1). Hecho el descargo, proceda cada uno a su criterio respecto de la invitacion. I would like to apologize to and warn everyone that has recently received an invitation from mine to join quechup.com. I registered myself because of an invitation that I got from a trusted contact, without paying a lot of attention to the registration procedure and without a solid understanding of what quechup.com was about. At some step in the registration, they offer you the chance to find out which of your gmail contacts are already quechup members, and it's pretty obvious that afterwards they act in bad faith using this information to spam you contacts with new invitations (http://groups.google.es/group/Gmail-Users/browse_thread/thread/656ae3699f1c06d1). That said, act according to your own will regarding the invitation, of course. Saludos / Regards, Carlos - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
PageLink and markup inheritance problem
I'm getting the exception below when following a PageLink, but not with a BookmarkablePageLink. This wasn't happening with previous 1.3 snapshots (I updated my wicket copy this morning). The PageLink is created by the (id,class) constructor this way: new PageLink(id, ChangePasswordPage.class) ChangePasswordPage is a MyAccountLayout, markup inheritance takes place here. The markup is fine as I can open the page by the name it's mounted or using the bookmarkable link, as I said before. Any ideas? Thank you in advance Carlos --- Unexpected RuntimeException WicketMessage: Markup of type 'html' for component 'com.livra.web.user.myaccount.ChangePasswordPage' not found. Enable debug messages for org.apache.wicket.util.resource to get a list of all filenames tried: [Page class = com.livra.web.user.myaccount.ChangePasswordPage, id = 8, version = 0] Root cause: org.apache.wicket.WicketRuntimeException: Parameter clazz must be an instance of com.livra.web.user.myaccount.ChangePasswordPage, but is a com.livra.web.user.myaccount.MyAccountLayout at org.apache.wicket.markup.MarkupCache.getMarkup(MarkupCache.java:270) at org.apache.wicket.markup.loader.InheritedMarkupMarkupLoader.checkForMarkupInheritance(InheritedMarkupMarkupLoader.java:99) at org.apache.wicket.markup.loader.InheritedMarkupMarkupLoader.loadMarkup(InheritedMarkupMarkupLoader.java:65) at org.apache.wicket.markup.loader.DefaultMarkupLoader.loadMarkup(DefaultMarkupLoader.java:56) at org.apache.wicket.markup.MarkupCache.loadMarkup(MarkupCache.java:415) at o - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Twice Behavior on the same event handler (wicket 1.2.x)
Alex: We implemented a subclass of Form that has some sophisticated validation and customized feedback panels built-in. This form automatically instruments its fields with an ajax validating behavior. But sometimes -not that often- a field needs to ajax-do a bit more than just being validated, so this extra behavior is passed as a handler that knows how to react onSubmit and onError. Well, to the point: at first we implemented this extra behavior as sort of chained behavior, but then, as we found out that this generality was adding extra complexity and didn't really pay off, we moved out to a simpler schema with a handler implementing an onSubmit/onError barebones interface, to which the only behavior delegates at last. So now there is only one behavior and nothing that resembles a chain. In part, that's the reason why I feel that such a functionality is out of the scope of a general framework/toolkit as wicket is. Regards, Carlos On 9/6/07, Alex Objelean [EMAIL PROTECTED] wrote: I am curious, what is your use case for chaining behaviors? I think that if you have two things that you want to chain, then chain them in the same handler, or use decorator to add the client-side code. Alex paolo di tommaso wrote: Carlos, Can you provide an example of your custom implementation of chained behaviour? Thanks, Paolo On 9/6/07, Carlos Pita [EMAIL PROTECTED] wrote: Currently people will have to build it in themselves like you did. We can investigate whether this can be improved for future versions, but From my own experience I wouldn't say that wicket should support this. It's too easy to write it yourself just to fit your specific needs, and otoh seems difficult to predict and support a significant number of possible use cases in a general way that keeps everyone happy, as you remarked. Regards, Carlos Eelco - 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] -- View this message in context: http://www.nabble.com/Twice-Behavior-on-the-same-event-handler-%28wicket-1.2.x%29-tf4386351.html#a12518265 Sent from the Wicket - User mailing list archive at Nabble.com. - 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: Howto use AttributeModifier
Per, use a AbstractReadOnlyModel or a DetachableLoadableModel for the attribute value. Regards, Carlos On 9/6/07, Per Newgro [EMAIL PROTECTED] wrote: Ok. I tried the Attribute Modifier(String, String, boolean, Model) Constructor but it didn't worked. There have been exactly the same results. Thanks for your help Per Original-Nachricht Datum: Thu, 6 Sep 2007 15:34:14 +0200 Von: Gerolf Seitz [EMAIL PROTECTED] An: users@wicket.apache.org Betreff: Re: Howto use AttributeModifier you used the constructor AttributeModifer(String, String, Model), which only modifies the attribute if it's already there. if you use Attribute Modifier(String, String, boolean, Model), the attribute will be added to the tag in case it does not exist yet. gerolf -- Pt! Schon vom neuen GMX MultiMessenger gehört? Der kanns mit allen: http://www.gmx.net/de/go/multimessenger - 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: Howto use AttributeModifier
Or a PropertyModel. On 9/6/07, Carlos Pita [EMAIL PROTECTED] wrote: Per, use a AbstractReadOnlyModel or a DetachableLoadableModel for the attribute value. Regards, Carlos On 9/6/07, Per Newgro [EMAIL PROTECTED] wrote: Ok. I tried the Attribute Modifier(String, String, boolean, Model) Constructor but it didn't worked. There have been exactly the same results. Thanks for your help Per Original-Nachricht Datum: Thu, 6 Sep 2007 15:34:14 +0200 Von: Gerolf Seitz [EMAIL PROTECTED] An: users@wicket.apache.org Betreff: Re: Howto use AttributeModifier you used the constructor AttributeModifer(String, String, Model), which only modifies the attribute if it's already there. if you use Attribute Modifier(String, String, boolean, Model), the attribute will be added to the tag in case it does not exist yet. gerolf -- Pt! Schon vom neuen GMX MultiMessenger gehört? Der kanns mit allen: http://www.gmx.net/de/go/multimessenger - 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: Problem with DropDownChoice and AjaxFormComponentUpdatingBehavior
Now that I think about it: maybe input should be automatically cleared out in case the model is explicitly changed, don't you think? On 9/6/07, Carlos Pita [EMAIL PROTECTED] wrote: Maybe it's because your second and third dropdowns are taking their input from the posted parameters (the raw input) instead of from their model. See the source for FormComponent.getValue(): if (NO_RAW_INPUT.equals(rawInput)) { return getModelValue(); } else { if (getEscapeModelStrings() rawInput != null) { return Strings.escapeMarkup(rawInput).toString(); } return rawInput; } After submit, your dropdowns are probably taking the second branch. So in your updating behavior, try something like: protected void onUpdate(AjaxRequestTarget target) { dropDown2.clearInput(); --- reset input !!! dropDown2.setModelObject(null); target.addComponent(dropDown2); } This not only sets the second dropdown model to null but also resets its input. Regards, Carlos On 9/6/07, JulianS [EMAIL PROTECTED] wrote: I am using Wicket 1.2.6. I have 3 DropDownChoices (and some other fields) on a form. The first DropDownChoice resets the selections in the other DropDownChoices using AjaxFormComponentUpdatingBehavior(onchange). All the DropDownChoices use PropertyModels. This all works fine until the form is submitted and validation fails. In this (normal) situation the form is still visible, with the feedback messages displayed, but the 2nd and 3rd DropDownChoices no longer react to the first DropDownChoice. I have verified that the properties on which DropDownChoices depend are being correctly set. Is there anything I can do to make them behave properly? Any help is appreciated. Thanks, Julian -- View this message in context: http://www.nabble.com/Problem-with-DropDownChoice-and-AjaxFormComponentUpdatingBehavior-tf4394596.html#a12531138 Sent from the Wicket - User mailing list archive at Nabble.com. - 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: Problem with DropDownChoice and AjaxFormComponentUpdatingBehavior
I've debugged a simple example and what I described before happens to the letter, both for ajax updating behavior and for wantOnSelectionChangedNotifications/onSelectionChanged. I don't think it's a bug at all, but imo it would be reasonable to clear out the input if the explicit intention of changing the formcomponent value (through the model object in this case) is there. Anyway, maybe this is not related to JulianS' problem. Do you want the example? Regards, Carlos On 9/7/07, Igor Vaynberg [EMAIL PROTECTED] wrote: does it work properly without ajax? -igor On 9/6/07, JulianS [EMAIL PROTECTED] wrote: I am using Wicket 1.2.6. I have 3 DropDownChoices (and some other fields) on a form. The first DropDownChoice resets the selections in the other DropDownChoices using AjaxFormComponentUpdatingBehavior(onchange). All the DropDownChoices use PropertyModels. This all works fine until the form is submitted and validation fails. In this (normal) situation the form is still visible, with the feedback messages displayed, but the 2nd and 3rd DropDownChoices no longer react to the first DropDownChoice. I have verified that the properties on which DropDownChoices depend are being correctly set. Is there anything I can do to make them behave properly? Any help is appreciated. Thanks, Julian -- View this message in context: http://www.nabble.com/Problem-with-DropDownChoice-and-AjaxFormComponentUpdatingBehavior-tf4394596.html#a12531138 Sent from the Wicket - User mailing list archive at Nabble.com. - 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: Problem with DropDownChoice and AjaxFormComponentUpdatingBehavior
That's because of JualianS' use case. Changing the first dropdown should reset the second and third ones' model to null. Maybe it's a Country/State/City trio. Suppose the model of the first was Argentina and the model of the second was Buenos Aires when submission was done (of course, this is possible because the individual dropdown models are being updated by means of updating behaviors before form submission). Validation fails due to some other reason, then you set country to -say- Afghanistan, and try to reset the state model from the same onchange updating behavior. But as state it's still reading its value from the raw input Buenos Aires, you won't get it resetted until you also clear this input. Regards, Carlos On 9/7/07, Igor Vaynberg [EMAIL PROTECTED] wrote: so the validation fails yet you are still updating the models??? -igor On 9/6/07, Carlos Pita [EMAIL PROTECTED] wrote: I've debugged a simple example and what I described before happens to the letter, both for ajax updating behavior and for wantOnSelectionChangedNotifications/onSelectionChanged. I don't think it's a bug at all, but imo it would be reasonable to clear out the input if the explicit intention of changing the formcomponent value (through the model object in this case) is there. Anyway, maybe this is not related to JulianS' problem. Do you want the example? Regards, Carlos On 9/7/07, Igor Vaynberg [EMAIL PROTECTED] wrote: does it work properly without ajax? -igor On 9/6/07, JulianS [EMAIL PROTECTED] wrote: I am using Wicket 1.2.6. I have 3 DropDownChoices (and some other fields) on a form. The first DropDownChoice resets the selections in the other DropDownChoices using AjaxFormComponentUpdatingBehavior(onchange). All the DropDownChoices use PropertyModels. This all works fine until the form is submitted and validation fails. In this (normal) situation the form is still visible, with the feedback messages displayed, but the 2nd and 3rd DropDownChoices no longer react to the first DropDownChoice. I have verified that the properties on which DropDownChoices depend are being correctly set. Is there anything I can do to make them behave properly? Any help is appreciated. Thanks, Julian -- View this message in context: http://www.nabble.com/Problem-with-DropDownChoice-and-AjaxFormComponentUpdatingBehavior-tf4394596.html#a12531138 Sent from the Wicket - User mailing list archive at Nabble.com. - 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]
Aspectj loadtime weaving and reloading servlet
Hi all, I'm using a tad of loadtime weaving in a very selective way: just a number of classes in the service layer are being woven. For doing this, aspectj weaver is installed as a java agent and configured to monitor no more than the classes to advice. At the same time, some patterns are included to drive wicket servlet reloading limited to the web layer. Both layers are deployed into disjoint packages. Regardless of this, each time I introduce some modification into a, say, wicket page, I get the following log output: [EMAIL PROTECTED] info AspectJ Weaver Version DEVELOPMENT built on Monday May 21, 2007 at 13:36:36 GMT [EMAIL PROTECTED] info register classloader [EMAIL PROTECTED] [EMAIL PROTECTED] info using configuration /home/carlos/dev/java/eclipse/wicket-tests/target/classes/META-INF/aop.xml [EMAIL PROTECTED] warning ignoring duplicate definition: file:/home/carlos/dev/java/eclipse/wicket-tests/target/classes/META-INF/aop.xml [EMAIL PROTECTED] info register aspect web.aspects.SecureAspect *** WARNING: Wicket is running in DEVELOPMENT mode. *** *** ^^^*** *** Do NOT deploy to your live server(s) without changing this. *** *** See Application#getConfigurationType() for more information. *** It is as if the weaver is forced to reinitialize itself or something. Do you think this is normal or a symptom of ill configured classloaders? Thank you in advance. Regards, Carlos
Re: Aspectj loadtime weaving and reloading servlet
That is the customary message the reloading servlet shows after reloading any changes. What is new is the output from the weaver above it. I guess the reloading classloader has to reinstantiate itself in order to load new versions of the same old classes, and this is notified to the weaver java agent so that it can take consecutive actions. But it's just a supposition. Maybe Jean Baptiste would be able to throw some light on the question? Regards, Carlos On 9/2/07, Igor Vaynberg [EMAIL PROTECTED] wrote: in that case no clue. from the output looks like the wicket application is being restarted? that means the servlet context is being reinitialized...why it would do that i dont know -igor On 9/2/07, Carlos Pita [EMAIL PROTECTED] wrote: No, just a custom jetty launcher (I think it's based on your own code that you kindly pasted in papernapkin a time ago :) ). Maybe the java agent is being notified of the reloading classloader reincarnation after a monitored class changed and braindeadly reloads its configuration. It's not causing a lot of overhead anyway. Regards, Carlos On 9/2/07, Igor Vaynberg [EMAIL PROTECTED] wrote: are you deploying on tomcat? i think tomcat monitors the dir and if it sees a change it reloads the webapp. you can canfig it not to do that. -igor On 9/2/07, Carlos Pita [EMAIL PROTECTED] wrote: Hi all, I'm using a tad of loadtime weaving in a very selective way: just a number of classes in the service layer are being woven. For doing this, aspectj weaver is installed as a java agent and configured to monitor no more than the classes to advice. At the same time, some patterns are included to drive wicket servlet reloading limited to the web layer. Both layers are deployed into disjoint packages. Regardless of this, each time I introduce some modification into a, say, wicket page, I get the following log output: [EMAIL PROTECTED] info AspectJ Weaver Version DEVELOPMENT built on Monday May 21, 2007 at 13:36:36 GMT [EMAIL PROTECTED] ] info register classloader [EMAIL PROTECTED] [EMAIL PROTECTED] info using configuration /home/carlos/dev/java/eclipse/wicket-tests/target/classes/META-INF/aop.xml [EMAIL PROTECTED] warning ignoring duplicate definition: file:/home/carlos/dev/java/eclipse/wicket-tests/target/classes/META-INF/aop.xml [EMAIL PROTECTED] info register aspect web.aspects.SecureAspect *** WARNING: Wicket is running in DEVELOPMENT mode. *** *** ^^^*** *** Do NOT deploy to your live server(s) without changing this. *** *** See Application#getConfigurationType() for more information. *** It is as if the weaver is forced to reinitialize itself or something. Do you think this is normal or a symptom of ill configured classloaders? Thank you in advance. Regards, Carlos
Re: RepeatingView : Removing a table row
See if this helps. I think your code is overly complicated. The attached example adds books to a listview and also allows to remove selected ones. Regards, Carlos On 8/27/07, pokkie [EMAIL PROTECTED] wrote: Carlos, I kind of got the code to work, but it doesn't feel right. Any help would be much appreciated 1. public void buildView() { 2. 3. final BookListView bookListView = new BookListView(bookListView, new ArrayList()); 4. 5. Button addBookButton = new Button(addBookButton) { 6. protected void onSubmit() { 7. String selectedBookName = The Travels Of John; 8. Book book = new Book(); 9. book.setBookName(selectedBookName); 10. 11. ListBook books = new ArrayListBook(); 12. books.add(book); 13. 14. BookModel bookModel = new BookModel(books); 15. 16. ListItem bookItem = new ListItem(bookListView.getModelIndex(), bookModel); 17. bookListView.populateItem(bookItem); 18. bookListView.setModel(bookModel); 19. bookListView.modelChanged(); 20. } 21. }; 22. } 23. 24. private class BookModel implements IModel { 25. 26. private List bookList; 27. 28. public BookModel(List bookList) { 29. this.bookList = bookList; 30. } 31. 32. public IModel getNestedModel() { 33. return null; 34. } 35. 36. public Object getObject(final Component component) { 37. return bookList; 38. } 39. 40. public void setObject(final Component component, final Object object) { 41. } 42. 43. public void detach() { 44. } 45. } 46. 47. private class BookListView extends ListView { 48. 49. private int modelIndex; 50. 51. public BookListView(final String id, final List list) { 52. super(id, list); 53. } 54. 55. protected void populateItem(final ListItem listItem) { 56. 57. if (listItem.getModelObject() instanceof Book) { 58. Book book = (Book) listItem.getModelObject(); 59. 60. Label bookName = new Label(bookName, new PropertyModel(book, bookName)); 61. listItem.add(bookName); 62. 63. setModelIndex(getModelIndex() + 1); 64. } 65. } 66. 67. 68. public int getModelIndex() { 69. return modelIndex; 70. } 71. 72. public void setModelIndex(int modelIndex) { 73. this.modelIndex = modelIndex; 74. } 75. } 76. 77. private class Book implements Serializable { 78. private int id; 79. private String bookName; 80. private boolean selected; 81. 82. 83. public int getId() { 84. return id; 85. } 86. 87. public void setId(int id) { 88. this.id = id; 89. } 90. 91. public String getBookName() { 92. return bookName; 93. } 94. 95. public void setBookName(String bookName) { 96. this.bookName = bookName; 97. } 98. 99. public boolean isSelected() { 100. return selected; 101. } 102. 103. public void setSelected(boolean selected) { 104. this.selected = selected; 105. } 106. } Carlos Pita-4 wrote: I am currently trying to convert the RepeatingView into a ListView, but I am having problems setting the model on the ListView. I call populateItem with a model, but afterwards the model is not being set on the view. That's funny. Could you post the related code? Regards, Carlos -- View this message in context: http://www.nabble.com/RepeatingView-%3A-Removing-a-table-row-tf4331444.html#a12356657 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] package web.books; import java.io.Serializable; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.form.Button; import org.apache.wicket.markup.html.form.CheckBox; import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.markup.html.form.TextField; import org.apache.wicket.markup.html.list.ListItem; import org.apache.wicket.markup.html.list.ListView; import org.apache.wicket.model.PropertyModel
Re: RepeatingView : Removing a table row
I am currently trying to convert the RepeatingView into a ListView, but I am having problems setting the model on the ListView. I call populateItem with a model, but afterwards the model is not being set on the view. That's funny. Could you post the related code? Regards, Carlos
Re: RepeatingView : Removing a table row
Hi, it worked fine for me, I attach my own code so you can compare. Btw, why don't you just use a listview with a model that filters out the selected items? Imo it's simpler and more elegant. And another remark: you can bind your checkbox to a boolean (see my example). Regards, Carlos On 8/26/07, pokkie [EMAIL PROTECTED] wrote: I have a RepeatingView that I generate, each row is represented as a WebMarkupContainer. At the end of each row I add a checkbox. When the Delete Selected button is called, I wish to remove the selected row from the RepeatingView and update the page to reflect this status. -- WebMarkupContainer mainExerciseItem = new WebMarkupContainer(newChildId()); add(mainExerciseItem); mainExerciseItem.add(new CheckBox(exerciseSelected, new PropertyModel(mainMemberProgramExerciseHolder, memberProgramExerciseSelected))); -- Currently, I iterate over the items in the RepeatingView, check if they are selected, and subsequently call remove(WebMarkupContainer). -- while (exerciseTable.iterator().hasNext()) { WebMarkupContainer container = (WebMarkupContainer) exerciseTable.iterator().next(); if (container.get(exerciseSelected).getModelObjectAsString().equals( StaticData.TRUE)) { exerciseTable.remove(container); } -- The problem is that it seems that after calling the remove() method, it seems to be entering a loop and never returns. I have tried to call the render() method, but haven't had any luck yet. Any help would be much appreciated -- pokkie -- View this message in context: http://www.nabble.com/RepeatingView-%3A-Removing-a-table-row-tf4331444.html#a12335918 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] package web.repeat; import java.io.Serializable; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.form.CheckBox; import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.markup.repeater.RepeatingView; import org.apache.wicket.model.PropertyModel; @SuppressWarnings(serial) public class RepeatingTest extends WebPage { private static class Item implements Serializable { public final int number; public boolean selected = false; public Item(int number) { this.number = number; } } private static class ItemContainer extends WebMarkupContainer { public final Item item; public ItemContainer(String id, Item item) { super(id); this.item = item; add(new Label(itemNumber, new PropertyModel(item, number))); add(new CheckBox(itemSelected, new PropertyModel(item, selected))); } } private class ItemsForm extends Form { private ListItemContainer itemContainers = new ArrayListItemContainer(); public ItemsForm(String id) { super(id); RepeatingView itemRepeater = new RepeatingView(itemRepeater); add(itemRepeater); for (int i = 0 ; i 10 ; i++) { ItemContainer itemContainer = new ItemContainer(itemContainer + i, new Item(i)); itemContainers.add(itemContainer); itemRepeater.add(itemContainer); } } protected void onSubmit() { IteratorItemContainer itemContainerIterator = itemContainers.iterator(); while (itemContainerIterator.hasNext()) { ItemContainer itemContainer = itemContainerIterator.next(); if (itemContainer.item.selected) { itemContainer.remove(); itemContainerIterator.remove(); } } } } public RepeatingTest() { add(new ItemsForm(itemsForm)); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RepeatingView : Removing a table row
And now that I *really* look at this while (exerciseTable.iterator().hasNext()) { WebMarkupContainer container = (WebMarkupContainer) exerciseTable.iterator().next(); if (container.get (exerciseSelected).getModelObjectAsString().equals(StaticData.TRUE)) { exerciseTable.remove(container); } you should be removing items from you collection while iterating over it with the iterator's own remove, not the collection's one. On 8/26/07, Igor Vaynberg [EMAIL PROTECTED] wrote: that is rather peculiar, could you please reproduce this in a quickstart? -igor On 8/26/07, pokkie [EMAIL PROTECTED] wrote: I have a RepeatingView that I generate, each row is represented as a WebMarkupContainer. At the end of each row I add a checkbox. When the Delete Selected button is called, I wish to remove the selected row from the RepeatingView and update the page to reflect this status. -- WebMarkupContainer mainExerciseItem = new WebMarkupContainer(newChildId()); add(mainExerciseItem); mainExerciseItem.add(new CheckBox(exerciseSelected, new PropertyModel(mainMemberProgramExerciseHolder, memberProgramExerciseSelected))); -- Currently, I iterate over the items in the RepeatingView, check if they are selected, and subsequently call remove(WebMarkupContainer). -- while (exerciseTable.iterator().hasNext()) { WebMarkupContainer container = (WebMarkupContainer) exerciseTable.iterator().next(); if (container.get(exerciseSelected).getModelObjectAsString().equals( StaticData.TRUE)) { exerciseTable.remove(container); } -- The problem is that it seems that after calling the remove() method, it seems to be entering a loop and never returns. I have tried to call the render() method, but haven't had any luck yet. Any help would be much appreciated -- pokkie -- View this message in context: http://www.nabble.com/RepeatingView-%3A-Removing-a-table-row-tf4331444.html#a12335918 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: AJAX form submit and validation
On 8/26/07, Ian Godman [EMAIL PROTECTED] wrote: I worked it out. Very simple solution! On the AjaxSubmitLink override the onError method and add the feedback panel to the AjaxRequestTarget ! Ian Yes, that or setDefaultFormProcessing(false) as Eelco suggested before. That's not doing validation by hand, just postponing the moment of validation to fit your needs. Then, when validation should be done, call process() on the form and that will carry on validation and model updating as usual. It's as simple as that. - Original Message From: Gerolf Seitz [EMAIL PROTECTED] To: users@wicket.apache.org Sent: Sunday, 26 August, 2007 6:05:00 PM Subject: Re: AJAX form submit and validation have you tried AjaxFormComponentUpdatingBehavior? gerolf On 8/26/07, Ian Godman [EMAIL PROTECTED] wrote: Thanks but this does not solve my problem. I am submitting the form via ajax using an AjaxSubmitLink. If the form has errors on it then I do not get the submit, if the form has no errors then the submit code runs ok. The errors are not displayed. If I add a AjaxFormValidatingBehavior for the onblur event then I can see the errors but they check for required fields etc as soon as the first field is left therefore displaying errors too soon. With the AjaxFormValidatingBehavior set to onsubmit event I get no error reporting and no submit. I need to validate the entire form only when submit button is pressed pressed. One possibility is to do the validation by hand in the submit processing code. Ian - Original Message From: Gerolf Seitz [EMAIL PROTECTED] To: users@wicket.apache.org Sent: Sunday, 26 August, 2007 2:10:01 PM Subject: Re: AJAX form submit and validation concerning one field depends on another: have you already taken a look at http://cwiki.apache.org/confluence/display/WICKET/Validating+related+fields ? the code is still 1.2, but it should get you started. hth, gerolf On 8/26/07, Ian Godman [EMAIL PROTECTED] wrote: Hi I have a form that is submitted by ajax. I have validation on fields of the form. Using AjaxFormValidatingBehavior the form will be validated and error messages displayed when the onblur event is used. However this is not what I need as the validation of one field depends on another. I have tried to set the AjaxFormValidatingBehavior to onsubmit but it appears that if the form is invalid then its not submitted so no errors are displayed. Is there any way I can validate my form using ajax only when it is submited ? Ian ___ Yahoo! Answers - Got a question? Someone out there knows the answer. Try it now. http://uk.answers.yahoo.com/ ___ Want ideas for reducing your carbon footprint? Visit Yahoo! For Good http://uk.promotions.yahoo.com/forgood/environment.html ___ 24 FIFA World Cup tickets to be won with Yahoo! Mail http://uk.mail.yahoo.com
Re: contributing to header (was: Must renderHead even if setVisible(false))
Because of a security restriction at the browser (firefox) side. I can't dynamically include external scripts. For example, ajax response can't contribute script src=http://www.google.com/uds/api?file=uds.jsamp;v=1.0; type=text/javascript/script (for the google search api). If it does I get the aforementioned permission denied to call method XMLHttpRequest.open error. Of course I can include the same script when the page is initially rendered, as usual. Cheers, Carlos On 7/31/07, Matej Knopp [EMAIL PROTECTED] wrote: I don't really understand what your problem is. Wicket has AJAX header contribution, which should load the javascript dynamically for you. Doesn't this work for you? -Matej On 7/31/07, Carlos Pita [EMAIL PROTECTED] wrote: Yes Gwen, there are a couple of workarounds, of course, I could call renderHead explicitly from the page too. But the case seems not too uncommon imo (a component that includes some external javascript and isn't showed at first). Maybe it should be supported directly by wicket, after all a component usually contributes support stuff to the header that it's not visible but should be there in case it is finally showed. Current implementation resends the header stuff by ajax every time the component is updated and then checks for duplication at client side so that js, css, links, etc are not included twice. But usually it's simpler and maybe a bit more robust to include the header support stuff upon page rendering and not to contribute anything more upon ajax rendering. Of course contributed stuff could change from ajax request to ajax request but I don't think this is the rule for the header but, for example, to javascript snippets appended to the ajax request target. More generally speaking, at least four header-contributing scenarios come to my mind: 1) initial page rendering - per component class 2) ajax component rendering - per component class 3) initial page rendering - per component instance 4) ajax component rendering - per component instance The per component instance variants allow each instance of the component to spit some code tailored to the specific instance (for example, including its markupId). Currently component headers are rendered just once per component class on page rendering, and then once more each time an instance of the component is ajax re-rendered. What do you think about this? Am I completely missing the point? Cheers, Carlos On 7/31/07, Gwyn Evans [EMAIL PROTECTED] wrote: On Tuesday, July 31, 2007, 7:30:34 AM, Carlos [EMAIL PROTECTED] wrote: I have a component that contributes some javascript to the header. Initially the component won't be shown but an ajax event could make it visible. The problem is that the javascript is contributed later, during the ajax response, and there is a security concern with firefox: permission denied to call method XMLHttpRequest.open. This is because I'm trying to include an external script (simply script src=http://;) that would normally be included with no complaints when the page is initially loaded. I don't know how to override this default behavior. I guess the code that controls this head rendering logic for visible/hidden components is that of HtmlHeaderContainer. Any ideas? Would it work if you were to split your component into two sub-components with the UI part being initially invisible, but the JS not being so, and thus contributing? /Gwyn - 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]