RE: Multi select transfer widget
Beautiful! That's exactly it. Thanks so much! Mike -Original Message- From: Colin Rogers [mailto:colin.rog...@objectconsulting.com.au] Sent: Wednesday, August 21, 2013 10:46 PM To: users@wicket.apache.org Subject: RE: Multi select transfer widget Michael, The component I think you mean is the Palette; http://www.mkyong.com/wicket/wicket-palette-example/ http://www.wicket-library.com/wicket-examples/compref/wicket/bookmarkable/org.apache.wicket.examples.compref.PalettePage?1 Cheers, Col. From: Michael Chandler [michael.chand...@onassignment.com] Sent: 22 August 2013 07:08 To: users@wicket.apache.org Subject: Multi select transfer widget Hi there, Is anyone aware of a good example of a multi-select transfer widget in Wicket? To be more precise, I'm talking about two multiselect drop down choice select boxes where the left box serves as a collection of available choices and the right box serves as the actual selection(s) from the possible choices. A button would allow you to move highlighted choices from the left box to the right box. There are a number of simple ways to pull it off, but I wanted to see if anyone knew of a nifty Wicket example before I began to head down that road on my own. Thanks! Mike EMAIL DISCLAIMER This email message and its attachments are confidential and may also contain copyright or privileged material. If you are not the intended recipient, you may not forward the email or disclose or use the information contained in it. If you have received this email message in error, please advise the sender immediately by replying to this email and delete the message and any associated attachments. Any views, opinions, conclusions, advice or statements expressed in this email message are those of the individual sender and should not be relied upon as the considered view, opinion, conclusions, advice or statement of this company except where the sender expressly, and with authority, states them to be the considered view, opinion, conclusions, advice or statement of this company. Every care is taken but we recommend that you scan any attachments for viruses. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: Wicket serialization concerns
Michael, This is extremely helpful. Thanks for the detailed explanation! Mike -Original Message- From: Michael Mosmann [mailto:mich...@mosmann.de] Sent: Wednesday, August 21, 2013 11:53 PM To: users@wicket.apache.org Subject: Re: Wicket serialization concerns Am 21.08.13 01:01, schrieb Michael Chandler: .. will expose me to a serialization error unless I put it in a Wicket model. Am I correct about this? There is nothing special about the serialization in Wicket. Wicket uses the default Java serialization. So every field not marked as transient will be serialized. As Martin said: watch out for non static inner classes or anon classes because you can not see the field which is created for any reference to something from the outer scope. To put your stuff behind a model has a benefit: if wicket is done with your page (response is written to the client) it will throw away anything changeable from your models. In your case the list of the entries from your database is flushed from memory. I would not recommend to put long living data into your components (which then must be serialize-able). You should put something like this into a cache. You can put everything needed to load you date from somewhere into an model. public class Customers extends LoadableDetachableModelListCustomer { @SpringBean CustomersDao dao; public Customers() { Injector.get().inject(this); } public ListCustomer load() { return dao.allCustomers(); } } This way your component must not deal with anything else .. it will use model which provides the data:) Michael:) - 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
Multi select transfer widget
Hi there, Is anyone aware of a good example of a multi-select transfer widget in Wicket? To be more precise, I'm talking about two multiselect drop down choice select boxes where the left box serves as a collection of available choices and the right box serves as the actual selection(s) from the possible choices. A button would allow you to move highlighted choices from the left box to the right box. There are a number of simple ways to pull it off, but I wanted to see if anyone knew of a nifty Wicket example before I began to head down that road on my own. Thanks! Mike
Wicket serialization concerns
I could use some input from some of the more experienced Wicket users out there. I'm having a hard time fully understanding when to worry about Wicket attempting to serialize domain model objects, resulting in serialization warnings/errors in the logs. I had been under the impression that if I had an object as a field in a Wicket component, I needed to be on alert for serialization issues. So, if I have an object as a field, I make it a LoadableDetachableModel. In cases where I need to load in a wired object, I make use of the handy @SpringBean annotation. Otherwise, I assumed I was in the clear but I'm seeing now that's not the case. In a method within a webpage component, I'm creating a List collection of domain objects for use in a form's DropDownChoice component. Unless I put that list in a LoadableDetachableModel, I will get a serialization error. I'm led to believe that creating a reference to any of my domain classes within a Wicket component (as a field or in a method implementation) will expose me to a serialization error unless I put it in a Wicket model. Am I correct about this? Thanks! Mike Chandler
Wicket with Apache Shiro
Has anyone on this list had experience integrating Apache Shiro with their Wicket project? I've had a good deal of luck implementing the basics of Shiro security in my Wicket app, but I'm struggling with their provided caching implementation with EhCache. The cacheManager is defined as a bean in my Spring applicationContext.xml per the documentation, but I keep getting this message: Another CacheManager with same name 'cacheManager' already exists in the same VM. Please provide unique names for each CacheManager in the config or do one of following: 1. Use one of the CacheManager.create() static factory methods to reuse same CacheManager with same name or create one if necessary 2. Shutdown the earlier cacheManager before creating new one with same name. The source of the existing CacheManager is: DefaultConfigurationSource [ ehcache.xml or ehcache-failsafe.xml ] I suspect this has to do with the way Wicket behaves with my application context in general and I'm unsure what the work around is. I was wondering if anyone on this list has used Apache Shiro Security with Spring on their Wicket apps. Mike Chandler Programmer Analyst On Assignment, Inc. t: 818.878.3187 f: 818.878.6582 NYSE: ASGN www.onassignment.comhttp://www.onassignment.com/ People First.
JUnit Tests failing after config change
In order to support the use of the @SpringBean annotation, I've made some adjustments to my Wicket application that work beautifully right out of the gate. The documentation and assistance from this list helped get me up to speed and working quickly. HOWEVER, my JUnit tests are now failing when attempting to create my Wicket application bean, as follows: Error creating bean with name 'wicketApplication' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/servlet/ServletContext Since these tests aren't Wicket specific, I can comment out the bean definition in applicationContext.xml and the tests run flawlessly, but that's certainly not an acceptable fix. The error indicates that I'm missing some dependencies (I'm guessing) but as a Maven project with Eclipse properly configured, I would think I would bomb when running the app normally and not just when running tests. Anyone have any ideas on what's going wrong here? To sum up, here are the modifications I made to make use of @SpringBean Included the following in web.xml: listener listener-classorg.springframework.web.context.ContextLoaderListener/listener-class /listener filter filter-namewicket.wicketFilter/filter-name filter-classorg.apache.wicket.protocol.http.WicketFilter/filter-class init-param param-nameapplicationFactoryClassName/param-name param-valueorg.apache.wicket.spring.SpringWebApplicationFactory/param-value /init-param /filter Referenced my primary WicketApplication class as a bean in applicationContext.xml: bean id=wicketApplication class=com.oa.frontoffice.FrontOfficeApp / And in my WicketApplication, I included the following in my init() method: getComponentInstantiationListeners().add(new SpringComponentInjector(this)); The results were great and I've been trucking along... but then I ran my unit tests and found that exception. Does anyone have any advice? A more complete stack trace follows if it's helpful: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'wicketApplication' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/servlet/ServletContext at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:607) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:925) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:472) at org.springframework.context.support.ClassPathXmlApplicationContext.init(ClassPathXmlApplicationContext.java:139) at org.springframework.context.support.ClassPathXmlApplicationContext.init(ClassPathXmlApplicationContext.java:83) at com.oa.frontoffice.service.BeanService.init(BeanService.java:9) at com.oa.frontoffice.service.BeanService.getInstance(BeanService.java:17) at com.oa.frontoffice.gateway.HotListGateway.init(HotListGateway.java:22) at com.oa.frontoffice.gateway.TestHotListGatewayIntegration.setUp(TestHotListGatewayIntegration.java:24) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at
RE: JUnit Tests failing after config change
Oh man. That's exactly it. Obviously, when I'm not running in the Tomcat environment, I'm missing a few things. Thanks for pointing that out Gabriel. I'm right back on track! Cheers! Mike -Original Message- From: Gabriel Landon [mailto:glan...@piti.pf] Sent: Thursday, July 25, 2013 11:08 AM To: users@wicket.apache.org Subject: Re: JUnit Tests failing after config change Mike, Maybe you could just add this in you pom.xml : dependency groupIdjavax.servlet/groupId artifactIdservlet-api/artifactId version2.5/version scopetest/scope /dependency Regards, Gabriel. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/JUnit-Tests-failing-after-config-change-tp4660493p4660495.html Sent from the Users forum 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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Unusual Serialization issue
I'm getting a serialization error when I shutdown Tomcat that has me confused. java.io.NotSerializableException: com.oa.frontoffice.service.AuthenticationService I experienced quite a bit of this at first before learning that Wicket serializes quite heavily, but gained a more thorough understanding of models and wrap my business objects in a LoadableDetachableModel like this: private boolean authenticate() { LoadableDetachableModelAuthenticationService service = new LoadableDetachableModelAuthenticationService() { private static final long serialVersionUID = 1L; @Override protected AuthenticationService load() { return new AuthenticationService(); } }; authMessage = service.getObject().authenticate(username, password); if (authMessage != SUCCESS) { return false; } return true; } Nevertheless, invoking my custom authenticate() method above seems to trigger this serialization exception upon shut down and I'm unsure as to why that is. The AuthenticationService class itself makes no references to any other classes so I don't know the root cause of this issue. If anyone has any advice on where I might need to look, I would greatly appreciate the assistance. Mike Chandler
RE: Wicket with Spring for IOC
I received outstanding guidance yesterday on integrating wicket-spring into my application and combined with the write-up along with a lot of other similar articles/blogs I found online, I'm confident I'm on the right track. I have encountered an error that has me a little mystified and was hoping someone could help shed some light. I'm getting the following exception when I attempt to start Tomcat within Eclipse: java.lang.IllegalStateException: bean of type [org.apache.wicket.protocol.http.WebApplication] not found Full stack trace below. Despite having defined my WebApplication bean in the applicationContext.xml, this exception appears at start-up, leading me to believe that it cannot find my applicationContext.xml configuration, though I feel that I'm pointing Spring and Wicket in the right direction with the following: context-param param-namecontextConfigLocation/param-name param-valueclasspath:applicationContext.xml/param-value /context-param listener listener-classorg.springframework.web.context.ContextLoaderListener/listener-class /listener I have also adjusted my filter to leverage SpringWebApplicationFactory as follows: filter filter-namewicket.wicketFilter/filter-name filter-classorg.apache.wicket.protocol.http.WicketFilter/filter-class init-param param-nameapplicationFactoryClassName/param-name param-valueorg.apache.wicket.spring.SpringWebApplicationFactory/param-value /init-param /filter filter-mapping filter-namewicket.wicketFilter/filter-name url-pattern/*/url-pattern /filter-mapping And in my applicationContext.xml, my WebApplication bean has been defined: bean id=wicketApplication class=com.oa.frontoffice.FrontOfficeApp / Lastly, I have the following in my init() method on the WebApplication object: getComponentInstantiationListeners().add(new SpringComponentInjector(this)); Has anyone encountered this exception before who can offer me some advice on where to start digging? The full stack trace is here: Jun 25, 2013 8:17:52 AM org.apache.catalina.core.StandardContext filterStart SEVERE: Exception starting filter wicket.wicketFilter java.lang.IllegalStateException: bean of type [org.apache.wicket.protocol.http.WebApplication] not found at org.apache.wicket.spring.SpringWebApplicationFactory.createApplication(SpringWebApplicationFactory.java:161) at org.apache.wicket.spring.SpringWebApplicationFactory.createApplication(SpringWebApplicationFactory.java:140) at org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:370) at org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:336) at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:277) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258) at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382) at org.apache.catalina.core.ApplicationFilterConfig.init(ApplicationFilterConfig.java:103) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4624) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5281) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1525) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1515) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) Regards, Mike -Original Message- From: Joachim Schrod [mailto:jsch...@acm.org] Sent: Monday, June 24, 2013 12:28 PM To: users@wicket.apache.org Subject: Re: Wicket with Spring for IOC Michael Chandler wrote: I'm using Wicket with Spring for dependency injection and at first really struggled with what appears to be Wicket serializing my application context. Then you probably don't use wicket-spring. Or you store your app context in a Wicket component, e.g., a page. The official documentation is https://cwiki.apache.org/confluence/display/WICKET/spring.html IMHO it's problematic because it tells you first about things you don't want to use. There's a chapter in the new free Wicket guide, but it's very basic as well. So, here's my method / recommendation: *snip* - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: Wicket with Spring for IOC
Joachim, You're brilliant. You have saved the day once again. The changes to my configuration required me to move applicationContext.xml to /src/main/resources. Thank you so much! Mike -Original Message- From: Joachim Schrod [mailto:jsch...@acm.org] Sent: Tuesday, June 25, 2013 9:01 AM To: users@wicket.apache.org Subject: Re: Wicket with Spring for IOC Michael Chandler wrote: java.lang.IllegalStateException: bean of type [org.apache.wicket.protocol.http.WebApplication] not found Full stack trace below. If a log record like the last one is output, your applicationContext.xml is found. If not: with your configuration, you need to place it in src/main/resources. Without a contextConfigLocation, it must be placed in src/main/webapp/WEB-INF. (Standard Maven dir structure assumed.) - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Wicket with Spring for IOC
I'm using Wicket with Spring for dependency injection and at first really struggled with what appears to be Wicket serializing my application context. My work-arounds so far have been less than ideal. I'm wondering if anyone can point me in the right direction as far as how to use Spring for IOC with Wicket in a way that is standard. I see there is a wicket-spring library and a wicket-ioc library as well. Are there any current tutorials online that you can point me to that might help me get my issues squared away? Initially, I was using a completely XML based application-context configuration. Will I have to switch to an annotation based configuration to use leverage some of the standard approaches? Mike Chandler Programmer Analyst On Assignment, Inc. t: 818.878.3187 f: 818.878.6582 NYSE: ASGN www.onassignment.comhttp://www.onassignment.com/ People First.
RE: Wicket with Spring for IOC
Joachim, This was a phenomenal write-up. Thank you so much for this extremely helpful guide. Much appreciated! Regards, Mike -Original Message- From: Joachim Schrod [mailto:jsch...@acm.org] Sent: Monday, June 24, 2013 12:28 PM To: users@wicket.apache.org Subject: Re: Wicket with Spring for IOC Michael Chandler wrote: I'm using Wicket with Spring for dependency injection and at first really struggled with what appears to be Wicket serializing my application context. Then you probably don't use wicket-spring. Or you store your app context in a Wicket component, e.g., a page. The official documentation is https://cwiki.apache.org/confluence/display/WICKET/spring.html IMHO it's problematic because it tells you first about things you don't want to use. There's a chapter in the new free Wicket guide, but it's very basic as well. So, here's my method / recommendation: 1. I use Maven. One needs a dependency to org.apache.wicket:wicket-spring. 2. My application object is a Spring Bean. It's declared in WEB-INF/applicationContext.xml. web.xml tells about it listener description Load WebApplicationContext of Spring from WEB-INF/applicationContext.xml. /description listener-classorg.springframework.web.context.ContextLoaderListener/listener-class /listener filter filter-nameWicket Application Filter/filter-name filter-classorg.apache.wicket.protocol.http.WicketFilter/filter-class init-param param-nameapplicationFactoryClassName/param-name param-valueorg.apache.wicket.spring.SpringWebApplicationFactory/param-value /init-param init-param param-nameignorePaths/param-name param-value/js,/css,/images/param-value /init-param /filter (Adapt your ignorePaths as needed.) 3. Within your application object, you need to call this.getComponentInstantiationListeners().add(new SpringComponentInjector(this)); Usually, it's sufficient to call that in init(). Except if you're using converters that need access to Spring beans, e.g., services. Then, newConverterLocator() is a better place for it. 4. Within your Wicket components, tag Spring beans with an annotation: @SpringBean BeanClass beanObject; Wicket will inject the Spring bean. Of course, you need to *declare* your Spring bean in Spring! I.e., you either need to declare an application-level bean in WEB-INF/applicationContext.xml or you need to trigger annotation scanning by Spring. (context:component-scan and friends.) 5. If you need Spring beans in a behavior, resource, or any other non-component class, you need to tell Wicket about it. For that, you call Injector.get().inject(this); in that class' constructor. Afterwards, @SpringBean injections work in that class. That's all. It just works. HTH, Joachim -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Joachim Schrod, Roedermark, Germany Email: jsch...@acm.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
Wicket Security examples
Good morning, I'm having a hard time finding some solid example implementations of Wicket Auth/Roles, specifically regarding authentication. I think the documentation on the link below is well spelled out, but it would be nice to see an example of Authentication. http://wicket.apache.org/learn/projects/authroles.html The current authentication example that is linked on that page returns a 404. Also, I'm interested in hearing anyone's insight into using Apache Shiro with Wicket. Our senior management is pretty keen on seeing us implement a security framework that has a more powerful set of features. I've found Shiro to be mostly easy to implement, with the exception of managing multiple authentication realms. I was also curious to know, considering the age of Wicket Shiro, whether or not that plug-in will work with Wicket 6.8 or if it's restricted to 1.5 or earlier. Are there any problems with Wicket Auth/Roles that might be better handled with a security framework like Apache Shiro? https://github.com/wicketstuff/core/tree/core-1.5.x/jdk-1.5-parent/shiro-security Thanks so much for any input you can offer. Regards, Mike
RE: Wicket Security examples
Not sure how I missed that, thanks Martijn. -Original Message- From: Martijn Dashorst [mailto:martijn.dasho...@gmail.com] Sent: Tuesday, June 11, 2013 12:52 PM To: users@wicket.apache.org Subject: Re: Wicket Security examples http://www.wicket-library.com/wicket-examples/index.html See the authentication-1 through authentication-3 examples. Martijn On Tue, Jun 11, 2013 at 7:18 PM, Michael Chandler michael.chand...@onassignment.com wrote: Good morning, I'm having a hard time finding some solid example implementations of Wicket Auth/Roles, specifically regarding authentication. I think the documentation on the link below is well spelled out, but it would be nice to see an example of Authentication. http://wicket.apache.org/learn/projects/authroles.html The current authentication example that is linked on that page returns a 404. Also, I'm interested in hearing anyone's insight into using Apache Shiro with Wicket. Our senior management is pretty keen on seeing us implement a security framework that has a more powerful set of features. I've found Shiro to be mostly easy to implement, with the exception of managing multiple authentication realms. I was also curious to know, considering the age of Wicket Shiro, whether or not that plug-in will work with Wicket 6.8 or if it's restricted to 1.5 or earlier. Are there any problems with Wicket Auth/Roles that might be better handled with a security framework like Apache Shiro? https://github.com/wicketstuff/core/tree/core-1.5.x/jdk-1.5-parent/shi ro-security Thanks so much for any input you can offer. Regards, Mike -- Become a Wicket expert, learn from the best: http://wicketinaction.com - 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: Forms do not reset after submit
This means that your freshly created page instance loads data from a source which caches its data. E.g. your EntityFactory does not always return a fresh instance. So the first question is: how do you link to your Add a record page? Bas, You are definitely describing the stateful nature of the behavior I'm seeing. I'm linking to add a record as follows: LinkString addJobLink = new LinkString(addJobLink){ private static final long serialVersionUID = 1L; @Override public void onClick() { setResponsePage(new JobAddPage()); } }; Mike -Original Message- From: Bas Gooren [mailto:b...@iswd.nl] Sent: Tuesday, February 19, 2013 9:20 AM To: users@wicket.apache.org Subject: Re: Forms do not reset after submit Hi! What you describe should only happen in certain cases: - when you link to the page using a stored reference e.g. in ctor: myTargetPage = new MyTargetPage() in click handler: setResponsePage(myTargetPage); This results in a single, shared page instance. The page will keep track of state, and thus the state is shared. - when you create a new page instance (bookmarkable or not doesn't matter) for every click, but it's data comes from a static source (page-static, session-based or other) This means that your freshly created page instance loads data from a source which caches its data. E.g. your EntityFactory does not always return a fresh instance. So the first question is: how do you link to your Add a record page? Met vriendelijke groet, Kind regards, Bas Gooren Op 19-2-2013 17:12, schreef Michael Chandler: Good morning all! I thought I had a good handle on an issue I was having, but it appears as though that problem is persisting. When I present a form to the user to collect information that saves on a domain object, the form does not reset after the form has been submitted. At first, I thought it was related to how I link to pages, then I became convinced it was my use of a LoadableDetachableModel. Now, after refactoring the code several times, I'm convinced that I have over-looked something simple but I cannot figure out what it is. To summarize, I have a form that binds to an object as follows: CompoundPropertyModelJob jobModel = new CompoundPropertyModelJob((Job) EntityFactory.getInstance().getBean(job)); jobForm.setModel(jobModel); When the form fields are all completed and the form is submitted, the form's onSubmit() successfully handles the submission and my implementation persists the data to my domain object (Job) and the data is confirmed in the database. The last line conducts a redirect to the main screen with a setResponsePage() call. When I click the link to add a new record to the database using the same form, the form fields are populated with all of the same data I just entered, suggesting to me that the previous domain object is still bound to that page instead of refreshing and binding a clean, new instance of the Job class. Can anyone offer any tips or suggestions on what I am doing wrong? Best, Mike - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: Forms do not reset after submit
This means that your freshly created page instance loads data from a source which caches its data. E.g. your EntityFactory does not always return a fresh instance. So the first question is: how do you link to your Add a record page? Bas, following up on your second consideration, that my EntityFactory was caching, you were spot on. That is exactly my problem. Everything from a Wicket standpoint was good, but my EntityFactory was returning the same instance of that object. Thanks for opening my eyes! Sometimes it's the little things that nail me! :) A thousand thanks! Mike - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: Forms do not reset after submit
And is the EntityFactory class something you've built yourself? It is and a quick test revealed that was the culprit! I've got some work to do there. Thanks so much, Bas! Regards, Mike - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: Eclipse or IntelliJ
I also develop on a Mac, but I use Eclipse. I've become so familiar with the Eclipse tools and shortcut keys along with the Maven plugins and Tomcat Server panel/console that I've never bothered to try anything else, though I should probably put my fears aside and give IntelliJ a spin! Mike -Original Message- From: Francois Meillet [mailto:francois.meil...@gmail.com] Sent: Tuesday, February 19, 2013 2:09 PM To: users@wicket.apache.org Subject: Re: Eclipse or IntelliJ You have a mac ? Choose the best tool ! Choose Intellij ! François Meillet Formation Wicket - Développement Wicket Le 19 févr. 2013 à 23:06, Stephen Walsh step...@connectwithawalsh.com a écrit : That's what I'm hoping for. IntelliJ looks a lot more polished especially for the Mac. Eclipse is crippling at times because it is so slow. Just sort of getting a feel for the Wicket community and what people like best. ___ Stephen Walsh | http://connectwithawalsh.com On Tue, Feb 19, 2013 at 4:03 PM, Josh Kamau joshnet2...@gmail.com wrote: Hi; You use one of them and you feel like you are missing something? No you are not. The one you are most familiar with is the best. I use intellij ... This discussion might also give you what you are looking for. http://www.linkedin.com/groups/Which-IDE-you-use-develop-80181.S.1259 32453?qid=98abd743-9a14-4eee-91e5-dbd6854bbf52trk=group_most_popular -0-b-ttlgoback=%2Egmp_80181 Josh On Wed, Feb 20, 2013 at 1:00 AM, Cedric Gatay gata...@gmail.com wrote: At SRMvision we use exclusively IntelliJ for developping. Its excellent Maven support, smart completion and robustness made us forget eclipse very quickly. Le 19 févr. 2013 22:18, Stephen Walsh step...@connectwithawalsh.com a écrit : Who uses what and why? I've only ever used Eclipse, but I discovered IntelliJ earlier this week and it's so different. Just wondering pros and cons on each. Thanks! ___ Stephen Walsh | http://connectwithawalsh.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Fundamental forms/models issue
Good morning/afternoon everyone. I'm having a basic problem fully deciphering how to best manage my forms, specifically related to Models that are attached to forms. Since a Wicket WebPage has it's constructor invoked only one time in the application lifecycle, I'm failing to fully understand how to present a form that has a model bound to it without inadvertently sharing that instance of the Model with every user of the application. It seems like a fundamental issue that I'm failing to fully grasp and could use some input. As an example, I have the following in my constructor: LoadableDetachableModelJob jobModel = new LoadableDetachableModelJob() { private static final long serialVersionUID = 1L; @Override protected Job load() { Job job = (Job) EntityFactory.getInstance().getBean(job); // if we're editing an existing job, load the object if (jobId = 1) { job.load(jobId); } return job; } }; I later create a form and after adding it in my constructor, bind the model to it as follows: jobForm.setModel(new CompoundPropertyModelJob(jobModel)); As you can imagine, every user session from this point on now has that instance of a Job object bound to that form due to these declarations being in the page constructor. I have come a long way on my own, but I'm at a point where I clearly do not have a full grasp of how to best approach this. I suspect I can potentially override an instance of a Model's getObject() method for more dynamic behavior, but I'm concerned about writing code that becomes too verbose when perhaps there's a better/tighter way to handle this. Can anyone advise me? Many thanks! Mike Chandler
RE: Fundamental forms/models issue
Oh my gosh, Paul. You just nailed my problem I think. I'm doing this: setResponsePage(MyPage.class); Instead of this: setResponsePage(new MyPage()); Thanks for the link. Clearly, I have more reading to do! Thanks all! Mike -Original Message- From: Paul Bors [mailto:p...@bors.ws] Sent: Monday, February 18, 2013 10:08 AM To: users@wicket.apache.org Subject: Re: Fundamental forms/models issue What are you really trying to accomplish here? I think you're on the right path only one thing I would mention, the page constructor is not called only once per application life cycle. Same page can be constructed multiple times if you have a link going to that page and you calll setResponsePage(new MyPage()). More on detachable models: https://cwiki.apache.org/WICKET/detachable-models.html ~ Thank you, Paul Bors On Mon, Feb 18, 2013 at 12:47 PM, Michael Chandler michael.chand...@onassignment.com wrote: Good morning/afternoon everyone. I'm having a basic problem fully deciphering how to best manage my forms, specifically related to Models that are attached to forms. Since a Wicket WebPage has it's constructor invoked only one time in the application lifecycle, I'm failing to fully understand how to present a form that has a model bound to it without inadvertently sharing that instance of the Model with every user of the application. It seems like a fundamental issue that I'm failing to fully grasp and could use some input. As an example, I have the following in my constructor: LoadableDetachableModelJob jobModel = new LoadableDetachableModelJob() { private static final long serialVersionUID = 1L; @Override protected Job load() { Job job = (Job) EntityFactory.getInstance().getBean(job); // if we're editing an existing job, load the object if (jobId = 1) { job.load(jobId); } return job; } }; I later create a form and after adding it in my constructor, bind the model to it as follows: jobForm.setModel(new CompoundPropertyModelJob(jobModel)); As you can imagine, every user session from this point on now has that instance of a Job object bound to that form due to these declarations being in the page constructor. I have come a long way on my own, but I'm at a point where I clearly do not have a full grasp of how to best approach this. I suspect I can potentially override an instance of a Model's getObject() method for more dynamic behavior, but I'm concerned about writing code that becomes too verbose when perhaps there's a better/tighter way to handle this. Can anyone advise me? Many thanks! Mike Chandler - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: Fundamental forms/models issue
To conclude, my issues stemmed from not properly linking from page to page. I did a lot of this: BookmarkablePageLinkString(link, MyClass.class); Instead of this: LinkString(link) { public void onClick() { setResponsePage(new MyClass()); } } Oopsy! I can see how the former might benefit me down the road, but not for general use. Thanks again everyone. Mike -Original Message- From: Michael Chandler [mailto:michael.chand...@onassignment.com] Sent: Monday, February 18, 2013 10:35 AM To: users@wicket.apache.org Subject: RE: Fundamental forms/models issue Oh my gosh, Paul. You just nailed my problem I think. I'm doing this: setResponsePage(MyPage.class); Instead of this: setResponsePage(new MyPage()); Thanks for the link. Clearly, I have more reading to do! Thanks all! Mike -Original Message- From: Paul Bors [mailto:p...@bors.ws] Sent: Monday, February 18, 2013 10:08 AM To: users@wicket.apache.org Subject: Re: Fundamental forms/models issue What are you really trying to accomplish here? I think you're on the right path only one thing I would mention, the page constructor is not called only once per application life cycle. Same page can be constructed multiple times if you have a link going to that page and you calll setResponsePage(new MyPage()). More on detachable models: https://cwiki.apache.org/WICKET/detachable-models.html ~ Thank you, Paul Bors On Mon, Feb 18, 2013 at 12:47 PM, Michael Chandler michael.chand...@onassignment.com wrote: Good morning/afternoon everyone. I'm having a basic problem fully deciphering how to best manage my forms, specifically related to Models that are attached to forms. Since a Wicket WebPage has it's constructor invoked only one time in the application lifecycle, I'm failing to fully understand how to present a form that has a model bound to it without inadvertently sharing that instance of the Model with every user of the application. It seems like a fundamental issue that I'm failing to fully grasp and could use some input. As an example, I have the following in my constructor: LoadableDetachableModelJob jobModel = new LoadableDetachableModelJob() { private static final long serialVersionUID = 1L; @Override protected Job load() { Job job = (Job) EntityFactory.getInstance().getBean(job); // if we're editing an existing job, load the object if (jobId = 1) { job.load(jobId); } return job; } }; I later create a form and after adding it in my constructor, bind the model to it as follows: jobForm.setModel(new CompoundPropertyModelJob(jobModel)); As you can imagine, every user session from this point on now has that instance of a Job object bound to that form due to these declarations being in the page constructor. I have come a long way on my own, but I'm at a point where I clearly do not have a full grasp of how to best approach this. I suspect I can potentially override an instance of a Model's getObject() method for more dynamic behavior, but I'm concerned about writing code that becomes too verbose when perhaps there's a better/tighter way to handle this. Can anyone advise me? Many thanks! Mike Chandler - 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: Anyone using Wicket-Stuff Facebook
I also plan to use Scribe and spent a little time with it this weekend. My particular example uses LinkedIn, but the implementations would probably be near identical. In this particular example, I'm trying to retrieve the Authorize URL that a user would use to authenticate with LinkedIn. The following method returns the API hyperlink that I would use for a Login with LinkedIn button: private String getLinkedInAuth() { OAuthService service = new ServiceBuilder() .provider(LinkedInApi.class) .apiKey(your_api_key).apiSecret(your_api_secret_hash).build(); Token requestToken = service.getRequestToken(); String link = service.getAuthorizationUrl(requestToken); return link; } I haven't done much from there, but I believe you should be able to define a return URL when a user successfully authenticates that you host (check your Facebook app config on Facebook.com). That URL should be prepared to accept a response that will include the user's access token which you will use to sign any of your graph api requests. I haven't completed my integration so hopefully I am not over simplifying. Mike -Original Message- From: Stephen Walsh [mailto:step...@connectwithawalsh.com] Sent: Monday, February 18, 2013 10:47 AM To: users@wicket.apache.org Subject: Re: Anyone using Wicket-Stuff Facebook I'm also using Scribe, Martin. I'm following up with the developer to figure out how to use it. He has a copy and paste in his example which obviously won't work for an actual user. https://github.com/fernandezpablo85/scribe-java/blob/master/src/test/java/org/scribe/examples/FacebookExample.java ___ Stephen Walsh | http://connectwithawalsh.com On Mon, Feb 18, 2013 at 1:53 AM, Martin Grigorov mgrigo...@apache.orgwrote: Hi, If you need to implement OAuth authentication then I can recommend you https://github.com/fernandezpablo85/scribe-java It is easy to implement both OAuth v.1 and v.2 with it On Mon, Feb 18, 2013 at 5:28 AM, Stephen Walsh step...@connectwithawalsh.com wrote: https://github.com/wicketstuff/core/wiki/Facebook Anyone using this that can point me in the right direction on how to use the behaviors? I followed the example on getting a login button and it seems like that works well, but I have no idea to tell if the user has validated and how to capture that validation. Clearly it's in the behaviors section of the jar, but I'm not quite sure how to use it. Thanks. ___ Stephen Walsh | http://connectwithawalsh.com -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: Anyone using Wicket-Stuff Facebook
Hi Stephen you should be able to define a return URL when a user successfully authenticates that you host This is the part that I don't understand. I guess I create a separate OAuth class page that launches when the user authenticates, but how I get the code out of the URL? I need the code to send back to Facebook so I can get an access token. Right. In the Scribe example, you are working in the console so a code is provided that you punch in to your console which gets consumed by a Verifier. I don't believe it will work that way in an actual seemless integration. Instead, you should be able to define a OAuth Accept Redirect URL which effectively informs Facebook to post back the credentials to that URL you specify. Here is where I am assuming since I haven't completed the integration... instead of getting an access token by sending the Verifer instance back to Facebook with the request token, Facebook should post the access token to your OAuth Accept Redirect URL which you can consume and set to a Token instance. Again, I'm assuming at this point. It's possible that your OAuth Accept Redirect URL consumes that code and then you're expected to request the access token at that point... Go to your Facebook App in the Developers console and define a URL for the OAuth Redirect URI. Put something together and try it. I believe it will send back an access token in the query string if memory serves. When I have something working, I'll gladly share it with you to provide clarification. Mike -Original Message- From: Stephen Walsh [mailto:step...@connectwithawalsh.com] Sent: Monday, February 18, 2013 12:26 PM To: users@wicket.apache.org Subject: Re: Anyone using Wicket-Stuff Facebook On Mon, Feb 18, 2013 at 1:59 PM, Michael Chandler michael.chand...@onassignment.com wrote: you should be able to define a return URL when a user successfully authenticates that you host This is the part that I don't understand. I guess I create a separate OAuth class page that launches when the user authenticates, but how I get the code out of the URL? I need the code to send back to Facebook so I can get an access token. The other part that is confusing to me is that I had an identical JUnit test set up to do what you did above, but I'm getting an error: java.lang.UnsupportedOperationException: Unsupported operation, please use 'getAuthorizationUrl' and redirect your users there on this line Token requestToken = service.getRequestToken(); I'd be really interested to see how you implement with LinkedIn as I assume it will be very similar for my implementation. Thanks, Mike. ___ Stephen Walsh | http://connectwithawalsh.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: Anyone using Wicket-Stuff Facebook
The browser gets a token back that makes perfect sense and the example is completed. How do I consume the token? I'll play around with it a bit and let you know what I come up with. Thanks for the help. Based on the path I was taking, the redirect URI is the key. Facebook redirects as such: YOUR_REDIRECT_URI? access_token=USER_ACCESS_TOKEN expires_in=NUMBER_OF_SECONDS_UNTIL_TOKEN_EXPIRES state=YOUR_STATE_VALUE Of course, if the request fails authentication, they redirect as follows: YOUR_REDIRECT_URI? error_reason=user_denied error=access_denied error_description=The+user+denied+your+request. state=YOUR_STATE_VALUE So your redirect page could start out like this: public class FacebookResponseListener extends WebPage { private static final long serialVersionUID = 1L; public FacebookResponseListener(PageParameters params) { // if there is an error, handle it if (params.get(error_reason) != null) { // handle the error here! } else { String accessToken = params.get(access_token).toString(); int expiresIn = params.get(expires_in).toInt(); // etc... etc... } } } Mike - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: Wicket training - instructor led
Books are on order and shipping to me just in time for the holiday! :) Thanks Paul! -Original Message- From: Paul Bors [mailto:p...@bors.ws] Sent: Thursday, December 13, 2012 9:21 AM To: users@wicket.apache.org Subject: RE: Wicket training - instructor led http://wicket.apache.org/learn/books/ :) -Original Message- From: Michael Chandler [mailto:michael.chand...@onassignment.com] Sent: Thursday, December 13, 2012 11:52 AM To: users@wicket.apache.org Subject: Wicket training - instructor led Greetings! I was hoping someone might be able to point me in the right direction for Wicket training either in the United States or someone interested in doing online/webinar training. I have located two good sources in the US who are well respected and very knowledgeable, but they are booked solid through the entire first quarter of next year. Is anyone aware of any good training sources for Wicket who are willing to do an online classroom style of training? In the meantime, I'll most likely submit my inquiries (confusion?) here from time to time, so hello everyone! Nice to meet you all! ;) Best, Mike Chandler - 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