Transactions with RuntimeException
We have a filter that runs in our context before the wicket filter that starts a hibernate transaction, does a chain.doFilter() and then commits the transaction. The problem we are running into is that if a RuntimeException is thrown, Wicket catches it, logs it and figures out which page to display to the user. However, the exception is swallowed and therefore our filter has no knowledge that something bad occurred and is committing the transaction when it shouldn't be. What is the recommended way to deal with this?
autocomplete text field with dropdown style functionality
Hi, I'm using the autocomplete text field with great success. However, I'm looking for a way where a user can start to move down the list and once they are at the last choice, it will continue to pull new items back from the server. If this seems confusing let me explain with my use-case: I have a State autocomplete textfield. Initially they enter C and get all the states that start with C. As they go down the list and say first California is highlighted and then Colorado and then Connecticut I would like the list to display Delaware (possibly even a few more like Florida and Georgia) as the next entries available even though a C was entered into the text field. It seems I would need to know that the last option was selected as a trigger to make a call to display more items from the server. Does anyone have any idea how to do this? Thanks, Jason - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Transactions with RuntimeException
Here at work we abandon this strategy, and create the transaction for service. On Thu, Nov 5, 2009 at 5:20 PM, Steve Lowery slow...@gatessolutions.comwrote: We have a filter that runs in our context before the wicket filter that starts a hibernate transaction, does a chain.doFilter() and then commits the transaction. The problem we are running into is that if a RuntimeException is thrown, Wicket catches it, logs it and figures out which page to display to the user. However, the exception is swallowed and therefore our filter has no knowledge that something bad occurred and is committing the transaction when it shouldn't be. What is the recommended way to deal with this? -- Pedro Henrique Oliveira dos Santos
Re: Transactions with RuntimeException
(...)transaction per service. On Thu, Nov 5, 2009 at 5:33 PM, Pedro Santos pedros...@gmail.com wrote: Here at work we abandon this strategy, and create the transaction for service. On Thu, Nov 5, 2009 at 5:20 PM, Steve Lowery slow...@gatessolutions.comwrote: We have a filter that runs in our context before the wicket filter that starts a hibernate transaction, does a chain.doFilter() and then commits the transaction. The problem we are running into is that if a RuntimeException is thrown, Wicket catches it, logs it and figures out which page to display to the user. However, the exception is swallowed and therefore our filter has no knowledge that something bad occurred and is committing the transaction when it shouldn't be. What is the recommended way to deal with this? -- Pedro Henrique Oliveira dos Santos -- Pedro Henrique Oliveira dos Santos
Re: Transactions with RuntimeException
another common approach is to do this have your txn filter put a transaction handle into a threadlocal, then in requestcycle.onruntimeexception() you can do : transactionholder.gettransaction().setrollbackonly(true); -igor On Thu, Nov 5, 2009 at 11:59 AM, Igor Vaynberg igor.vaynb...@gmail.com wrote: check the http response code? -igor On Thu, Nov 5, 2009 at 11:20 AM, Steve Lowery slow...@gatessolutions.com wrote: We have a filter that runs in our context before the wicket filter that starts a hibernate transaction, does a chain.doFilter() and then commits the transaction. The problem we are running into is that if a RuntimeException is thrown, Wicket catches it, logs it and figures out which page to display to the user. However, the exception is swallowed and therefore our filter has no knowledge that something bad occurred and is committing the transaction when it shouldn't be. What is the recommended way to deal with this? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Transactions with RuntimeException
check the http response code? -igor On Thu, Nov 5, 2009 at 11:20 AM, Steve Lowery slow...@gatessolutions.com wrote: We have a filter that runs in our context before the wicket filter that starts a hibernate transaction, does a chain.doFilter() and then commits the transaction. The problem we are running into is that if a RuntimeException is thrown, Wicket catches it, logs it and figures out which page to display to the user. However, the exception is swallowed and therefore our filter has no knowledge that something bad occurred and is committing the transaction when it shouldn't be. What is the recommended way to deal with this? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
LDAP Authentication
We’re working on an application that requires authentication against Active Directory and authorization based on Roles. I wanted to ask the community what they would recommend for a out-of-the-box Wicket 1.4 plus LDAP integration with the least amount of headaches (that will be our starting point). I’ve investigated SWARM and WASP along with Spring Security, but we have concerns that our final solution will need to be a little more dynamic and scalable than what SWARM can currently support. Anyone have any thoughts, ideas or experiences in working with Wicket, Roles and LDAP? Thanks, Ben
Re: LDAP Authentication
take a look at Apache Shiro http://incubator.apache.org/shiro/ I found it much easier to work with... There is a basic example with: https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-core/shiro-security/ I have it working with JDBC or ActiveDirectory, using LDAP should be straight forward... On Nov 5, 2009, at 3:16 PM, Benjamin Pack wrote: We’re working on an application that requires authentication against Active Directory and authorization based on Roles. I wanted to ask the community what they would recommend for a out-of-the-box Wicket 1.4 plus LDAP integration with the least amount of headaches (that will be our starting point). I’ve investigated SWARM and WASP along with Spring Security, but we have concerns that our final solution will need to be a little more dynamic and scalable than what SWARM can currently support. Anyone have any thoughts, ideas or experiences in working with Wicket, Roles and LDAP? Thanks, Ben - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: LDAP Authentication
Hi, You should check JAAS, AFAIK it has ldap-integration too, but if you need to create an edit profile page, then I recommend you Spring-LDAP, it's very easy to use (but I'm not sure, that the roles would work). Regards, Peter 2009-11-05 21:16 keltezéssel, Benjamin Pack írta: We’re working on an application that requires authentication against Active Directory and authorization based on Roles. I wanted to ask the community what they would recommend for a out-of-the-box Wicket 1.4 plus LDAP integration with the least amount of headaches (that will be our starting point). I’ve investigated SWARM and WASP along with Spring Security, but we have concerns that our final solution will need to be a little more dynamic and scalable than what SWARM can currently support. Anyone have any thoughts, ideas or experiences in working with Wicket, Roles and LDAP? Thanks, Ben - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Urgent: Repeating Markup that contains a Wicket Border
Hi, I have some markup I am trying to repeat using a RepeatingView and if the markup that I'm repeating binds to a Wicket Border, I get GPEs. This seems like a bug to me. Is it a bug or am I potentially doing something incorrect. Here is the pertinent markup that is being repeated... div style=margin 10px; wicket:id=optionRepeater div wicket:id=outerGroupBox input type=radio wicket:id=radio/input span style=float: left; wicket:id=title[option title]/span hr/ span wicket:id=helpText[item help text]/span /div /div Here is the pertinent code snippet for the above markup: RepeatingView repeating = new RepeatingView(optionRepeater); group.add(repeating); ListIQNWizardOption wizardOptions = new ArrayListIQNWizardOption(3); wizardOptions.add(IQNWizardOption.TEMPORARY_WORKER); wizardOptions.add(IQNWizardOption.COMPLIANCE_OR_PROFESSIONAL_CONSULTING_ WORKERS); wizardOptions.add(IQNWizardOption.KNOWN_RESOURCE_INDEPENDENT_CONSULTANT) ; for ( IQNWizardOption wizardOption : wizardOptions ) { WebMarkupContainer item = new WebMarkupContainer(repeating.newChildId()); repeating.add(item); OuterGroupBoxBorder outerContainer = new OuterGroupBoxBorder(outerGroupBox); item.add(outerContainer); outerContainer.add(new RadioIQNWizardOption(radio, new Model())); outerContainer.add(new Label(title, wizardOption.getTitle())); outerContainer.add(new Label(helpText, wizardOption.getHelpText())); } The GPE is on the outerContainer.add(new Label(title), ...) and Wicket states that the title wicket id already exist in the markup. I am running Wicket 1.4.1. Thoughts, Ideas? J.D. J.D. Corbin | IQNavigator, Inc. | Technology 6465 Greenwood Village Blvd, Suite 800, Centennial, CO 80111 | Office 303.563.1503 | Mobile 303.912.0958 | www.iqnavigator.com | jcor...@iqnavigator.com
Re: LDAP Authentication
I am using simple AuthenticatedWebApplication and AuthenticatedWebSession which through that you can assign roles. There are examples in wicket-examples. I wrote my own classes to verify credentials using javax.naming against AD. Although I don't use roles much, you could assign a role based on AD Groups membership.
Serializable check
Hi, I am trying to prevent the leaking of business objects into the session. Michael made a good comment in http://www.mail-archive.com/users@wicket.apache.org/msg31187.html ... you could e.g. temporarily remove the Serializable from your model-classes and go spotting nonserializable exceptions until they don't ocurr anymore. which is what I did. It works nicely until I hit a problem with ListDataProvider in DataView, where I get an exception even if I use LDMs: java.lang.ClassCastException: MyEntyty cannot be cast to java.io.Serializable at org.apache.wicket.markup.repeater.data.ListDataProvider.model(ListDataProvider.java:35) It appears to me that the approach has a conflict with framework classes. What is the best way to spot session memory issues without hitting this problem? Many thanks, Bernard - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Serializable check
you have to override listdataprovider#model and return a detachable model. -igor On Thu, Nov 5, 2009 at 2:19 PM, b...@actrix.gen.nz wrote: Hi, I am trying to prevent the leaking of business objects into the session. Michael made a good comment in http://www.mail-archive.com/users@wicket.apache.org/msg31187.html ... you could e.g. temporarily remove the Serializable from your model-classes and go spotting nonserializable exceptions until they don't ocurr anymore. which is what I did. It works nicely until I hit a problem with ListDataProvider in DataView, where I get an exception even if I use LDMs: java.lang.ClassCastException: MyEntyty cannot be cast to java.io.Serializable at org.apache.wicket.markup.repeater.data.ListDataProvider.model(ListDataProvider.java:35) It appears to me that the approach has a conflict with framework classes. What is the best way to spot session memory issues without hitting this problem? Many thanks, Bernard - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: LDAP Authentication
Do You know Spring-ldap? Take a look at this presentation: http://www.slideshare.net/PiergiorgioLucidi/spring-ldap. I think it is easy integrate spring-ldap with spring-security and so unsing swarm. 2009/11/5 Benjamin Pack ben.p...@gmail.com We’re working on an application that requires authentication against Active Directory and authorization based on Roles. I wanted to ask the community what they would recommend for a out-of-the-box Wicket 1.4 plus LDAP integration with the least amount of headaches (that will be our starting point). I’ve investigated SWARM and WASP along with Spring Security, but we have concerns that our final solution will need to be a little more dynamic and scalable than what SWARM can currently support. Anyone have any thoughts, ideas or experiences in working with Wicket, Roles and LDAP? Thanks, Ben -- Filippo De Luca -- Email: dl.fili...@filosganga.it Web: http://www.filosganga.it LinkedIn: http://www.linkedin.com/in/filippodeluca mobile: +393395822588
Re: Serializable check
Igor, Thanks very much for your suggestion which I followed. I have overridden it and that is an improvement but still not good. ListDataProvider dataProvider = new ListDataProvider(myList){ @Override public IModelMyEntity model(Object object) { return new DetachableMyEntityModel((MyEntity) object); } }; SerializableChecker does a nice job spotting: ... private final java.util.List org.apache.wicket.markup.repeater.data.ListDataProvider.list[write:1] [class=[Ljava.lang.Object;] private final java.util.List org.apache.wicket.markup.repeater.data.ListDataProvider.list[write:1][0] [class=MyEntity] - field that is not serializable I guess that private final ListT list; of ListDataProvider wants to be serialized into the session which we don't want? I am trying to apply best practice - may be I should not be using ListDataProvider? http://old.nabble.com/How-to-avoid-Lazy-loading-exception-td17040941.html instead of using listdataprovider you should use a dataprovider in that uses detachablemodels for each individual item -igor Today, with 1.4, what is best to use for List results from EntityManager? Still DataProvider? Many thanks, Bernard On Thu, 5 Nov 2009 14:25:01 -0800, you wrote: you have to override listdataprovider#model and return a detachable model. -igor On Thu, Nov 5, 2009 at 2:19 PM, b...@actrix.gen.nz wrote: Hi, I am trying to prevent the leaking of business objects into the session. Michael made a good comment in http://www.mail-archive.com/users@wicket.apache.org/msg31187.html ... you could e.g. temporarily remove the Serializable from your model-classes and go spotting nonserializable exceptions until they don't ocurr anymore. which is what I did. It works nicely until I hit a problem with ListDataProvider in DataView, where I get an exception even if I use LDMs: java.lang.ClassCastException: MyEntyty cannot be cast to java.io.Serializable at org.apache.wicket.markup.repeater.data.ListDataProvider.model(ListDataProvider.java:35) It appears to me that the approach has a conflict with framework classes. What is the best way to spot session memory issues without hitting this problem? Many thanks, Bernard - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Serializable check
no, you should not be using listdataprovider, it is only for static lists of things. if you want best practice look at the phonebook example in wicket-stuff. -igor On Thu, Nov 5, 2009 at 5:52 PM, b...@actrix.gen.nz wrote: Igor, Thanks very much for your suggestion which I followed. I have overridden it and that is an improvement but still not good. ListDataProvider dataProvider = new ListDataProvider(myList){ �...@override public IModelMyEntity model(Object object) { return new DetachableMyEntityModel((MyEntity) object); } }; SerializableChecker does a nice job spotting: ... private final java.util.List org.apache.wicket.markup.repeater.data.ListDataProvider.list[write:1] [class=[Ljava.lang.Object;] private final java.util.List org.apache.wicket.markup.repeater.data.ListDataProvider.list[write:1][0] [class=MyEntity] - field that is not serializable I guess that private final ListT list; of ListDataProvider wants to be serialized into the session which we don't want? I am trying to apply best practice - may be I should not be using ListDataProvider? http://old.nabble.com/How-to-avoid-Lazy-loading-exception-td17040941.html instead of using listdataprovider you should use a dataprovider in that uses detachablemodels for each individual item -igor Today, with 1.4, what is best to use for List results from EntityManager? Still DataProvider? Many thanks, Bernard On Thu, 5 Nov 2009 14:25:01 -0800, you wrote: you have to override listdataprovider#model and return a detachable model. -igor On Thu, Nov 5, 2009 at 2:19 PM, b...@actrix.gen.nz wrote: Hi, I am trying to prevent the leaking of business objects into the session. Michael made a good comment in http://www.mail-archive.com/users@wicket.apache.org/msg31187.html ... you could e.g. temporarily remove the Serializable from your model-classes and go spotting nonserializable exceptions until they don't ocurr anymore. which is what I did. It works nicely until I hit a problem with ListDataProvider in DataView, where I get an exception even if I use LDMs: java.lang.ClassCastException: MyEntyty cannot be cast to java.io.Serializable at org.apache.wicket.markup.repeater.data.ListDataProvider.model(ListDataProvider.java:35) It appears to me that the approach has a conflict with framework classes. What is the best way to spot session memory issues without hitting this problem? Many thanks, Bernard - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
panel session time
I have a panel in the top part of my page. This panel contain a login form. But, I don't login with the panel because I have been on the page for too long(session timeout) also i have a login page , the page contain a login form .But when session timeout , it can login the two State's backcode is same. but i found the panel code don't call submit methods when session timeout Why does such things could happen. ___ 好玩贺卡等你发,邮箱贺卡全新上线! http://card.mail.cn.yahoo.com/
Re: Serializable check
Thanks again Igor. I have switched to plain IDataProvider as suggested, although I have to admit that I still have to look at the phonebook example. Again, IDataProvider is an improvement, but still not good. It appears that SerializableChecker is complaining about a volatile field not being Serializable. Is this a bug or do I miss anything? I think that SerializableChecker is a wondeful tool, that is why I am persevering: org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException: Unable to serialize class: MyEntity ... private volatile java.util.List MyEntityDataProvider.entities [class=java.util.Vector] ... public class MyEntityDataProvider implements IDataProviderMyEntity{ private final Integer searchId; private volatile ListMyEntity entities; public MyEntityDataProvider(Integer searchId) { this(searchId, null); } public MyEntityDataProvider(Integer searchId, ListMyEntity entities) { this.searchId = searchId; this.entities = entities; } @Override public IteratorMyEntity iterator(int first, int count) { return entities.iterator(); } @Override public int size() { if(this.entities == null){ SessionLocal sessionBean = MyApplication.getSessionBean(); this.entities = sessionBean.getMyEntities(this.searchId); } return this.entities.size(); } @Override public IModelMyEntity model(MyEntity entity) { return new DetachableMyEntityModel(entity); } @Override public void detach() { } } On Thu, 5 Nov 2009 18:30:20 -0800, you wrote: no, you should not be using listdataprovider, it is only for static lists of things. if you want best practice look at the phonebook example in wicket-stuff. -igor On Thu, Nov 5, 2009 at 5:52 PM, b...@actrix.gen.nz wrote: Igor, Thanks very much for your suggestion which I followed. I have overridden it and that is an improvement but still not good. ListDataProvider dataProvider = new ListDataProvider(myList){ �...@override public IModelMyEntity model(Object object) { return new DetachableMyEntityModel((MyEntity) object); } }; SerializableChecker does a nice job spotting: ... private final java.util.List org.apache.wicket.markup.repeater.data.ListDataProvider.list[write:1] [class=[Ljava.lang.Object;] private final java.util.List org.apache.wicket.markup.repeater.data.ListDataProvider.list[write:1][0] [class=MyEntity] - field that is not serializable I guess that private final ListT list; of ListDataProvider wants to be serialized into the session which we don't want? I am trying to apply best practice - may be I should not be using ListDataProvider? http://old.nabble.com/How-to-avoid-Lazy-loading-exception-td17040941.html instead of using listdataprovider you should use a dataprovider in that uses detachablemodels for each individual item -igor Today, with 1.4, what is best to use for List results from EntityManager? Still DataProvider? Many thanks, Bernard On Thu, 5 Nov 2009 14:25:01 -0800, you wrote: you have to override listdataprovider#model and return a detachable model. -igor On Thu, Nov 5, 2009 at 2:19 PM, b...@actrix.gen.nz wrote: Hi, I am trying to prevent the leaking of business objects into the session. Michael made a good comment in http://www.mail-archive.com/users@wicket.apache.org/msg31187.html ... you could e.g. temporarily remove the Serializable from your model-classes and go spotting nonserializable exceptions until they don't ocurr anymore. which is what I did. It works nicely until I hit a problem with ListDataProvider in DataView, where I get an exception even if I use LDMs: java.lang.ClassCastException: MyEntyty cannot be cast to java.io.Serializable at org.apache.wicket.markup.repeater.data.ListDataProvider.model(ListDataProvider.java:35) It appears to me that the approach has a conflict with framework classes. What is the best way to spot session memory issues without hitting this problem? Many thanks, Bernard - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Serializable check
you should create the list of entities inside iterator() call, not hold on to it in a field. see the phonebook example. -igor On Thu, Nov 5, 2009 at 7:06 PM, b...@actrix.gen.nz wrote: Thanks again Igor. I have switched to plain IDataProvider as suggested, although I have to admit that I still have to look at the phonebook example. Again, IDataProvider is an improvement, but still not good. It appears that SerializableChecker is complaining about a volatile field not being Serializable. Is this a bug or do I miss anything? I think that SerializableChecker is a wondeful tool, that is why I am persevering: org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException: Unable to serialize class: MyEntity ... private volatile java.util.List MyEntityDataProvider.entities [class=java.util.Vector] ... public class MyEntityDataProvider implements IDataProviderMyEntity{ private final Integer searchId; private volatile ListMyEntity entities; public MyEntityDataProvider(Integer searchId) { this(searchId, null); } public MyEntityDataProvider(Integer searchId, ListMyEntity entities) { this.searchId = searchId; this.entities = entities; } �...@override public IteratorMyEntity iterator(int first, int count) { return entities.iterator(); } �...@override public int size() { if(this.entities == null){ SessionLocal sessionBean = MyApplication.getSessionBean(); this.entities = sessionBean.getMyEntities(this.searchId); } return this.entities.size(); } �...@override public IModelMyEntity model(MyEntity entity) { return new DetachableMyEntityModel(entity); } �...@override public void detach() { } } On Thu, 5 Nov 2009 18:30:20 -0800, you wrote: no, you should not be using listdataprovider, it is only for static lists of things. if you want best practice look at the phonebook example in wicket-stuff. -igor On Thu, Nov 5, 2009 at 5:52 PM, b...@actrix.gen.nz wrote: Igor, Thanks very much for your suggestion which I followed. I have overridden it and that is an improvement but still not good. ListDataProvider dataProvider = new ListDataProvider(myList){ �...@override public IModelMyEntity model(Object object) { return new DetachableMyEntityModel((MyEntity) object); } }; SerializableChecker does a nice job spotting: ... private final java.util.List org.apache.wicket.markup.repeater.data.ListDataProvider.list[write:1] [class=[Ljava.lang.Object;] private final java.util.List org.apache.wicket.markup.repeater.data.ListDataProvider.list[write:1][0] [class=MyEntity] - field that is not serializable I guess that private final ListT list; of ListDataProvider wants to be serialized into the session which we don't want? I am trying to apply best practice - may be I should not be using ListDataProvider? http://old.nabble.com/How-to-avoid-Lazy-loading-exception-td17040941.html instead of using listdataprovider you should use a dataprovider in that uses detachablemodels for each individual item -igor Today, with 1.4, what is best to use for List results from EntityManager? Still DataProvider? Many thanks, Bernard On Thu, 5 Nov 2009 14:25:01 -0800, you wrote: you have to override listdataprovider#model and return a detachable model. -igor On Thu, Nov 5, 2009 at 2:19 PM, b...@actrix.gen.nz wrote: Hi, I am trying to prevent the leaking of business objects into the session. Michael made a good comment in http://www.mail-archive.com/users@wicket.apache.org/msg31187.html ... you could e.g. temporarily remove the Serializable from your model-classes and go spotting nonserializable exceptions until they don't ocurr anymore. which is what I did. It works nicely until I hit a problem with ListDataProvider in DataView, where I get an exception even if I use LDMs: java.lang.ClassCastException: MyEntyty cannot be cast to java.io.Serializable at org.apache.wicket.markup.repeater.data.ListDataProvider.model(ListDataProvider.java:35) It appears to me that the approach has a conflict with framework classes. What is the best way to spot session memory issues without hitting this problem? Many thanks, Bernard - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: panel session time
the panel is in a page, the page is in session. if the session timed out the panel no longer exists. you should use a StatelessForm for things like login panels. -igor On Thu, Nov 5, 2009 at 6:36 PM, Joe huanghu...@yahoo.cn wrote: I have a panel in the top part of my page. This panel contain a login form. But, I don't login with the panel because I have been on the page for too long(session timeout) also i have a login page , the page contain a login form .But when session timeout , it can login the two State's backcode is same. but i found the panel code don't call submit methods when session timeout Why does such things could happen. ___ 好玩贺卡等你发,邮箱贺卡全新上线! http://card.mail.cn.yahoo.com/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Serializable check
Igor, Creating the list of entities exclusively inside iterator() requires two database calls for retrieving a list for a single request, the additional call being required for the size() method that is called prior to iterator(). That is an unfortunate side effect of this API. I don't have a problem with that as I work around it, as others have done before me, by fetching the data eagerly with the size() method and then caching it in a volatile field for use by iterator(). I just can't afford to make two database calls. So I wonder, what is the situation with SerializableChecker complaining about that volatile field not being Serializable. Is this a bug or do I miss anything? Should I use something else instead of IDataProvider? Many thanks. Bernard On Thu, 5 Nov 2009 20:05:37 -0800, you wrote: you should create the list of entities inside iterator() call, not hold on to it in a field. see the phonebook example. -igor On Thu, Nov 5, 2009 at 7:06 PM, b...@actrix.gen.nz wrote: Thanks again Igor. I have switched to plain IDataProvider as suggested, although I have to admit that I still have to look at the phonebook example. Again, IDataProvider is an improvement, but still not good. It appears that SerializableChecker is complaining about a volatile field not being Serializable. Is this a bug or do I miss anything? I think that SerializableChecker is a wondeful tool, that is why I am persevering: org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException: Unable to serialize class: MyEntity ... private volatile java.util.List MyEntityDataProvider.entities [class=java.util.Vector] ... public class MyEntityDataProvider implements IDataProviderMyEntity{ private final Integer searchId; private volatile ListMyEntity entities; public MyEntityDataProvider(Integer searchId) { this(searchId, null); } public MyEntityDataProvider(Integer searchId, ListMyEntity entities) { this.searchId = searchId; this.entities = entities; } �...@override public IteratorMyEntity iterator(int first, int count) { return entities.iterator(); } �...@override public int size() { if(this.entities == null){ SessionLocal sessionBean = MyApplication.getSessionBean(); this.entities = sessionBean.getMyEntities(this.searchId); } return this.entities.size(); } �...@override public IModelMyEntity model(MyEntity entity) { return new DetachableMyEntityModel(entity); } �...@override public void detach() { } } On Thu, 5 Nov 2009 18:30:20 -0800, you wrote: no, you should not be using listdataprovider, it is only for static lists of things. if you want best practice look at the phonebook example in wicket-stuff. -igor On Thu, Nov 5, 2009 at 5:52 PM, b...@actrix.gen.nz wrote: Igor, Thanks very much for your suggestion which I followed. I have overridden it and that is an improvement but still not good. ListDataProvider dataProvider = new ListDataProvider(myList){ �...@override public IModelMyEntity model(Object object) { return new DetachableMyEntityModel((MyEntity) object); } }; SerializableChecker does a nice job spotting: ... private final java.util.List org.apache.wicket.markup.repeater.data.ListDataProvider.list[write:1] [class=[Ljava.lang.Object;] private final java.util.List org.apache.wicket.markup.repeater.data.ListDataProvider.list[write:1][0] [class=MyEntity] - field that is not serializable I guess that private final ListT list; of ListDataProvider wants to be serialized into the session which we don't want? I am trying to apply best practice - may be I should not be using ListDataProvider? http://old.nabble.com/How-to-avoid-Lazy-loading-exception-td17040941.html instead of using listdataprovider you should use a dataprovider in that uses detachablemodels for each individual item -igor Today, with 1.4, what is best to use for List results from EntityManager? Still DataProvider? Many thanks, Bernard On Thu, 5 Nov 2009 14:25:01 -0800, you wrote: you have to override listdataprovider#model and return a detachable model. -igor On Thu, Nov 5, 2009 at 2:19 PM, b...@actrix.gen.nz wrote: Hi, I am trying to prevent the leaking of business objects into the session. Michael made a good comment in http://www.mail-archive.com/users@wicket.apache.org/msg31187.html ... you could e.g. temporarily remove the Serializable from your model-classes and go spotting nonserializable exceptions until they don't ocurr anymore. which is what I did. It works nicely until I hit a problem with ListDataProvider in DataView, where I get an exception even if I use LDMs: java.lang.ClassCastException: MyEntyty cannot be cast to java.io.Serializable at org.apache.wicket.markup.repeater.data.ListDataProvider.model(ListDataProvider.java:35) It
Re: Serializable check
Are you always retrieving the entire list? On Thu, Nov 5, 2009 at 11:25 PM, b...@actrix.gen.nz wrote: Igor, Creating the list of entities exclusively inside iterator() requires two database calls for retrieving a list for a single request, the additional call being required for the size() method that is called prior to iterator(). That is an unfortunate side effect of this API. I don't have a problem with that as I work around it, as others have done before me, by fetching the data eagerly with the size() method and then caching it in a volatile field for use by iterator(). I just can't afford to make two database calls. So I wonder, what is the situation with SerializableChecker complaining about that volatile field not being Serializable. Is this a bug or do I miss anything? Should I use something else instead of IDataProvider? Many thanks. Bernard On Thu, 5 Nov 2009 20:05:37 -0800, you wrote: you should create the list of entities inside iterator() call, not hold on to it in a field. see the phonebook example. -igor On Thu, Nov 5, 2009 at 7:06 PM, b...@actrix.gen.nz wrote: Thanks again Igor. I have switched to plain IDataProvider as suggested, although I have to admit that I still have to look at the phonebook example. Again, IDataProvider is an improvement, but still not good. It appears that SerializableChecker is complaining about a volatile field not being Serializable. Is this a bug or do I miss anything? I think that SerializableChecker is a wondeful tool, that is why I am persevering: org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException: Unable to serialize class: MyEntity ... private volatile java.util.List MyEntityDataProvider.entities [class=java.util.Vector] ... public class MyEntityDataProvider implements IDataProviderMyEntity{ private final Integer searchId; private volatile ListMyEntity entities; public MyEntityDataProvider(Integer searchId) { this(searchId, null); } public MyEntityDataProvider(Integer searchId, ListMyEntity entities) { this.searchId = searchId; this.entities = entities; } �...@override public IteratorMyEntity iterator(int first, int count) { return entities.iterator(); } �...@override public int size() { if(this.entities == null){ SessionLocal sessionBean = MyApplication.getSessionBean(); this.entities = sessionBean.getMyEntities(this.searchId); } return this.entities.size(); } �...@override public IModelMyEntity model(MyEntity entity) { return new DetachableMyEntityModel(entity); } �...@override public void detach() { } } On Thu, 5 Nov 2009 18:30:20 -0800, you wrote: no, you should not be using listdataprovider, it is only for static lists of things. if you want best practice look at the phonebook example in wicket-stuff. -igor On Thu, Nov 5, 2009 at 5:52 PM, b...@actrix.gen.nz wrote: Igor, Thanks very much for your suggestion which I followed. I have overridden it and that is an improvement but still not good. ListDataProvider dataProvider = new ListDataProvider(myList){ �...@override public IModelMyEntity model(Object object) { return new DetachableMyEntityModel((MyEntity) object); } }; SerializableChecker does a nice job spotting: ... private final java.util.List org.apache.wicket.markup.repeater.data.ListDataProvider.list[write:1] [class=[Ljava.lang.Object;] private final java.util.List org.apache.wicket.markup.repeater.data.ListDataProvider.list[write:1][0] [class=MyEntity] - field that is not serializable I guess that private final ListT list; of ListDataProvider wants to be serialized into the session which we don't want? I am trying to apply best practice - may be I should not be using ListDataProvider? http://old.nabble.com/How-to-avoid-Lazy-loading-exception-td17040941.html instead of using listdataprovider you should use a dataprovider in that uses detachablemodels for each individual item -igor Today, with 1.4, what is best to use for List results from EntityManager? Still DataProvider? Many thanks, Bernard On Thu, 5 Nov 2009 14:25:01 -0800, you wrote: you have to override listdataprovider#model and return a detachable model. -igor On Thu, Nov 5, 2009 at 2:19 PM, b...@actrix.gen.nz wrote: Hi, I am trying to prevent the leaking of business objects into the session. Michael made a good comment in http://www.mail-archive.com/users@wicket.apache.org/msg31187.html ... you could e.g. temporarily remove the Serializable from your model-classes and go spotting nonserializable exceptions until they don't ocurr anymore. which is what I did. It works nicely until I hit a problem with ListDataProvider in DataView, where I get an exception even if I use LDMs: java.lang.ClassCastException: MyEntyty cannot be cast to
Re: Serializable check
Hi James, Thanks for the question. In this case, yes. In other cases where I use IDataProvider, no. I know that IDataProvider provides functionality for pagination which I don't use here, that is why I ignored it. I must admit I have a few issues with IDataProvider but I don't want to distract from the original issue. So I wonder, what is the situation with SerializableChecker complaining about that volatile field not being Serializable. Is this a bug or do I miss anything? Should I use something else instead of IDataProvider? I just want to retrieve a list from the database, display it in a table while not having to deal with fake Serializable issues when I remove the Serializable interface from the business object. I have to do this to check the application for leaks of that business object into the session. Many thanks. Bernard On Thu, 5 Nov 2009 23:29:02 -0500, you wrote: Are you always retrieving the entire list? [snip] - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: inmethod datagrid and row additions and filtering
I ended up making the following changes to the inmethod datagrid in order to get the correct behavior: AbstractPageableView.java: + public void reset() { + realItemCount = UNKOWN_COUNT; + maxFirstItemReached = 0; + queryResult = null; + cachedPageCount = -1; + currentPageFirstItem = 0; + } DataGridBody.java: + void reset() { +getData().reset(); + } DataGrid.java: + protected void onModelChanged() { + super.onModelChanged(); + getBody().reset(); +} Deren wrote: What is the best way to handle an IDataSource backed by a list that might change in total size or in contents (add/remove items and filter items)? I have seen cases where the most recently added item is missing (corrected after a refresh), where only the last item is displayed (e.g., one row displayed but 1-8 of 8 in the footer -- also corrected after a refresh), and where no items are displayed after a page refresh. Thanks. _ Hotmail: Trusted email with powerful SPAM protection. http://clk.atdmt.com/GBL/go/177141665/direct/01/ -- View this message in context: http://old.nabble.com/inmethod-datagrid-and-row-additions-and-filtering-tp26210072p26227374.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Serializable check
I think the problem is that you are using the volatile keyword when you should be using transient. bht wrote: So I wonder, what is the situation with SerializableChecker complaining about that volatile field not being Serializable. Is this a bug or do I miss anything? -- View this message in context: http://old.nabble.com/Transactions-with-RuntimeException-tp26220780p26227378.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Serializable check
class mydataprovider implements idataprovider { private transient list cache; private list getresult() { if (cache==null) { // load the list from db; cache=list; } return cache; } public iterator iterator() { return getresult().iterator(); } public int size() { return getresult().size(); } public void detach() { cache=null; } } -igor On Thu, Nov 5, 2009 at 8:25 PM, b...@actrix.gen.nz wrote: Igor, Creating the list of entities exclusively inside iterator() requires two database calls for retrieving a list for a single request, the additional call being required for the size() method that is called prior to iterator(). That is an unfortunate side effect of this API. I don't have a problem with that as I work around it, as others have done before me, by fetching the data eagerly with the size() method and then caching it in a volatile field for use by iterator(). I just can't afford to make two database calls. So I wonder, what is the situation with SerializableChecker complaining about that volatile field not being Serializable. Is this a bug or do I miss anything? Should I use something else instead of IDataProvider? Many thanks. Bernard On Thu, 5 Nov 2009 20:05:37 -0800, you wrote: you should create the list of entities inside iterator() call, not hold on to it in a field. see the phonebook example. -igor On Thu, Nov 5, 2009 at 7:06 PM, b...@actrix.gen.nz wrote: Thanks again Igor. I have switched to plain IDataProvider as suggested, although I have to admit that I still have to look at the phonebook example. Again, IDataProvider is an improvement, but still not good. It appears that SerializableChecker is complaining about a volatile field not being Serializable. Is this a bug or do I miss anything? I think that SerializableChecker is a wondeful tool, that is why I am persevering: org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException: Unable to serialize class: MyEntity ... private volatile java.util.List MyEntityDataProvider.entities [class=java.util.Vector] ... public class MyEntityDataProvider implements IDataProviderMyEntity{ private final Integer searchId; private volatile ListMyEntity entities; public MyEntityDataProvider(Integer searchId) { this(searchId, null); } public MyEntityDataProvider(Integer searchId, ListMyEntity entities) { this.searchId = searchId; this.entities = entities; } �...@override public IteratorMyEntity iterator(int first, int count) { return entities.iterator(); } �...@override public int size() { if(this.entities == null){ SessionLocal sessionBean = MyApplication.getSessionBean(); this.entities = sessionBean.getMyEntities(this.searchId); } return this.entities.size(); } �...@override public IModelMyEntity model(MyEntity entity) { return new DetachableMyEntityModel(entity); } �...@override public void detach() { } } On Thu, 5 Nov 2009 18:30:20 -0800, you wrote: no, you should not be using listdataprovider, it is only for static lists of things. if you want best practice look at the phonebook example in wicket-stuff. -igor On Thu, Nov 5, 2009 at 5:52 PM, b...@actrix.gen.nz wrote: Igor, Thanks very much for your suggestion which I followed. I have overridden it and that is an improvement but still not good. ListDataProvider dataProvider = new ListDataProvider(myList){ �...@override public IModelMyEntity model(Object object) { return new DetachableMyEntityModel((MyEntity) object); } }; SerializableChecker does a nice job spotting: ... private final java.util.List org.apache.wicket.markup.repeater.data.ListDataProvider.list[write:1] [class=[Ljava.lang.Object;] private final java.util.List org.apache.wicket.markup.repeater.data.ListDataProvider.list[write:1][0] [class=MyEntity] - field that is not serializable I guess that private final ListT list; of ListDataProvider wants to be serialized into the session which we don't want? I am trying to apply best practice - may be I should not be using ListDataProvider? http://old.nabble.com/How-to-avoid-Lazy-loading-exception-td17040941.html instead of using listdataprovider you should use a dataprovider in that uses detachablemodels for each individual item -igor Today, with 1.4, what is best to use for List results from EntityManager? Still DataProvider? Many thanks, Bernard On Thu, 5 Nov 2009 14:25:01 -0800, you wrote: you have to override listdataprovider#model and return a detachable model. -igor On Thu, Nov 5, 2009 at 2:19 PM, b...@actrix.gen.nz wrote: Hi, I am trying to prevent the leaking of business objects into the session. Michael made a good comment in http://www.mail-archive.com/users@wicket.apache.org/msg31187.html
Re: Serializable check
Thanks very much! As pointed out, I was incorrectly using the keyword volatile instead of transient. All is well now with IDataProvider and SerializableChecker. SerializableChecker is great! Bernard On Thu, 5 Nov 2009 22:30:59 -0800, you wrote: class mydataprovider implements idataprovider { private transient list cache; private list getresult() { if (cache==null) { // load the list from db; cache=list; } return cache; } public iterator iterator() { return getresult().iterator(); } public int size() { return getresult().size(); } public void detach() { cache=null; } } -igor - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Reading localization properties from Page Subclass .properties file
Hi, We are in the process of moving our applications from JSP to Wicket. Right now we're writing a framework with BasePages and base components to build on and are learning Wicket on the fly. The BasePage contains a HeaderPanel which renders the Headline of the page: !-- BasePage.java -- public BasePage() { super(); . . header = new HeaderPanel(header, getHeaderImagePath()); add(header); } We then subclass BasePage and implement getHeaderImagePath() which is abstract. HeaderPanel reads the header from a .properties file and uses a different resourceKey depending on what mode the page is in. E.g. if the page is in edit mode, the HeaderPanel tries to read editHeadline, and if the page is in view mode the HeaderPanel tries to read viewHeadline: !-- Extract from HeaderPanel.java constructor -- add(new Label(viewHeadline, new StringResourceModel(viewHeadline, this, model)) { @Override public boolean isVisible() { return getMode() == Mode.VIEW; } }.setRenderBodyOnly(true)); !-- SubclassPage.java -- public class SubclassPage extends BasePage public SubclassPage() { super(); } } Now for the problem: We would like to be able to read the localization properties from the Page _Subclass_ .properties file. This apparently won't work because the HeaderPanel is added in BasePage constructor, and uses that as parent component to HeaderPanel in the StringResourceModel. Of course we can create methods like getViewHeadline() and force the Page subclass to implement/override them, but is there a better way? Is it possible to get the values from the Page Subclass .properties file? Thanks! Regards, Leo
Re: Asynchronous construction of page
Why don't you use the AjaxLazyLoadPanel for each part the the screen that takes some time to load? (see also at http://www.roseindia.net/tutorials/wicket/lazy-load.shtml) Pieter On Thu, Nov 5, 2009 at 6:00 PM, Kaspar Fischer kaspar.fisc...@dreizak.comwrote: On 05.11.2009, at 03:06, jpswain wrote: Wicket is remarkably fast and efficient the way it is used in common practice. To do what you are suggesting would be to wreck that big time. Why on earth do you want to do this? I am very happy with Wicket's speed but sometimes the data that needs to be displayed by Wicket is not readily available. In my application, I need to do display the results of several calculations, each of which may require a different amount of time. Unfortunately, there is not a lot to cache. -- I want to display to the user a page right away and as the results come in, in whatever order, show them. Kaspar - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Pieter Degraeuwe Systemworks bvba Belgiëlaan 61 9070 Destelbergen GSM: +32 (0)485/68.60.85 Email: pieter.degrae...@systemworks.be visit us at http://www.systemworks.be