Re: Form questions
I've made a lot of progress and been through chapters 9 and 10 of Wicket Free Guide, but I'm still stumped on point #2, pre-populating the form. Here's what I have right now: public class CnavForm extends Form { @Inject private CnavUrlDAO cnavUrlDAO; public CnavForm(String id) { super(id); CnavUrl cnavUrl = new MorphiaCnavUrl(); setModel(new Model((Serializable) cnavUrl)); add(new TextField(url, new PropertyModel(cnavUrl, URL)) .setRequired(true) .add(new UrlValidator())); add(new HiddenField(objectid, new PropertyModel(cnavUrl, id))); add(new Button(publish) { @Override public void onSubmit() { CnavUrl cnavUrl = (CnavUrl) CnavForm.this.getModelObject(); // check for existing record to know if this is a create or update if (((MorphiaCnavUrlModel)cnavUrl).getId() == null) { // create cnavUrlDAO.save(cnavUrl); } else { // update cnavUrlDAO.save(cnavUrl); } } }); } } I need to know how to do two things. 1) how to link to the page that displays the form, and pass it the ID for the record I want to edit 2) load the object from the database and have it replace the model I create in the constructor Obviously I can make a database call and get the object. Is the constructor called every time the page is requested, so that I could check for an ID and either create the model or load it from the database? If so, then I just need help with #1. Thanks, Daniel On Wed, Jul 17, 2013 at 10:19 AM, Daniel Watrous dwmaill...@gmail.comwrote: I think I'm getting it now. The Form needs to be embedded in a panel for the type of inclusion that I'm interested in. I created a CnavFormPanel.java and changed CnavForm.html to CnavFormPanel.html. I left CnavForm.java alone. In CnavModify.java I removed this Form form = new CnavForm(cnavFormArea); add(form); And added this add(new CnavFormPanel(cnavFormArea)); That works. Thanks for your help. Daniel On Wed, Jul 17, 2013 at 10:07 AM, Daniel Watrous dwmaill...@gmail.comwrote: I can make it work if I put the markup from CnavForm.html directly into CnavModify, but the form is not as reusable then. I would have to duplicate the markup for other pages that use the same form... Dnaiel On Wed, Jul 17, 2013 at 9:55 AM, Daniel Watrous dwmaill...@gmail.comwrote: That's what I tried to do. I created CnavForm.java and CnavForm.html. In the latter file I have this wicket:panel form wicket:id=cnavForm... // form details /form /wicket:panel Then I have CnavModify.java and CnavModify.html. You already see what I have in CnavModify.java from my last email. My CnavModify.html has this. wicket:extend span wicket:id=cnavFormAreaHere's the form/span /wicket:extend Rather than render I'm getting this error: Last cause: Component [cnavFormArea] (path = [0:cnavFormArea]) must be applied to a tag of type [form], not: 'span wicket:id=cnavFormArea id=cnavFormArea3' (line 0, column 0) I'll keep trying and report back when I figure it out. Daniel On Tue, Jul 16, 2013 at 10:50 PM, Paul Bors p...@bors.ws wrote: Wicket is a MVC component driven framework similar to Swing. In short, what you want to do is create your own Panel with that form file of yours and add it to another Panel as a child. See chapter 4 Keeping control over HTML of the Wicket Free Guide at: http://code.google.com/p/wicket-guide/ Also available from under the Learn section as the Books link on the right side navigation section on Wicket's home page at: http://wicket.apache.org/learn/books/ ~ Thank you, Paul Bors -Original Message- From: Daniel Watrous [mailto:dwmaill...@gmail.com] Sent: Tuesday, July 16, 2013 7:13 PM To: users@wicket.apache.org Subject: Re: Form questions Thanks Paul and Sven. I got the form to work and available in the onSubmit handler. Now I'm interested in splitting the form out into it's one file. So I created a class that has nothing more than the form, but I'm not sure how to include this into a page. In my class I do this: public class CnavModify extends ConsoleBasePage { public CnavModify(PageParameters parameters) { super(parameters); Form form = new CnavForm(cnavFormArea); add(form); } } My CnavModify obviously extends a base page. What do I put inside the wicket:extend tag to have the form render? Daniel On Tue, Jul 16, 2013 at 12:00 AM, Sven Meier s...@meiers.net wrote: Hi, Some problems I can't figure out. The code to create the button complains that it requires a CnavUrl but gets back a String. add(new Button(publish, model) { @Override public void onSubmit
Re: Form questions
That's what I tried to do. I created CnavForm.java and CnavForm.html. In the latter file I have this wicket:panel form wicket:id=cnavForm... // form details /form /wicket:panel Then I have CnavModify.java and CnavModify.html. You already see what I have in CnavModify.java from my last email. My CnavModify.html has this. wicket:extend span wicket:id=cnavFormAreaHere's the form/span /wicket:extend Rather than render I'm getting this error: Last cause: Component [cnavFormArea] (path = [0:cnavFormArea]) must be applied to a tag of type [form], not: 'span wicket:id=cnavFormArea id=cnavFormArea3' (line 0, column 0) I'll keep trying and report back when I figure it out. Daniel On Tue, Jul 16, 2013 at 10:50 PM, Paul Bors p...@bors.ws wrote: Wicket is a MVC component driven framework similar to Swing. In short, what you want to do is create your own Panel with that form file of yours and add it to another Panel as a child. See chapter 4 Keeping control over HTML of the Wicket Free Guide at: http://code.google.com/p/wicket-guide/ Also available from under the Learn section as the Books link on the right side navigation section on Wicket's home page at: http://wicket.apache.org/learn/books/ ~ Thank you, Paul Bors -Original Message- From: Daniel Watrous [mailto:dwmaill...@gmail.com] Sent: Tuesday, July 16, 2013 7:13 PM To: users@wicket.apache.org Subject: Re: Form questions Thanks Paul and Sven. I got the form to work and available in the onSubmit handler. Now I'm interested in splitting the form out into it's one file. So I created a class that has nothing more than the form, but I'm not sure how to include this into a page. In my class I do this: public class CnavModify extends ConsoleBasePage { public CnavModify(PageParameters parameters) { super(parameters); Form form = new CnavForm(cnavFormArea); add(form); } } My CnavModify obviously extends a base page. What do I put inside the wicket:extend tag to have the form render? Daniel On Tue, Jul 16, 2013 at 12:00 AM, Sven Meier s...@meiers.net wrote: Hi, Some problems I can't figure out. The code to create the button complains that it requires a CnavUrl but gets back a String. add(new Button(publish, model) { @Override public void onSubmit() { CnavUrl cnavUrl = (CnavUrl) getModelObject(); System.out.println(publish); } }); a Button always has a IModelString to fill the value attribute. Note that in #onSubmit() you're getting the model object of the button, not of your form. You can write: add(new Button(publish, model) { @Override public void onSubmit() { CnavUrl cnavUrl = (CnavUrl) MyForm.this.getModelObject(); System.out.println(publish); } }); Using generic types in your code should help you. Sven On 07/15/2013 11:41 PM, Daniel Watrous wrote: Hello, I'm interested in creating a single Form that will accommodate the following use cases 1) display blank for creating new records 2) pre-populate for editing existing records 3) map submitted values on to an existing domain object 4) accommodate two actions, Save Draft -or- Publish I'm following Wicket in Action and within my Form constructor I create my model, like this CnavUrl cnavUrl = new BasicCnavUrl(); IModel model = new Model((Serializable) cnavUrl); setModel(model); I then use PropertyModel add(new TextField(url, new PropertyModel(cnavUrl, url))); For the two actions, I'm creating the Button objects like this add(new Button(publish, model) { @Override public void onSubmit() { CnavUrl cnavUrl = (CnavUrl) getModelObject(); System.out.println(publish); } }); Some problems I can't figure out. The code to create the button complains that it requires a CnavUrl but gets back a String. It seems that a new BasicCnavUrl is created once with the Form. What happens on subsequent calls? Can I always expect my model to have the data from the current form submission? Is there a best way to incorporate the idea of an edit, where the model is pre-populated from a data source and pre-fills the Form fields? Thanks, Daniel --**--**-- --- To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.orgusers-unsubscribe@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: Form questions
I can make it work if I put the markup from CnavForm.html directly into CnavModify, but the form is not as reusable then. I would have to duplicate the markup for other pages that use the same form... Dnaiel On Wed, Jul 17, 2013 at 9:55 AM, Daniel Watrous dwmaill...@gmail.comwrote: That's what I tried to do. I created CnavForm.java and CnavForm.html. In the latter file I have this wicket:panel form wicket:id=cnavForm... // form details /form /wicket:panel Then I have CnavModify.java and CnavModify.html. You already see what I have in CnavModify.java from my last email. My CnavModify.html has this. wicket:extend span wicket:id=cnavFormAreaHere's the form/span /wicket:extend Rather than render I'm getting this error: Last cause: Component [cnavFormArea] (path = [0:cnavFormArea]) must be applied to a tag of type [form], not: 'span wicket:id=cnavFormArea id=cnavFormArea3' (line 0, column 0) I'll keep trying and report back when I figure it out. Daniel On Tue, Jul 16, 2013 at 10:50 PM, Paul Bors p...@bors.ws wrote: Wicket is a MVC component driven framework similar to Swing. In short, what you want to do is create your own Panel with that form file of yours and add it to another Panel as a child. See chapter 4 Keeping control over HTML of the Wicket Free Guide at: http://code.google.com/p/wicket-guide/ Also available from under the Learn section as the Books link on the right side navigation section on Wicket's home page at: http://wicket.apache.org/learn/books/ ~ Thank you, Paul Bors -Original Message- From: Daniel Watrous [mailto:dwmaill...@gmail.com] Sent: Tuesday, July 16, 2013 7:13 PM To: users@wicket.apache.org Subject: Re: Form questions Thanks Paul and Sven. I got the form to work and available in the onSubmit handler. Now I'm interested in splitting the form out into it's one file. So I created a class that has nothing more than the form, but I'm not sure how to include this into a page. In my class I do this: public class CnavModify extends ConsoleBasePage { public CnavModify(PageParameters parameters) { super(parameters); Form form = new CnavForm(cnavFormArea); add(form); } } My CnavModify obviously extends a base page. What do I put inside the wicket:extend tag to have the form render? Daniel On Tue, Jul 16, 2013 at 12:00 AM, Sven Meier s...@meiers.net wrote: Hi, Some problems I can't figure out. The code to create the button complains that it requires a CnavUrl but gets back a String. add(new Button(publish, model) { @Override public void onSubmit() { CnavUrl cnavUrl = (CnavUrl) getModelObject(); System.out.println(publish); } }); a Button always has a IModelString to fill the value attribute. Note that in #onSubmit() you're getting the model object of the button, not of your form. You can write: add(new Button(publish, model) { @Override public void onSubmit() { CnavUrl cnavUrl = (CnavUrl) MyForm.this.getModelObject(); System.out.println(publish); } }); Using generic types in your code should help you. Sven On 07/15/2013 11:41 PM, Daniel Watrous wrote: Hello, I'm interested in creating a single Form that will accommodate the following use cases 1) display blank for creating new records 2) pre-populate for editing existing records 3) map submitted values on to an existing domain object 4) accommodate two actions, Save Draft -or- Publish I'm following Wicket in Action and within my Form constructor I create my model, like this CnavUrl cnavUrl = new BasicCnavUrl(); IModel model = new Model((Serializable) cnavUrl); setModel(model); I then use PropertyModel add(new TextField(url, new PropertyModel(cnavUrl, url))); For the two actions, I'm creating the Button objects like this add(new Button(publish, model) { @Override public void onSubmit() { CnavUrl cnavUrl = (CnavUrl) getModelObject(); System.out.println(publish); } }); Some problems I can't figure out. The code to create the button complains that it requires a CnavUrl but gets back a String. It seems that a new BasicCnavUrl is created once with the Form. What happens on subsequent calls? Can I always expect my model to have the data from the current form submission? Is there a best way to incorporate the idea of an edit, where the model is pre-populated from a data source and pre-fills the Form fields? Thanks, Daniel --**--**-- --- To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.orgusers
Re: Form questions
I think I'm getting it now. The Form needs to be embedded in a panel for the type of inclusion that I'm interested in. I created a CnavFormPanel.java and changed CnavForm.html to CnavFormPanel.html. I left CnavForm.java alone. In CnavModify.java I removed this Form form = new CnavForm(cnavFormArea); add(form); And added this add(new CnavFormPanel(cnavFormArea)); That works. Thanks for your help. Daniel On Wed, Jul 17, 2013 at 10:07 AM, Daniel Watrous dwmaill...@gmail.comwrote: I can make it work if I put the markup from CnavForm.html directly into CnavModify, but the form is not as reusable then. I would have to duplicate the markup for other pages that use the same form... Dnaiel On Wed, Jul 17, 2013 at 9:55 AM, Daniel Watrous dwmaill...@gmail.comwrote: That's what I tried to do. I created CnavForm.java and CnavForm.html. In the latter file I have this wicket:panel form wicket:id=cnavForm... // form details /form /wicket:panel Then I have CnavModify.java and CnavModify.html. You already see what I have in CnavModify.java from my last email. My CnavModify.html has this. wicket:extend span wicket:id=cnavFormAreaHere's the form/span /wicket:extend Rather than render I'm getting this error: Last cause: Component [cnavFormArea] (path = [0:cnavFormArea]) must be applied to a tag of type [form], not: 'span wicket:id=cnavFormArea id=cnavFormArea3' (line 0, column 0) I'll keep trying and report back when I figure it out. Daniel On Tue, Jul 16, 2013 at 10:50 PM, Paul Bors p...@bors.ws wrote: Wicket is a MVC component driven framework similar to Swing. In short, what you want to do is create your own Panel with that form file of yours and add it to another Panel as a child. See chapter 4 Keeping control over HTML of the Wicket Free Guide at: http://code.google.com/p/wicket-guide/ Also available from under the Learn section as the Books link on the right side navigation section on Wicket's home page at: http://wicket.apache.org/learn/books/ ~ Thank you, Paul Bors -Original Message- From: Daniel Watrous [mailto:dwmaill...@gmail.com] Sent: Tuesday, July 16, 2013 7:13 PM To: users@wicket.apache.org Subject: Re: Form questions Thanks Paul and Sven. I got the form to work and available in the onSubmit handler. Now I'm interested in splitting the form out into it's one file. So I created a class that has nothing more than the form, but I'm not sure how to include this into a page. In my class I do this: public class CnavModify extends ConsoleBasePage { public CnavModify(PageParameters parameters) { super(parameters); Form form = new CnavForm(cnavFormArea); add(form); } } My CnavModify obviously extends a base page. What do I put inside the wicket:extend tag to have the form render? Daniel On Tue, Jul 16, 2013 at 12:00 AM, Sven Meier s...@meiers.net wrote: Hi, Some problems I can't figure out. The code to create the button complains that it requires a CnavUrl but gets back a String. add(new Button(publish, model) { @Override public void onSubmit() { CnavUrl cnavUrl = (CnavUrl) getModelObject(); System.out.println(publish); } }); a Button always has a IModelString to fill the value attribute. Note that in #onSubmit() you're getting the model object of the button, not of your form. You can write: add(new Button(publish, model) { @Override public void onSubmit() { CnavUrl cnavUrl = (CnavUrl) MyForm.this.getModelObject(); System.out.println(publish); } }); Using generic types in your code should help you. Sven On 07/15/2013 11:41 PM, Daniel Watrous wrote: Hello, I'm interested in creating a single Form that will accommodate the following use cases 1) display blank for creating new records 2) pre-populate for editing existing records 3) map submitted values on to an existing domain object 4) accommodate two actions, Save Draft -or- Publish I'm following Wicket in Action and within my Form constructor I create my model, like this CnavUrl cnavUrl = new BasicCnavUrl(); IModel model = new Model((Serializable) cnavUrl); setModel(model); I then use PropertyModel add(new TextField(url, new PropertyModel(cnavUrl, url))); For the two actions, I'm creating the Button objects like this add(new Button(publish, model) { @Override public void onSubmit() { CnavUrl cnavUrl = (CnavUrl) getModelObject(); System.out.println(publish); } }); Some problems I can't figure out. The code to create the button complains that it requires a CnavUrl but gets back
FeedbackPanel customization
Hi, I'm working on a modification of the FeedbackPanel to work better with my theme. I would like to prevent the class for the actual message from being appended to. Right now MessageListView is a private final class and the populateItem adds an AttributeModifier to both the label and the listItem. I know I can override getCSSClass, but that still sets it for both the label and listItem. I can't extend just MessageListView since it's private and final. Even if I could subclass that, the FeedbackPanel constructor is called before my subclass of FeedbackPanel, so that it has already used the original MessageListView. Can you think of a clean way to eliminate the AttributeListener on listItem? Daniel
Re: FeedbackPanel customization
Hi Sebastian, I looked at your example, but it's not quite what I need. I want the style applied to 'messages' but not to 'message'. Your example seems to allow for a style to be applied to 'message' and not to 'messages' I've tried implementing it, but that's where I'm stuck. Am I missing something? Daniel On Wed, Jul 17, 2013 at 3:20 PM, Sebastien seb...@gmail.com wrote: Hi Daniel, In such a case, you have to not use getCSSClass, but override newMessageDisplayComponent instead. You have a sample here: https://github.com/sebfz1/wicket-jquery-ui/blob/master/wicket-jquery-ui/src/main/java/com/googlecode/wicket/jquery/ui/panel/JQueryFeedbackPanel.java https://github.com/sebfz1/wicket-jquery-ui/blob/master/wicket-jquery-ui/src/main/java/com/googlecode/wicket/jquery/ui/panel/JQueryFeedbackPanel.html Hope this help, Sebastien. On Wed, Jul 17, 2013 at 10:54 PM, Daniel Watrous dwmaill...@gmail.com wrote: Hi, I'm working on a modification of the FeedbackPanel to work better with my theme. I would like to prevent the class for the actual message from being appended to. Right now MessageListView is a private final class and the populateItem adds an AttributeModifier to both the label and the listItem. I know I can override getCSSClass, but that still sets it for both the label and listItem. I can't extend just MessageListView since it's private and final. Even if I could subclass that, the FeedbackPanel constructor is called before my subclass of FeedbackPanel, so that it has already used the original MessageListView. Can you think of a clean way to eliminate the AttributeListener on listItem? Daniel
Re: FeedbackPanel customization
This is what I ended up doing. Hopefully, as Cedric points out, it will be more flexible in Wicket 7 and I can come back and clean it up. Thanks. On Wed, Jul 17, 2013 at 3:23 PM, Paul Bors p...@bors.ws wrote: Of course you can always override them in CSS as well. /* FEEDBACK MESSAGES */ .feedbackMessages { padding-left: 0; padding-top: 0; text-align: left; margin-left: 0; margin-top: 0; padding-bottom: 1em; } .feedbackMessages div { padding: 0.5em; font-size: xx-small; border: none; } .feedbackMessages div.feedbackPanelERROR { background-color: lightsalmon; border: 1px solid darkred; } .feedbackMessages div.feedbackPanelWARNING { background-color: #FFB90F; border: 1px solid darkgoldenrod; } .feedbackMessages div.feedbackPanelINFO { background-color: lightgreen; border: 1px solid darkgreen; } ~ Thank you, Paul Bors -Original Message- From: Sebastien [mailto:seb...@gmail.com] Sent: Wednesday, July 17, 2013 5:21 PM To: users@wicket.apache.org Subject: Re: FeedbackPanel customization Hi Daniel, In such a case, you have to not use getCSSClass, but override newMessageDisplayComponent instead. You have a sample here: https://github.com/sebfz1/wicket-jquery-ui/blob/master/wicket-jquery-ui/src/ main/java/com/googlecode/wicket/jquery/ui/panel/JQueryFeedbackPanel.java https://github.com/sebfz1/wicket-jquery-ui/blob/master/wicket-jquery-ui/src/ main/java/com/googlecode/wicket/jquery/ui/panel/JQueryFeedbackPanel.html Hope this help, Sebastien. On Wed, Jul 17, 2013 at 10:54 PM, Daniel Watrous dwmaill...@gmail.comwrote: Hi, I'm working on a modification of the FeedbackPanel to work better with my theme. I would like to prevent the class for the actual message from being appended to. Right now MessageListView is a private final class and the populateItem adds an AttributeModifier to both the label and the listItem. I know I can override getCSSClass, but that still sets it for both the label and listItem. I can't extend just MessageListView since it's private and final. Even if I could subclass that, the FeedbackPanel constructor is called before my subclass of FeedbackPanel, so that it has already used the original MessageListView. Can you think of a clean way to eliminate the AttributeListener on listItem? Daniel - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Form questions
Thanks Paul and Sven. I got the form to work and available in the onSubmit handler. Now I'm interested in splitting the form out into it's one file. So I created a class that has nothing more than the form, but I'm not sure how to include this into a page. In my class I do this: public class CnavModify extends ConsoleBasePage { public CnavModify(PageParameters parameters) { super(parameters); Form form = new CnavForm(cnavFormArea); add(form); } } My CnavModify obviously extends a base page. What do I put inside the wicket:extend tag to have the form render? Daniel On Tue, Jul 16, 2013 at 12:00 AM, Sven Meier s...@meiers.net wrote: Hi, Some problems I can't figure out. The code to create the button complains that it requires a CnavUrl but gets back a String. add(new Button(publish, model) { @Override public void onSubmit() { CnavUrl cnavUrl = (CnavUrl) getModelObject(); System.out.println(publish); } }); a Button always has a IModelString to fill the value attribute. Note that in #onSubmit() you're getting the model object of the button, not of your form. You can write: add(new Button(publish, model) { @Override public void onSubmit() { CnavUrl cnavUrl = (CnavUrl) MyForm.this.getModelObject(); System.out.println(publish); } }); Using generic types in your code should help you. Sven On 07/15/2013 11:41 PM, Daniel Watrous wrote: Hello, I'm interested in creating a single Form that will accommodate the following use cases 1) display blank for creating new records 2) pre-populate for editing existing records 3) map submitted values on to an existing domain object 4) accommodate two actions, Save Draft -or- Publish I'm following Wicket in Action and within my Form constructor I create my model, like this CnavUrl cnavUrl = new BasicCnavUrl(); IModel model = new Model((Serializable) cnavUrl); setModel(model); I then use PropertyModel add(new TextField(url, new PropertyModel(cnavUrl, url))); For the two actions, I'm creating the Button objects like this add(new Button(publish, model) { @Override public void onSubmit() { CnavUrl cnavUrl = (CnavUrl) getModelObject(); System.out.println(publish); } }); Some problems I can't figure out. The code to create the button complains that it requires a CnavUrl but gets back a String. It seems that a new BasicCnavUrl is created once with the Form. What happens on subsequent calls? Can I always expect my model to have the data from the current form submission? Is there a best way to incorporate the idea of an edit, where the model is pre-populated from a data source and pre-fills the Form fields? Thanks, Daniel --**--**- To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.orgusers-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Form questions
Hello, I'm interested in creating a single Form that will accommodate the following use cases 1) display blank for creating new records 2) pre-populate for editing existing records 3) map submitted values on to an existing domain object 4) accommodate two actions, Save Draft -or- Publish I'm following Wicket in Action and within my Form constructor I create my model, like this CnavUrl cnavUrl = new BasicCnavUrl(); IModel model = new Model((Serializable) cnavUrl); setModel(model); I then use PropertyModel add(new TextField(url, new PropertyModel(cnavUrl, url))); For the two actions, I'm creating the Button objects like this add(new Button(publish, model) { @Override public void onSubmit() { CnavUrl cnavUrl = (CnavUrl) getModelObject(); System.out.println(publish); } }); Some problems I can't figure out. The code to create the button complains that it requires a CnavUrl but gets back a String. It seems that a new BasicCnavUrl is created once with the Form. What happens on subsequent calls? Can I always expect my model to have the data from the current form submission? Is there a best way to incorporate the idea of an edit, where the model is pre-populated from a data source and pre-fills the Form fields? Thanks, Daniel
Re: DI Through Constructors w/Wicket
I worked out this process: http://software.danielwatrous.com/wicket-guice-including-unittests/ It enables unittests and may help you toward your goal. Daniel On Tue, Jun 25, 2013 at 7:14 PM, William Speirs wspe...@apache.org wrote: I think I know the answer before I ask, but is there any way to do constructor injection with Wicket? Say I have a web page and an email service. I need the email service in the web page. Now everyone is going to say, Simply use field injection. That will work, but makes unit testing a real pain because now I have to setup injection for my unit test (or add additional methods to all of my pages so I can manually set these field, or additional constructors that set these fields). I should be able to unit test a class without needing injection, but instead passing mocks through the constructor. I feel like this is impossible in Wicket currently because the DefaultPageFactory is using reflection to create the page instances instead of the injector (Guice in my case). It would be easy enough to get the injector and call getInstance() to obtain a page instance. The problem is when you need to pass in parameters. There is no concept of parameters for a page other than what is passed via the constructor, so you cannot call something like setPageParameters because it doesn't exist. If using Guice, you could create an @Assisted injection, and have a factory. Has anyone tried creating this type of IPageFactory -- a GuicePageFactory? What kind of pitfalls would exist if I attempted such a thing? Am I being stupid and missing something? Thoughts? Thanks... Bill- - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Customizing links in Paging
Thanks Paul, I worked it out and added my solution to a SO question about the same issue: http://stackoverflow.com/questions/4996208/how-do-i-modify-the-markup-generated-by-a-wicket-link-in-a-pagingnavigator It's the newest answer at the bottom. Daniel On Mon, Jun 24, 2013 at 3:26 PM, Paul Bors p...@bors.ws wrote: See PagingNavigationLink, PagingNavigationIncrementLink and their use by the NavigationToolbar as well as their counter parts. You would have to create your own NavigationToolbar, call super() methods and replace the PagingNavigationLink with your own. If you want to replace the headers then take a look at FallbackHeadersToolbar. That's how I customized them both. Here's some code for you to get you started :) public class MyAjaxPagingNavigationLink extends AjaxPagingNavigationLink { private static final long serialVersionUID = 1L; private boolean isForLastPageLink; private boolean hideLastPageLink; /** * Constructor. * * @param id *See Component * @param iPageable *The pageable component for this page link * @param pageNumber *The page number in the PageableListView that this link links to. Negative *pageNumbers are relative to the end of the list. * @see AjaxPagingNavigationLink */ public MyAjaxPagingNavigationLink(String id, IPageable iPageable, int pageNumber) { this(id, iPageable, pageNumber, false); } /** * Constructor. * * @param id *See Component * @param iPageable *The pageable component for this page link * @param pageNumber *The page number in the PageableListView that this link links to. Negative *pageNumbers are relative to the end of the list. * @param hideLastPageLink *Boolean flag set to true if the last page link is to be hidden * @see AjaxPagingNavigationLink */ public MyAjaxPagingNavigationLink(String id, IPageable iPageable, int pageNumber, boolean hideLastPageLink) { super(id, iPageable, pageNumber); this.hideLastPageLink = hideLastPageLink; isForLastPageLink = pageNumber == -1; } @Override public void onComponentTagBody(MarkupStream stream, ComponentTag openTag) { String src; if (isForLastPageLink hideLastPageLink) { src = ; } else { src = getImageSource(isForLastPageLink, pageable); } replaceComponentTagBody(stream, openTag, src); } public static String getImageSource(boolean forLastPageLink, IPageable iPageable) { String buttonLabel = new ResourceModel(button.label).getObject(); String src = null; if(forLastPageLink) { if((iPageable.getCurrentPage() == iPageable.getPageCount() - 1) || (iPageable.getPageCount() == 0)) { src = RequestCycle.get().getUrlRenderer().renderContextRelativeUrl(images/last_di sabled.gif); } else { src = RequestCycle.get().getUrlRenderer().renderContextRelativeUrl(images/ last.gi f); } } else { if(iPageable.getCurrentPage() == 0) { src = RequestCycle.get().getUrlRenderer().renderContextRelativeUrl(images/first_d isabled.gif); } else { src = RequestCycle.get().getUrlRenderer().renderContextRelativeUrl(images/first.g if); } } return img src=\ + src + \ border=\0\ alt=\ + buttonLabel + \; } } public class MyAjaxNavigationToolbar extends AjaxNavigationToolbar { private static final long serialVersionUID = 1L; protected boolean showNavigationLabel = true; public MyAjaxNavigationToolbar(DataTable?, ? table) { this(table, table.getColumns().size()); } public MyAjaxNavigationToolbar(DataTable?, ? table, int customColspan) { super(table); WebMarkupContainer span = (WebMarkupContainer)this.get(span); span.add(new AttributeModifier(colspan, new ModelString(String.valueOf(customColspan; } @Override protected PagingNavigator newPagingNavigator(String navigatorId, final DataTable?, ? table) { return new AjaxPagingNavigator(navigatorId, table) { private static final long serialVersionUID = 1L; @Override protected Link? newPagingNavigationIncrementLink(String id, IPageable pageable, int increment) { return new MyAjaxPagingNavigationIncrementLink(id, pageable, increment); } @Override protected Link? newPagingNavigationLink(String id, IPageable pageable, int pageNumber) { return new MyAjaxPagingNavigationLink(id, pageable, pageNumber) { private static final long
Re: Point Form action to Page
I had a hard time figuring out how to follow your second suggestion and making it work for my use case. Instead I ended up calling parameters.clearNamed(); After I got the search term. That kept it out of my URL. I also added a clear search link that unset the search filter parameter in my DataProvider. Thanks for your help. Daniel On Sat, Jun 22, 2013 at 10:45 AM, Paul Bors p...@bors.ws wrote: Try the second approach. There would be no query parameters to worry about. You can construct your page by taking as a constructor parameter a POJO that's the model object for the filter form. You can also have a default constructor that would construct the page with no filters. ~ Thank you, Paul C Bors On Jun 21, 2013, at 18:11, Daniel Watrous dwmaill...@gmail.com wrote: That first approach worked, but it brings me back to another issue: I end up with a query string parameter searchFilter=quick This is the same problem I was running in to here: http://apache-wicket.1842946.n4.nabble.com/form-GET-and-POST-getting-mixed-up-td4659427.html When I try to load the page again, it keeps replacing that query string and so I can't get back to a broad result. Is there some way to clear the search (by clearing the query string parameter)? Daniel On Fri, Jun 21, 2013 at 3:51 PM, Paul Bors p...@bors.ws wrote: class SearchPanel ... { ... add(id, new SomeButtonSubmitLinkOrForm { @Override public void onSubmit() { // your biz logic PageParameter pageParameter = new PageParameters(); pageParameters.add(searchFilter, mySearchFilter); setResponsePage(SearchResultsPage.class, pageParameter); } }); ... } http://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/request/m apper/parameter/PageParameters.html#PageParameters%28%29 On a second though it might be even simpler not to use PageParameters (since you might have too many filter form fields) but to add another constructor to your SearchResultsPage that takes an instance to your SearchFilter POJO and filters itself accordingly. I normally reuse my DAO mapped POJOs. class SearchPanel ... { ... add(id, new SomeButtonSubmitLinkOrForm { @Override public void onSubmit() { // your biz logic creates an instance of mySearchFilter that encapsulates your search parameters setResponsePage(new SearchResultsPage(mySearchFilter)); // create this constructor and filter the page by it } }); ... } ~ Thank you, Paul Bors -Original Message- From: Daniel Watrous [mailto:dwmaill...@gmail.com] Sent: Friday, June 21, 2013 5:40 PM To: users@wicket.apache.org Subject: Re: Point Form action to Page Within my SearchPanel onSubmit, how do I get the PageParameters to make that call to setResponsePage? I hope I'm understanding you right. On Fri, Jun 21, 2013 at 3:30 PM, Paul Bors p...@bors.ws wrote: There is a good reason why Wicket is not letting you override a form's action attribute. Is at the core of its processing. If I understand you right you have a panel that processes a search form and you would like to respond with SearchResultsPage. Wicket's way of doing that would be to use PageParameters. Add a constructor to your SearchResultsPage that takes in an instance of PageParameters and then pass your search parameters through it via setResponsePage(new SearchResultsPage(mySearchPageParameters). If I didn't understand you right, then try to better explain your use-case :) You might also be interested in the o.a.wicket.extensions.markup.html.repeater.data.table.filter package :) ~ Thank you, Paul Bors -Original Message- From: Daniel Watrous [mailto:dwmaill...@gmail.com] Sent: Friday, June 21, 2013 5:13 PM To: users@wicket.apache.org Subject: Point Form action to Page Hi, I have created a Panel that contains a search form. I can't figure out how to get the action of the Form to submit to the search results page. Any ideas? In other words, I was hoping to do something like this: form.add(new SimpleAttributeModifier(action, SearchResultsPage.class)); Thanks, Daniel - 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
Customizing links in Paging
Hello, I'm using the Paging functionality with my DataProvider. I've been trying to make a simple change, but it's turned out to be very difficult. Hopefully you can give a little help. I have a class that extends PagingNavigator and provides markup specific to my theme. When the paging links render, the current page doesn't render with an a tag around it. It's stripped away. I've traced through and found that this is most likely due to AutoEnable being set to true in the Link that's created. That choice is hard coded in to the PagingNavigationLink class. I'm trying to avoid extending all of the Paging related classes down to the PagingNavigationLink in order to customize this behavior. Is there some way to have that active page render inside an a tag with no href? Thanks, Daniel
Point Form action to Page
Hi, I have created a Panel that contains a search form. I can't figure out how to get the action of the Form to submit to the search results page. Any ideas? In other words, I was hoping to do something like this: form.add(new SimpleAttributeModifier(action, SearchResultsPage.class)); Thanks, Daniel
Re: Point Form action to Page
Within my SearchPanel onSubmit, how do I get the PageParameters to make that call to setResponsePage? I hope I'm understanding you right. On Fri, Jun 21, 2013 at 3:30 PM, Paul Bors p...@bors.ws wrote: There is a good reason why Wicket is not letting you override a form's action attribute. Is at the core of its processing. If I understand you right you have a panel that processes a search form and you would like to respond with SearchResultsPage. Wicket's way of doing that would be to use PageParameters. Add a constructor to your SearchResultsPage that takes in an instance of PageParameters and then pass your search parameters through it via setResponsePage(new SearchResultsPage(mySearchPageParameters). If I didn't understand you right, then try to better explain your use-case :) You might also be interested in the o.a.wicket.extensions.markup.html.repeater.data.table.filter package :) ~ Thank you, Paul Bors -Original Message- From: Daniel Watrous [mailto:dwmaill...@gmail.com] Sent: Friday, June 21, 2013 5:13 PM To: users@wicket.apache.org Subject: Point Form action to Page Hi, I have created a Panel that contains a search form. I can't figure out how to get the action of the Form to submit to the search results page. Any ideas? In other words, I was hoping to do something like this: form.add(new SimpleAttributeModifier(action, SearchResultsPage.class)); Thanks, Daniel - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Point Form action to Page
That first approach worked, but it brings me back to another issue: I end up with a query string parameter searchFilter=quick This is the same problem I was running in to here: http://apache-wicket.1842946.n4.nabble.com/form-GET-and-POST-getting-mixed-up-td4659427.html When I try to load the page again, it keeps replacing that query string and so I can't get back to a broad result. Is there some way to clear the search (by clearing the query string parameter)? Daniel On Fri, Jun 21, 2013 at 3:51 PM, Paul Bors p...@bors.ws wrote: class SearchPanel ... { ... add(id, new SomeButtonSubmitLinkOrForm { @Override public void onSubmit() { // your biz logic PageParameter pageParameter = new PageParameters(); pageParameters.add(searchFilter, mySearchFilter); setResponsePage(SearchResultsPage.class, pageParameter); } }); ... } http://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/request/m apper/parameter/PageParameters.html#PageParameters%28%29 On a second though it might be even simpler not to use PageParameters (since you might have too many filter form fields) but to add another constructor to your SearchResultsPage that takes an instance to your SearchFilter POJO and filters itself accordingly. I normally reuse my DAO mapped POJOs. class SearchPanel ... { ... add(id, new SomeButtonSubmitLinkOrForm { @Override public void onSubmit() { // your biz logic creates an instance of mySearchFilter that encapsulates your search parameters setResponsePage(new SearchResultsPage(mySearchFilter)); // create this constructor and filter the page by it } }); ... } ~ Thank you, Paul Bors -Original Message- From: Daniel Watrous [mailto:dwmaill...@gmail.com] Sent: Friday, June 21, 2013 5:40 PM To: users@wicket.apache.org Subject: Re: Point Form action to Page Within my SearchPanel onSubmit, how do I get the PageParameters to make that call to setResponsePage? I hope I'm understanding you right. On Fri, Jun 21, 2013 at 3:30 PM, Paul Bors p...@bors.ws wrote: There is a good reason why Wicket is not letting you override a form's action attribute. Is at the core of its processing. If I understand you right you have a panel that processes a search form and you would like to respond with SearchResultsPage. Wicket's way of doing that would be to use PageParameters. Add a constructor to your SearchResultsPage that takes in an instance of PageParameters and then pass your search parameters through it via setResponsePage(new SearchResultsPage(mySearchPageParameters). If I didn't understand you right, then try to better explain your use-case :) You might also be interested in the o.a.wicket.extensions.markup.html.repeater.data.table.filter package :) ~ Thank you, Paul Bors -Original Message- From: Daniel Watrous [mailto:dwmaill...@gmail.com] Sent: Friday, June 21, 2013 5:13 PM To: users@wicket.apache.org Subject: Point Form action to Page Hi, I have created a Panel that contains a search form. I can't figure out how to get the action of the Form to submit to the search results page. Any ideas? In other words, I was hoping to do something like this: form.add(new SimpleAttributeModifier(action, SearchResultsPage.class)); Thanks, Daniel - 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
form GET and POST getting mixed up
Hello, I created a single page that shows some data using DataView. I then added a form and allow a filter argument to be passed in. The problem I'm getting is that the first time a search is done, the search value is added to the URL for the page. Subsequent searches are ignored due to the query string. I have looked for some way to change it to GET, but couldn't find that. I also looked for some way to prevent the URL from being modified, but I'm not clear on why that is happening either. Any idea how to fix this? Here's my Page code public CnavDisplay(PageParameters parameters) { super(parameters); final TextFieldString search = new TextFieldString(search, Model.of()); Form? form = new FormVoid(searchForm) { @Override protected void onSubmit() { final String searchValue = search.getModelObject(); PageParameters pageParameters = new PageParameters(); pageParameters.add(search, searchValue); setResponsePage(CnavDisplay.class, pageParameters); } }; add(form); form.add(search); CnavUrlDataProvider dataProvider = new CnavUrlDataProvider(); if (!parameters.get(search).isEmpty()) { dataProvider.setSearch(parameters.get(search).toString()); } DataViewCnavUrl dataView = new DataViewCnavUrl(repeating, dataProvider) { private static final long serialVersionUID = 1L; @Override protected void populateItem(final ItemCnavUrl item) { CnavUrl cnavUrl = item.getModelObject(); //item.add(new Label(cnavid, String.valueOf(((MorphiaCnavUrl)cnavUrl).getId(; item.add(new Label(url, cnavUrl.getURL())); item.add(new Label(type, cnavUrl.getType())); item.add(AttributeModifier.replace(class, new AbstractReadOnlyModelString() { private static final long serialVersionUID = 1L; @Override public String getObject() { return (item.getIndex() % 2 == 1) ? even : odd; } })); } }; Here's my application where I mount the page mountPage(/cnavlink, CnavDisplay.class); Any ideas? Thanks, Daniel
Re: form GET and POST getting mixed up
I found a solution that worked. I didn't realize that by adding the value passed in to a PageParameters object and then setting the response page I was telling Wicket to add that to the URL. I got rid of that. I changed my form to this use the CompoundPropertyModel: Form? form = new FormCnavDisplay(searchForm, new CompoundPropertyModelCnavDisplay(this)); I also added a class attribute for search and moved my onsubmit into a Button declaration. final CnavUrlDataProvider dataProvider = new CnavUrlDataProvider(); final TextFieldString searchField = new TextFieldString(search, new PropertyModel(this,search)); Form? form = new FormCnavDisplay(searchForm, new CompoundPropertyModelCnavDisplay(this)); Button submitButton = new Button(searchButton) { // (4) @Override public void onSubmit() { if (search != null !search.isEmpty()) { dataProvider.setSearch(search); } } }; add(form); form.add(searchField); form.add(submitButton); Thanks, Daniel On Wed, Jun 12, 2013 at 9:39 AM, Daniel Watrous dwmaill...@gmail.comwrote: Hello, I created a single page that shows some data using DataView. I then added a form and allow a filter argument to be passed in. The problem I'm getting is that the first time a search is done, the search value is added to the URL for the page. Subsequent searches are ignored due to the query string. I have looked for some way to change it to GET, but couldn't find that. I also looked for some way to prevent the URL from being modified, but I'm not clear on why that is happening either. Any idea how to fix this? Here's my Page code public CnavDisplay(PageParameters parameters) { super(parameters); final TextFieldString search = new TextFieldString(search, Model.of()); Form? form = new FormVoid(searchForm) { @Override protected void onSubmit() { final String searchValue = search.getModelObject(); PageParameters pageParameters = new PageParameters(); pageParameters.add(search, searchValue); setResponsePage(CnavDisplay.class, pageParameters); } }; add(form); form.add(search); CnavUrlDataProvider dataProvider = new CnavUrlDataProvider(); if (!parameters.get(search).isEmpty()) { dataProvider.setSearch(parameters.get(search).toString()); } DataViewCnavUrl dataView = new DataViewCnavUrl(repeating, dataProvider) { private static final long serialVersionUID = 1L; @Override protected void populateItem(final ItemCnavUrl item) { CnavUrl cnavUrl = item.getModelObject(); //item.add(new Label(cnavid, String.valueOf(((MorphiaCnavUrl)cnavUrl).getId(; item.add(new Label(url, cnavUrl.getURL())); item.add(new Label(type, cnavUrl.getType())); item.add(AttributeModifier.replace(class, new AbstractReadOnlyModelString() { private static final long serialVersionUID = 1L; @Override public String getObject() { return (item.getIndex() % 2 == 1) ? even : odd; } })); } }; Here's my application where I mount the page mountPage(/cnavlink, CnavDisplay.class); Any ideas? Thanks, Daniel
Paging and excessive database access (repeaters)
Hi, I'm following the example in the repeaters section for paging through large amounts of data: http://www.wicket-library.com/wicket-examples-6.0.x/repeater/wicket/bookmarkable/org.apache.wicket.examples.repeater.PagingPage Based on the example and how I've had to implement this there is a lot of data access. First is in the ContactDataProvider. The function iterator queries for the set of data that will be displayed. Next, all the objects that are returned need to be wrapped in a DetachableContactModel. The load mechanism here then loads each individual object from the datastore. In the example, the data is in memory. In a real world scenario the data is likely to be remote and this setup could have a significant performance impact. Is there some way to cut out some of the data access? For example, can I get rid of DetachableContactModel and just use the data retrieved through the ContactDataProvider? Thanks, Daniel
Do all POJOs have to implement Serializable?
Hi, I have an existing application tier that I package as a jar and place in a maven repository. I've been working to expose some of this application through Wicket. It's easy to include it in the pom, but I keep getting: ERROR - JavaSerializer - Error serializing object MyObject ... The object type is not Serializable! Do all of my classes have to implement serializable in order to use them in Wicket? Daniel
Re: Paging and excessive database access (repeaters)
So what I'm hearing is that I have to use the Detachable model, but that I can build in some caching to prevent unnecessary datastore access. Thanks. On Tue, Jun 11, 2013 at 1:11 PM, Marios Skounakis msc...@gmail.com wrote: This example is not quite optimized. The DetachableContactModel's constructor is public DetachableContactModel(Contact c) { this(c.getId()); } but it should be: public DetachableContactModel(Contact c) { this(c.getId()); setObject(c); } The way it's done in the example although the model is given the contact, it stores only its id and needs to load it from the database in order to access it, even while rendering the table. The way I suggest the model is given the contact and does not need to load it. So, the way it's done in the example database access is as follows: - a list query to get the contacts for a given page - n queries by id, one for each row The way I'm suggesting database access is as follows: - a list query to get the contacts for a give page - no other queties If the row contains say a link column that accesses the row model in the ajax click, then you will see an additional database access by id when the DetachableContactModel is attached. Cheers Marios On Tue, Jun 11, 2013 at 6:56 PM, Daniel Watrous dwmaill...@gmail.com wrote: Hi, I'm following the example in the repeaters section for paging through large amounts of data: http://www.wicket-library.com/wicket-examples-6.0.x/repeater/wicket/bookmarkable/org.apache.wicket.examples.repeater.PagingPage Based on the example and how I've had to implement this there is a lot of data access. First is in the ContactDataProvider. The function iterator queries for the set of data that will be displayed. Next, all the objects that are returned need to be wrapped in a DetachableContactModel. The load mechanism here then loads each individual object from the datastore. In the example, the data is in memory. In a real world scenario the data is likely to be remote and this setup could have a significant performance impact. Is there some way to cut out some of the data access? For example, can I get rid of DetachableContactModel and just use the data retrieved through the ContactDataProvider? Thanks, Daniel
wicket-guice HttpServletRequest
I'm having some trouble getting my unittests to work when I use Guice to get an instance of the HttpServletRequest object. The page works fine when running in jetty, but in the unittests I get these errors. org.apache.wicket.WicketRuntimeException: Can't instantiate page using constructor 'public com.hp.honeybadger.console.HomePage(org.apache.wicket.request.mapper.parameter.PageParameters)' and argument ''. Might be it doesn't exist, may be it is not visible (public). 1) Error in custom provider, com.google.inject.OutOfScopeException: Cannot access scoped object. Either we are not currently inside an HTTP Servlet request, or you may have forgotten to apply com.google.inject.servlet.GuiceFilter as a servlet filter for this request. at com.google.inject.servlet.InternalServletModule.provideHttpServletRequest(InternalServletModule.java:95) while locating javax.servlet.http.HttpServletRequest Caused by: com.google.inject.OutOfScopeException: Cannot access scoped object. Either we are not currently inside an HTTP Servlet request, or you may have forgotten to apply com.google.inject.servlet.GuiceFilter as a servlet filter for this request. This is my page public class HomePage extends WebPage { private static final long serialVersionUID = 1L; @Inject private HttpServletRequest request; public HomePage(final PageParameters parameters) { super(parameters); add(new Label(version, getApplication().getFrameworkSettings().getVersion())); // TODO Add your page's components here add(new Label(method, request.getMethod())); } } QUESTION How can I get around this issue or make use of a mock object to enable unittests?
Ajax indicator - display delay
Hi all, When there is some AJAX activity on page we can show ajax indicator (using AjaxIndicatorAppender and implementing IAjaxIndicatorAware). My problem is that I want to show such indicator only when ajax request takes longer than specified amount of time (eg. 1 second). But inside a AbstractDefaultAjaxBehavior (1.4.x) such indicator is shown immediately when request is processed. Is there any solution to delay displaying indicator (something like AjaxCallThrottlingDecorator but not for ajax beahvior but for ajax indicator itself)? -- Best regards, Daniel - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: [Announce] Introducing Wicked Charts
Hi! As nice as it looks but unfortunately, I feel like it should be pointed out that only your wrapper is Apache 2 licensed. Highcharts itself is only free to use for non-profit/non-commercial applications and requires purchase of a license otherwise, see: http://shop.highsoft.com/highcharts.html As long as a project meets the requirements for a free license or one can afford buying a commercial license, that's fine. Unfortunately, it opens a trap for developers that are less cautious and rely on licenses of libraries without checking full dependencies before adding them to their projects. Highcharts may be well-known but I haven't heard of it before. There will be others who see your library but don't know they may require a license for Highcharts, so they may fall for the license. It always disappoints me a bit if I see something published under a really (even commercially) free license but then realize that its dependencies are unfree. Don't get me wrong, your project looks really nice and useful but the license issue should be handled more carefully. A short but prominent notice on your project homepage would be enough. Sorry for spoiling the party. :) Regards, Daniel - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
WicketURLEncoder: escaping / in parameter value
Hi, I'm using WicketURLEncoder (1.4.18) to encode some parameter values. Exactly WicketURLEncoder.QUERY_INSTANCE, but the problem if parameter value contains / (slash) character, eg.: 1 Mbit/s, which is not escaped. This cause an error in url coding startegy which is based on key/value pairs (/key1/value1/key2/value2) because value contains / and brokes the whole url. Here it is an output from different version of WicketURLEncoder for this value: WicketURLEncoder.PATH_INSTANCE = 1%20Mbit%2Fs WicketURLEncoder.FULL_PATH_INSTANCE = 1%20Mbit/s WicketURLEncoder.QUERY_INSTANCE = 1+Mbit/s So should I use PATH_INSTANCE to encode these parameter values instead of QUERY_INSTANCE? I do not use Wicket 6, but maybe the same problem is in that version? -- Best regards, Daniel - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: WicketURLEncoder: escaping / in parameter value
Thanks for the very fast answer. I wanted to change it on PATH_INSTANCE but I wanted to make sure, so I have asked ;) -- DS On Mon, Nov 26, 2012 at 2:32 PM, Martin Grigorov mgrigo...@apache.org wrote: Hi, Since you use parameters in the path you have to use PATH_INSTANCE. On Mon, Nov 26, 2012 at 2:28 PM, Daniel Stoch daniel.st...@gmail.comwrote: Hi, I'm using WicketURLEncoder (1.4.18) to encode some parameter values. Exactly WicketURLEncoder.QUERY_INSTANCE, but the problem if parameter value contains / (slash) character, eg.: 1 Mbit/s, which is not escaped. This cause an error in url coding startegy which is based on key/value pairs (/key1/value1/key2/value2) because value contains / and brokes the whole url. Here it is an output from different version of WicketURLEncoder for this value: WicketURLEncoder.PATH_INSTANCE = 1%20Mbit%2Fs WicketURLEncoder.FULL_PATH_INSTANCE = 1%20Mbit/s WicketURLEncoder.QUERY_INSTANCE = 1+Mbit/s So should I use PATH_INSTANCE to encode these parameter values instead of QUERY_INSTANCE? I do not use Wicket 6, but maybe the same problem is in that version? -- Best regards, Daniel - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- 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
wicket 1.4.7 - encoding strategy - ajax button
Hi, I'm using wicket 1.4.7 and I'm facing some problem trying to solve some problem about URLs: 1) I'm using the classes: mount(new HybridUrlCodingStrategy(WebPageNaming.ADMIN_PAGE, AdminPage.class, false)); mount(new MixedParamHybridUrlCodingStrategy(WebPageNaming.EN + SLASH + WebPageNaming.CORPORATIVE_SECTION_EN, SectionPageEN.class, false, new String[]{ParameterNaming.URL_SECTION})); ir order to mount the URLs, but it looks like: http://localhost:8080/balune/en/corporativesection/home.16.1 when I hit an AJAX button like this: private class LoginForm extends FormLoginUserView { private static final long serialVersionUID = 1673801238179569937L; public LoginForm(String id) { super(id); } @Override public void onSubmit() { if (BaluneSession.get().signIn(loginUserView.getEmail(), loginUserView.getPassword())) { if (!continueToOriginalDestination()) { BaluneApplication.get().getPrepareUtils().prepareReloadByPageAndParams(getRequestCycle(), pageParameters); } } else { this.error(getString(loginError)); } } } previously I was using mountBookmarkablePage and MixedParamUrlCodingStrategy but URLs looked uglier. Is there any solution in this wicket version (I wouldn't like to change the version because it's and old app and it would be so much work to resolve the incompatibilites) to make the URLs look prettier? I'd like them to not change when I hit an AJAX button... 2) in production, the parameter jsessionid is appended to the URL. is there any way to avoid that in wicket? or is because Tomcat? Thanks in advance. Daniel Fernandez
Re: Wicket + Guice + unittests
Martin, In this case it would be just as easy to inject a specific bean. I did it this way because it matched some other examples that I saw. Daniel On Oct 16, 2012 1:08 AM, Martin Grigorov mgrigo...@apache.org wrote: Hi Daniel, public class HomePage extends WebPage { private static final long serialVersionUID = 1L; @Inject private Injector injector; public HomePage(final PageParameters parameters) { super(parameters); add(new Label(version, getApplication().getFrameworkSettings().getVersion())); // TODO Add your page's components here QuickLink quickLink = injector.getInstance(QuickLink.class); add(new Label(quickLink , quickLink.buildQuickLink())); } } Why do you inject the Injector and then ask it for beans instead of injecting the bean directly and use it ? On Mon, Oct 15, 2012 at 6:51 PM, Daniel Watrous daniel.watr...@gmail.com wrote: Dan, Thanks for all your help. I finally worked through all the details and have it working. Here's my write up: http://software.danielwatrous.com/wicket-guice-including-unittests/ The last bit I needed clarification on was how to pass parameters to the WicketFilter. I think the integration between Wicket and Guice is clean and flexible. Thanks again, Daniel On Fri, Oct 12, 2012 at 12:35 PM, Daniel Watrous daniel.watr...@gmail.com wrote: yes, that's what I have in my web.xml On Fri, Oct 12, 2012 at 12:10 PM, Dan Retzlaff dretzl...@gmail.com wrote: Yes, CustomFilter = CustomWicketFilter... Those aren't our actual names. And yes, we provide filter parameters too. I just omitted them since they weren't relevant to the Guice-based application instantiation I was describing. Do you have this in your web.xml? filter filter-nameguiceFilter/filter-name filter-classcom.google.inject.servlet.GuiceFilter/filter-class /filter filter-mapping filter-nameguiceFilter/filter-name url-pattern/*/url-pattern /filter-mapping On Fri, Oct 12, 2012 at 6:01 PM, Daniel Watrous daniel.watr...@gmail.comwrote: Dan, Thanks. I've got unittests running now, but the WicketFilter doesn't seem to be processing. All I get when I run the applicaiton shows a jetty produced directory listing. In the snippet you provided before I think that CustomFilter and CustomeWicketFilter should be the same thing. Is that right? In my previous approach, when I bound the WicketFilter I included some parameters, like this: filter(/*).through(WicketFilter.class, createWicketFilterInitParams()); With this function private MapString, String createWicketFilterInitParams() { MapString, String wicketFilterParams = new HashMapString, String(); wicketFilterParams.put(WicketFilter.FILTER_MAPPING_PARAM, /*); wicketFilterParams.put(applicationClassName, com.hp.honeybadger.web.WicketApplication); return wicketFilterParams; } I'm now trying to figure out how to make sure that the wicket filter is called... Daniel On Fri, Oct 12, 2012 at 11:03 AM, Dan Retzlaff dretzl...@gmail.com wrote: I follow you. WicketTester doesn't know about GuiceFilter, so you'll need a different way of getting your Injector into your Wicket Application. Rather than getting the Injector from your servlet context attributes, I'm suggesting that you let Guice instantiate your Application so you can @Inject the injector like any other dependency. The binding code I posted previously does the (non-test) setup; for the test itself it's as simple as https://gist.github.com/3880246. Hope that helps. By the way, I enjoyed your Wicket+EC2 article. Thanks for that. :) On Fri, Oct 12, 2012 at 4:08 PM, Daniel Watrous daniel.watr...@gmail.comwrote: Dan, I'm not talking about my application. I'm talking about unittests. I've followed the Guice recommended way to integrate with servlets using the GuiceFilter. Now I'm trying to make the Wicket unittests work and I need the injector to be available in WicketTester. Daniel On Thu, Oct 11, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com wrote: For what it's worth, we instantiate our applications through Guice. Having your application go get its Injector kind of violates the DI concept. filter(/*).through(WicketFilter.class); bind(WebApplication.class).to(CustomWebApplication.class); bind(WicketFilter.class).to(CustomWicketFilter.class); @Singleton private static class CustomFilter extends WicketFilter { @Inject private ProviderWebApplication webApplicationProvider; @Override protected IWebApplicationFactory getApplicationFactory() { return new IWebApplicationFactory() { @Override public WebApplication createApplication(WicketFilter filter) { return webApplicationProvider.get(); } @Override
Re: Wicket + Guice + unittests
Dan, Thanks for all your help. I finally worked through all the details and have it working. Here's my write up: http://software.danielwatrous.com/wicket-guice-including-unittests/ The last bit I needed clarification on was how to pass parameters to the WicketFilter. I think the integration between Wicket and Guice is clean and flexible. Thanks again, Daniel On Fri, Oct 12, 2012 at 12:35 PM, Daniel Watrous daniel.watr...@gmail.com wrote: yes, that's what I have in my web.xml On Fri, Oct 12, 2012 at 12:10 PM, Dan Retzlaff dretzl...@gmail.com wrote: Yes, CustomFilter = CustomWicketFilter... Those aren't our actual names. And yes, we provide filter parameters too. I just omitted them since they weren't relevant to the Guice-based application instantiation I was describing. Do you have this in your web.xml? filter filter-nameguiceFilter/filter-name filter-classcom.google.inject.servlet.GuiceFilter/filter-class /filter filter-mapping filter-nameguiceFilter/filter-name url-pattern/*/url-pattern /filter-mapping On Fri, Oct 12, 2012 at 6:01 PM, Daniel Watrous daniel.watr...@gmail.comwrote: Dan, Thanks. I've got unittests running now, but the WicketFilter doesn't seem to be processing. All I get when I run the applicaiton shows a jetty produced directory listing. In the snippet you provided before I think that CustomFilter and CustomeWicketFilter should be the same thing. Is that right? In my previous approach, when I bound the WicketFilter I included some parameters, like this: filter(/*).through(WicketFilter.class, createWicketFilterInitParams()); With this function private MapString, String createWicketFilterInitParams() { MapString, String wicketFilterParams = new HashMapString, String(); wicketFilterParams.put(WicketFilter.FILTER_MAPPING_PARAM, /*); wicketFilterParams.put(applicationClassName, com.hp.honeybadger.web.WicketApplication); return wicketFilterParams; } I'm now trying to figure out how to make sure that the wicket filter is called... Daniel On Fri, Oct 12, 2012 at 11:03 AM, Dan Retzlaff dretzl...@gmail.com wrote: I follow you. WicketTester doesn't know about GuiceFilter, so you'll need a different way of getting your Injector into your Wicket Application. Rather than getting the Injector from your servlet context attributes, I'm suggesting that you let Guice instantiate your Application so you can @Inject the injector like any other dependency. The binding code I posted previously does the (non-test) setup; for the test itself it's as simple as https://gist.github.com/3880246. Hope that helps. By the way, I enjoyed your Wicket+EC2 article. Thanks for that. :) On Fri, Oct 12, 2012 at 4:08 PM, Daniel Watrous daniel.watr...@gmail.comwrote: Dan, I'm not talking about my application. I'm talking about unittests. I've followed the Guice recommended way to integrate with servlets using the GuiceFilter. Now I'm trying to make the Wicket unittests work and I need the injector to be available in WicketTester. Daniel On Thu, Oct 11, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com wrote: For what it's worth, we instantiate our applications through Guice. Having your application go get its Injector kind of violates the DI concept. filter(/*).through(WicketFilter.class); bind(WebApplication.class).to(CustomWebApplication.class); bind(WicketFilter.class).to(CustomWicketFilter.class); @Singleton private static class CustomFilter extends WicketFilter { @Inject private ProviderWebApplication webApplicationProvider; @Override protected IWebApplicationFactory getApplicationFactory() { return new IWebApplicationFactory() { @Override public WebApplication createApplication(WicketFilter filter) { return webApplicationProvider.get(); } @Override public void destroy(WicketFilter filter) { } }; } } On Thu, Oct 11, 2012 at 11:49 PM, Daniel Watrous daniel.watr...@gmail.comwrote: Dan, I think you're right. Since in the WicketApplication init() function I attempt to get the bootStrapInjector like this: Injector bootStrapInjector = (Injector) this.getServletContext().getAttribute(Injector.class.getName()); I just can't figure out how to get the injector into the ServletContext before init() is run in my WicketApplication. Daniel On Wed, Oct 10, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com wrote: Daniel, What you're doing should work, but I think you're giving your GuiceComponentInjector a null Injector. Unit tests don't go through web.xml to set up its context listeners, so your GuiceServletContextListener never has a chance to construct and register an Injector with the ServletContext. Dan On Wed, Oct 10, 2012 at 5:30 PM, Daniel Watrous daniel.watr...@gmail.comwrote: Hi
Re: Wicket + Guice + unittests
Dan, I'm not talking about my application. I'm talking about unittests. I've followed the Guice recommended way to integrate with servlets using the GuiceFilter. Now I'm trying to make the Wicket unittests work and I need the injector to be available in WicketTester. Daniel On Thu, Oct 11, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com wrote: For what it's worth, we instantiate our applications through Guice. Having your application go get its Injector kind of violates the DI concept. filter(/*).through(WicketFilter.class); bind(WebApplication.class).to(CustomWebApplication.class); bind(WicketFilter.class).to(CustomWicketFilter.class); @Singleton private static class CustomFilter extends WicketFilter { @Inject private ProviderWebApplication webApplicationProvider; @Override protected IWebApplicationFactory getApplicationFactory() { return new IWebApplicationFactory() { @Override public WebApplication createApplication(WicketFilter filter) { return webApplicationProvider.get(); } @Override public void destroy(WicketFilter filter) { } }; } } On Thu, Oct 11, 2012 at 11:49 PM, Daniel Watrous daniel.watr...@gmail.comwrote: Dan, I think you're right. Since in the WicketApplication init() function I attempt to get the bootStrapInjector like this: Injector bootStrapInjector = (Injector) this.getServletContext().getAttribute(Injector.class.getName()); I just can't figure out how to get the injector into the ServletContext before init() is run in my WicketApplication. Daniel On Wed, Oct 10, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com wrote: Daniel, What you're doing should work, but I think you're giving your GuiceComponentInjector a null Injector. Unit tests don't go through web.xml to set up its context listeners, so your GuiceServletContextListener never has a chance to construct and register an Injector with the ServletContext. Dan On Wed, Oct 10, 2012 at 5:30 PM, Daniel Watrous daniel.watr...@gmail.comwrote: Hi, I've integrated Guice into Wicket successfully, but I'm struggling with the unittests. I'm not sure how to get the injector into my HomePage class. Here's my setup. I'm using GuiceFilter with a GuiceServletContextListener. That creates the injector and a ServletModule which defines the WicketApplication. I followed: http://code.google.com/p/google-guice/wiki/ServletModule Here's some of MyGuiceServletConfig extends GuiceServletContextListener @Override protected Injector getInjector() { return Guice.createInjector(createServletModule(), new MongoHoneybadgerModule()); } private ServletModule createServletModule() { return new ServletModule() { ... In my WicketApplication extends WebApplication I have this init() method @Override public void init() { super.init(); Injector bootStrapInjector = (Injector) this.getServletContext().getAttribute(Injector.class.getName()); getComponentInstantiationListeners().add(new GuiceComponentInjector(this, bootStrapInjector)); } Now, in my HomePage.java class I have public class HomePage extends WebPage { private static final long serialVersionUID = 1L; @Inject private Injector injector; public HomePage(final PageParameters parameters) { super(parameters); SomeType myobj = injector.getInstance(SomeType.class); add(new Label(version, myobj.getValue())); } } This all runs great inside a web container as a servlet. The PROBLEM: I'm getting a NullPointerException on the line where I reference the injector: SomeType myobj = injector.getInstance(SomeType.class); My test class is what was generated by the wicket quickstart. I'm not sure how to make an injector available in setUp. @Before public void setUp() { tester = new WicketTester(new WicketApplication()); } Any ideas? Thanks, Daniel - 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: Wicket + Guice + unittests
Dan, Thanks. I've got unittests running now, but the WicketFilter doesn't seem to be processing. All I get when I run the applicaiton shows a jetty produced directory listing. In the snippet you provided before I think that CustomFilter and CustomeWicketFilter should be the same thing. Is that right? In my previous approach, when I bound the WicketFilter I included some parameters, like this: filter(/*).through(WicketFilter.class, createWicketFilterInitParams()); With this function private MapString, String createWicketFilterInitParams() { MapString, String wicketFilterParams = new HashMapString, String(); wicketFilterParams.put(WicketFilter.FILTER_MAPPING_PARAM, /*); wicketFilterParams.put(applicationClassName, com.hp.honeybadger.web.WicketApplication); return wicketFilterParams; } I'm now trying to figure out how to make sure that the wicket filter is called... Daniel On Fri, Oct 12, 2012 at 11:03 AM, Dan Retzlaff dretzl...@gmail.com wrote: I follow you. WicketTester doesn't know about GuiceFilter, so you'll need a different way of getting your Injector into your Wicket Application. Rather than getting the Injector from your servlet context attributes, I'm suggesting that you let Guice instantiate your Application so you can @Inject the injector like any other dependency. The binding code I posted previously does the (non-test) setup; for the test itself it's as simple as https://gist.github.com/3880246. Hope that helps. By the way, I enjoyed your Wicket+EC2 article. Thanks for that. :) On Fri, Oct 12, 2012 at 4:08 PM, Daniel Watrous daniel.watr...@gmail.comwrote: Dan, I'm not talking about my application. I'm talking about unittests. I've followed the Guice recommended way to integrate with servlets using the GuiceFilter. Now I'm trying to make the Wicket unittests work and I need the injector to be available in WicketTester. Daniel On Thu, Oct 11, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com wrote: For what it's worth, we instantiate our applications through Guice. Having your application go get its Injector kind of violates the DI concept. filter(/*).through(WicketFilter.class); bind(WebApplication.class).to(CustomWebApplication.class); bind(WicketFilter.class).to(CustomWicketFilter.class); @Singleton private static class CustomFilter extends WicketFilter { @Inject private ProviderWebApplication webApplicationProvider; @Override protected IWebApplicationFactory getApplicationFactory() { return new IWebApplicationFactory() { @Override public WebApplication createApplication(WicketFilter filter) { return webApplicationProvider.get(); } @Override public void destroy(WicketFilter filter) { } }; } } On Thu, Oct 11, 2012 at 11:49 PM, Daniel Watrous daniel.watr...@gmail.comwrote: Dan, I think you're right. Since in the WicketApplication init() function I attempt to get the bootStrapInjector like this: Injector bootStrapInjector = (Injector) this.getServletContext().getAttribute(Injector.class.getName()); I just can't figure out how to get the injector into the ServletContext before init() is run in my WicketApplication. Daniel On Wed, Oct 10, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com wrote: Daniel, What you're doing should work, but I think you're giving your GuiceComponentInjector a null Injector. Unit tests don't go through web.xml to set up its context listeners, so your GuiceServletContextListener never has a chance to construct and register an Injector with the ServletContext. Dan On Wed, Oct 10, 2012 at 5:30 PM, Daniel Watrous daniel.watr...@gmail.comwrote: Hi, I've integrated Guice into Wicket successfully, but I'm struggling with the unittests. I'm not sure how to get the injector into my HomePage class. Here's my setup. I'm using GuiceFilter with a GuiceServletContextListener. That creates the injector and a ServletModule which defines the WicketApplication. I followed: http://code.google.com/p/google-guice/wiki/ServletModule Here's some of MyGuiceServletConfig extends GuiceServletContextListener @Override protected Injector getInjector() { return Guice.createInjector(createServletModule(), new MongoHoneybadgerModule()); } private ServletModule createServletModule() { return new ServletModule() { ... In my WicketApplication extends WebApplication I have this init() method @Override public void init() { super.init(); Injector bootStrapInjector = (Injector) this.getServletContext().getAttribute(Injector.class.getName()); getComponentInstantiationListeners().add(new GuiceComponentInjector(this, bootStrapInjector)); } Now, in my HomePage.java class I have public class HomePage extends WebPage
Re: Wicket + Guice + unittests
yes, that's what I have in my web.xml On Fri, Oct 12, 2012 at 12:10 PM, Dan Retzlaff dretzl...@gmail.com wrote: Yes, CustomFilter = CustomWicketFilter... Those aren't our actual names. And yes, we provide filter parameters too. I just omitted them since they weren't relevant to the Guice-based application instantiation I was describing. Do you have this in your web.xml? filter filter-nameguiceFilter/filter-name filter-classcom.google.inject.servlet.GuiceFilter/filter-class /filter filter-mapping filter-nameguiceFilter/filter-name url-pattern/*/url-pattern /filter-mapping On Fri, Oct 12, 2012 at 6:01 PM, Daniel Watrous daniel.watr...@gmail.comwrote: Dan, Thanks. I've got unittests running now, but the WicketFilter doesn't seem to be processing. All I get when I run the applicaiton shows a jetty produced directory listing. In the snippet you provided before I think that CustomFilter and CustomeWicketFilter should be the same thing. Is that right? In my previous approach, when I bound the WicketFilter I included some parameters, like this: filter(/*).through(WicketFilter.class, createWicketFilterInitParams()); With this function private MapString, String createWicketFilterInitParams() { MapString, String wicketFilterParams = new HashMapString, String(); wicketFilterParams.put(WicketFilter.FILTER_MAPPING_PARAM, /*); wicketFilterParams.put(applicationClassName, com.hp.honeybadger.web.WicketApplication); return wicketFilterParams; } I'm now trying to figure out how to make sure that the wicket filter is called... Daniel On Fri, Oct 12, 2012 at 11:03 AM, Dan Retzlaff dretzl...@gmail.com wrote: I follow you. WicketTester doesn't know about GuiceFilter, so you'll need a different way of getting your Injector into your Wicket Application. Rather than getting the Injector from your servlet context attributes, I'm suggesting that you let Guice instantiate your Application so you can @Inject the injector like any other dependency. The binding code I posted previously does the (non-test) setup; for the test itself it's as simple as https://gist.github.com/3880246. Hope that helps. By the way, I enjoyed your Wicket+EC2 article. Thanks for that. :) On Fri, Oct 12, 2012 at 4:08 PM, Daniel Watrous daniel.watr...@gmail.comwrote: Dan, I'm not talking about my application. I'm talking about unittests. I've followed the Guice recommended way to integrate with servlets using the GuiceFilter. Now I'm trying to make the Wicket unittests work and I need the injector to be available in WicketTester. Daniel On Thu, Oct 11, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com wrote: For what it's worth, we instantiate our applications through Guice. Having your application go get its Injector kind of violates the DI concept. filter(/*).through(WicketFilter.class); bind(WebApplication.class).to(CustomWebApplication.class); bind(WicketFilter.class).to(CustomWicketFilter.class); @Singleton private static class CustomFilter extends WicketFilter { @Inject private ProviderWebApplication webApplicationProvider; @Override protected IWebApplicationFactory getApplicationFactory() { return new IWebApplicationFactory() { @Override public WebApplication createApplication(WicketFilter filter) { return webApplicationProvider.get(); } @Override public void destroy(WicketFilter filter) { } }; } } On Thu, Oct 11, 2012 at 11:49 PM, Daniel Watrous daniel.watr...@gmail.comwrote: Dan, I think you're right. Since in the WicketApplication init() function I attempt to get the bootStrapInjector like this: Injector bootStrapInjector = (Injector) this.getServletContext().getAttribute(Injector.class.getName()); I just can't figure out how to get the injector into the ServletContext before init() is run in my WicketApplication. Daniel On Wed, Oct 10, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com wrote: Daniel, What you're doing should work, but I think you're giving your GuiceComponentInjector a null Injector. Unit tests don't go through web.xml to set up its context listeners, so your GuiceServletContextListener never has a chance to construct and register an Injector with the ServletContext. Dan On Wed, Oct 10, 2012 at 5:30 PM, Daniel Watrous daniel.watr...@gmail.comwrote: Hi, I've integrated Guice into Wicket successfully, but I'm struggling with the unittests. I'm not sure how to get the injector into my HomePage class. Here's my setup. I'm using GuiceFilter with a GuiceServletContextListener. That creates the injector and a ServletModule which defines the WicketApplication. I followed: http://code.google.com/p/google-guice/wiki/ServletModule Here's some
Re: Wicket + Guice + unittests
Dan, I think you're right. Since in the WicketApplication init() function I attempt to get the bootStrapInjector like this: Injector bootStrapInjector = (Injector) this.getServletContext().getAttribute(Injector.class.getName()); I just can't figure out how to get the injector into the ServletContext before init() is run in my WicketApplication. Daniel On Wed, Oct 10, 2012 at 6:10 PM, Dan Retzlaff dretzl...@gmail.com wrote: Daniel, What you're doing should work, but I think you're giving your GuiceComponentInjector a null Injector. Unit tests don't go through web.xml to set up its context listeners, so your GuiceServletContextListener never has a chance to construct and register an Injector with the ServletContext. Dan On Wed, Oct 10, 2012 at 5:30 PM, Daniel Watrous daniel.watr...@gmail.comwrote: Hi, I've integrated Guice into Wicket successfully, but I'm struggling with the unittests. I'm not sure how to get the injector into my HomePage class. Here's my setup. I'm using GuiceFilter with a GuiceServletContextListener. That creates the injector and a ServletModule which defines the WicketApplication. I followed: http://code.google.com/p/google-guice/wiki/ServletModule Here's some of MyGuiceServletConfig extends GuiceServletContextListener @Override protected Injector getInjector() { return Guice.createInjector(createServletModule(), new MongoHoneybadgerModule()); } private ServletModule createServletModule() { return new ServletModule() { ... In my WicketApplication extends WebApplication I have this init() method @Override public void init() { super.init(); Injector bootStrapInjector = (Injector) this.getServletContext().getAttribute(Injector.class.getName()); getComponentInstantiationListeners().add(new GuiceComponentInjector(this, bootStrapInjector)); } Now, in my HomePage.java class I have public class HomePage extends WebPage { private static final long serialVersionUID = 1L; @Inject private Injector injector; public HomePage(final PageParameters parameters) { super(parameters); SomeType myobj = injector.getInstance(SomeType.class); add(new Label(version, myobj.getValue())); } } This all runs great inside a web container as a servlet. The PROBLEM: I'm getting a NullPointerException on the line where I reference the injector: SomeType myobj = injector.getInstance(SomeType.class); My test class is what was generated by the wicket quickstart. I'm not sure how to make an injector available in setUp. @Before public void setUp() { tester = new WicketTester(new WicketApplication()); } Any ideas? Thanks, Daniel - 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: Wicket + Guice + unittests
Thanks Ronan, Can you share the implementation of StubProjectorApplication? That doesn't appear to be part of Wicket or Guice. Daniel On Wed, Oct 10, 2012 at 12:29 PM, Ronan O'Connell ronanoconnell1...@gmail.com wrote: Hi Daniel, I'm using Guice in a couple of wicket projects though my understanding of it is a little limited! My set-up matches yours except that in my unit test setup I call injectMembers : @Before public void setUp() { final StubProjectorApplication stubApplication = new StubProjectorApplication(); _tester = new WicketTester(stubApplication); stubApplication.getWarpInjector().injectMembers(this); // getWarpInjector returns the injector built in the init method } I'm not sure this is right..it feels to me that it shouldn't be be necessary, but it works for me :) . Ronan On 10/10/2012 18:30, Daniel Watrous wrote: Hi, I've integrated Guice into Wicket successfully, but I'm struggling with the unittests. I'm not sure how to get the injector into my HomePage class. Here's my setup. I'm using GuiceFilter with a GuiceServletContextListener. That creates the injector and a ServletModule which defines the WicketApplication. I followed: http://code.google.com/p/google-guice/wiki/ServletModule Here's some of MyGuiceServletConfig extends GuiceServletContextListener @Override protected Injector getInjector() { return Guice.createInjector(createServletModule(), new MongoHoneybadgerModule()); } private ServletModule createServletModule() { return new ServletModule() { ... In my WicketApplication extends WebApplication I have this init() method @Override public void init() { super.init(); Injector bootStrapInjector = (Injector) this.getServletContext().getAttribute(Injector.class.getName()); getComponentInstantiationListeners().add(new GuiceComponentInjector(this, bootStrapInjector)); } Now, in my HomePage.java class I have public class HomePage extends WebPage { private static final long serialVersionUID = 1L; @Inject private Injector injector; public HomePage(final PageParameters parameters) { super(parameters); SomeType myobj = injector.getInstance(SomeType.class); add(new Label(version, myobj.getValue())); } } This all runs great inside a web container as a servlet. The PROBLEM: I'm getting a NullPointerException on the line where I reference the injector: SomeType myobj = injector.getInstance(SomeType.class); My test class is what was generated by the wicket quickstart. I'm not sure how to make an injector available in setUp. @Before public void setUp() { tester = new WicketTester(new WicketApplication()); } Any ideas? Thanks, Daniel - 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: set locale in cookie
You can use RequestCycleListener to change locale setting in case . In Application init(): getRequestCycleListeners().add(new RequestLocaleListener()); public class RequestLocaleListener extends AbstractRequestCycleListener { public static final String LOCALE_COOKIE = LC; public void onBeginRequest(RequestCycle cycle) { if (WebRequest.class.isAssignableFrom(cycle.getRequest().getClass())) { WebRequest webrequest = (WebRequest) cycle.getRequest(); Cookie localeCookie = webrequest.getCookie(LOCALE_COOKIE); if (localeCookie != null) { for (Locale l : Locale.getAvailableLocales()) { // expect language as cookie value if (localeCookie.getValue().equalsIgnoreCase(l.getLanguage())) { Session.get().setLocale(l); break; } } } } } } 2012/6/10 oliver.stef ova...@gmail.com Thanks again! It's now much clearer!! for some reason i have error on CookieUtils... so i implement it like this: (on my HomePage.java) form.add(new SubmitLink(English){ @Override public void onSubmit() { getSession().setLocale(new Locale(en_US)); Cookie languageCookie = new Cookie(WicketApplication.LANGUAGE_COOKIE_NAME, en_US); languageCookie.setMaxAge(WicketApplication.LANGUAGE_COOKIE_AGE); ((WebResponse)getResponse()).addCookie(languageCookie); } }); *one last thing:* so the Session.get().setLocale(locale) i should implement in WicketApplication? like this: @Override public Session newSession(Request request, Response response) { Session session = super.newSession(request, response); session = trySetLanguageFromCookie(session, request, response); return session; } private Session trySetLanguageFromCookie(Session session, Request request, Response response) { Cookie[] cookies = ((WebRequest) request).getCookies(); if (cookies == null || cookies.length == 0) { return session; } for (Cookie cookie : cookies) { if (LANGUAGE_COOKIE_NAME.equals(cookie.getName())) { session.setLocale(new Locale(cookie.getValue())); cookie.setMaxAge(LANGUAGE_COOKIE_AGE); ((WebResponse)response).addCookie(cookie); break; } } return session; } 10x! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/set-locale-in-cookie-tp4649827p4649831.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 -- Daniel Suckow
Re: Wicket and Menu support
Depending on how your menus are supposed to be defined, you could statically put them into your markup or dynamically create them by using a ListView or similar. A nested HTML list structure, as already suggested, usually works best. There are a lot of ready-to-use CSS examples and JavaScript libraries to handle such menus, if you don't want to write it yourself. On 04/08/2012 07:52 AM, msalman wrote: I thought that the idea behind Wicket is to take care of these things for Java programmers. I would appreciate if some basic form of menu is made part of wicket core. Wicket is one of the few frameworks that leave you in full control of your markup, which means that it does not provide a lot of ready-to-include components that include markup and a full style. Instead it works more like casting your markup to Java components, so your HTML code becomes accessible from Java. There are of course some ready-to-use components in wicket-stuff etc. but less in Wicket core. This way, you are not forced to follow an HTML structure or CSS classes someone else wrote that may clash with the design you had in mind (modal dialogs are one exception, apart from that and trees I can't think of many standard components that use a noticeable amount of their own HTML/CSS). If you want to avoid HTML/CSS as far as possible, other frameworks may fit better. For example, you can avoid HTML/CSS almost completely with Vaadin or GWT if you don't need any custom layout (if you do, it can be a lot of work to style it). And then there are a lot of frameworks that are easier to style but require you to write some HTML/CSS yourself. If you want to stay with Wicket, you should get more comfortable with HTML and CSS (which will take a lot of exercise to get it right) or leave writing templates up to a web designer, which (due to a good separation of templates and code) is far easier in Wicket than with other frameworks. In most cases, you can simply take a design, add Wicket XML tags/attributes to it and start using that template from your code. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
How to modify attribute (eg. class) in component with setRenderBodyOnly(true) ?
Hi, Is it possible to modify tag attribute (eg. add a CSS class) of component which has set renderBodyOnly flag to true? When using component.add(new AttributeModifier(...)) it has no effect, because a tag in which this class attribute is appended is not rendered in HTML (because of setRenderBodyOnly(true)). Here is an example: LinkContainer is a component (extends Panel) which has setRenderBodyOnly(true). wicket:panel a wicket:id=linkwicket:container wicket:id=linkContent[link content]/wicket:container/a /wicket:panel Somewhere inside a page or panel: add(new LinkContainer(link, ...).add(new AttributeModifier(class, Model.of(my-link-style; But of course this class='my-link-style' will not be rendered anywhere. I want to add a class attribute to contained a tag but using a behavior which can be added to the whole LinkContainer. Is it any simple solution to achieve this? -- DS - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to modify attribute (eg. class) in component with setRenderBodyOnly(true) ?
No. I want to have a. When you use this LinkContainer from my example in HTML like: div wicket:id=link /div It will be rendered as: a wicket:id=link.../a So any attributes modified using behavior will disappear. But if LinkContainer will not have setRenderBodyOnly(true), the the corresponding HTML will be: div wicket:id=link class='my-link-style' a wicket:id=link.../a /div -- DS On Wed, Feb 22, 2012 at 11:49 AM, Martin Grigorov mgrigo...@apache.org wrote: Hi, So you want to not have a (because this is what .setRenderBodyOnly(true) does) and in the same time you want to set a class an that non-existing tag ?! The easiest way is to remove the call to .setRenderBodyOnly(true). On Wed, Feb 22, 2012 at 11:38 AM, Daniel Stoch daniel.st...@gmail.com wrote: Hi, Is it possible to modify tag attribute (eg. add a CSS class) of component which has set renderBodyOnly flag to true? When using component.add(new AttributeModifier(...)) it has no effect, because a tag in which this class attribute is appended is not rendered in HTML (because of setRenderBodyOnly(true)). Here is an example: LinkContainer is a component (extends Panel) which has setRenderBodyOnly(true). wicket:panel a wicket:id=linkwicket:container wicket:id=linkContent[link content]/wicket:container/a /wicket:panel Somewhere inside a page or panel: add(new LinkContainer(link, ...).add(new AttributeModifier(class, Model.of(my-link-style; But of course this class='my-link-style' will not be rendered anywhere. I want to add a class attribute to contained a tag but using a behavior which can be added to the whole LinkContainer. Is it any simple solution to achieve this? -- DS - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.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: How to modify attribute (eg. class) in component with setRenderBodyOnly(true) ?
On Wed, Feb 22, 2012 at 12:11 PM, Martin Grigorov mgrigo...@apache.org wrote: On Wed, Feb 22, 2012 at 12:01 PM, Daniel Stoch daniel.st...@gmail.com wrote: No. I want to have a. When you use this LinkContainer from my example in HTML like: div wicket:id=link /div It will be rendered as: a wicket:id=link.../a So any attributes modified using behavior will disappear. But if LinkContainer will not have setRenderBodyOnly(true), the the corresponding HTML will be: div wicket:id=link class='my-link-style' a wicket:id=link.../a /div Now it is more clear what you do. You need to add the AttributeModifier to the Link, not to the LinkContainer if you want to manipulate a. Well, I know it is possible in this way. But my question is more general: does using behaviors which changes a markup (like AttributeModifier) on components with setRenderBodyOnly(true) make sense? To add the AttributeModifier to the Link I have to write extra method inside a LinkContainer which adds a behavior to enclosing component (Link is created inside LinkContainer and because of ecapsulation it should not be visible outside it). But the cleaner solution will be to add a behavior to LinkContainer, but then it should be transparently added to the one of its child components. Then I can use AttributeModifier (or related behaviors) the same way with component which has setRenderBodyOnly(true) or not. But now I need to know a component implementation to decide if I can use such modifiers with it or no. -- DS - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to modify attribute (eg. class) in component with setRenderBodyOnly(true) ?
On Wed, Feb 22, 2012 at 12:31 PM, Martin Grigorov mgrigo...@apache.org wrote: On Wed, Feb 22, 2012 at 12:20 PM, Daniel Stoch daniel.st...@gmail.com wrote: On Wed, Feb 22, 2012 at 12:11 PM, Martin Grigorov mgrigo...@apache.org wrote: On Wed, Feb 22, 2012 at 12:01 PM, Daniel Stoch daniel.st...@gmail.com wrote: No. I want to have a. When you use this LinkContainer from my example in HTML like: div wicket:id=link /div It will be rendered as: a wicket:id=link.../a So any attributes modified using behavior will disappear. But if LinkContainer will not have setRenderBodyOnly(true), the the corresponding HTML will be: div wicket:id=link class='my-link-style' a wicket:id=link.../a /div Now it is more clear what you do. You need to add the AttributeModifier to the Link, not to the LinkContainer if you want to manipulate a. Well, I know it is possible in this way. But my question is more general: does using behaviors which changes a markup (like AttributeModifier) on components with setRenderBodyOnly(true) make sense? No. To add the AttributeModifier to the Link I have to write extra method inside a LinkContainer which adds a behavior to enclosing component (Link is created inside LinkContainer and because of ecapsulation it should not be visible outside it). But the cleaner solution will be to add a behavior to LinkContainer, but then it should be transparently added to the one of its child components. To which child exactly ? How to decide that for you ? Then I can use AttributeModifier (or related behaviors) the same way with component which has setRenderBodyOnly(true) or not. But now I need to know a component implementation to decide if I can use such modifiers with it or no. Each behavior has a reference to the component it is bound to. So you can assign your own Behavior to the parent class and then in behavior's onComponentTag, renderHead(), ... you can do whatever you need with the parent and all its children. It is a bit harder to get the children ComponentTags but it is possible: new MarkupStream(getMarkup()) and iterate over the elements in the MarkupStream. Thanks for your feedback and suggestions. I have done a simple behavior to achieve what I want. Maybe this is not very elegant solution but it should work. It writes out attributes added as AttributeModifiers to a parent component to a child component which has this behavior. public class AttributeModifierPropagator extends AbstractBehavior { private final MarkupContainer parent; public AttributeModifierPropagator(MarkupContainer parent) { super(); if (parent == null) { throw new IllegalArgumentException(Argument [parent] cannot be null); } this.parent = parent; } @Override public void onComponentTag(Component component, ComponentTag tag) { for (IBehavior behavior : parent.getBehaviors()) { if ((behavior instanceof AttributeModifier) || (behavior instanceof SimpleAttributeModifier)) { behavior.onComponentTag(component, tag); } } } } And then inside a LinkContainer after creating nested Link link I can add this behavior to it: link.add(new AttributeModifierPropagator(this)); -- DS - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Reload html in Wicket + GAE
Thanks Martin, I did make that much progress yesterday after sending this, but I can't figure out how to get the Application inside the onBeginRequest method that I override. In the other examples they call getApplication() @Override protected void onBeginRequest() { if (getApplication().getConfigurationType().equals(Application.DEVELOPMENT)) { final GaeModificationWatcher resourceWatcher = (GaeModificationWatcher) getApplication() .getResourceSettings().getResourceWatcher(true); resourceWatcher.checkResources(); } } How can I get the Application object? Daniel On Mon, Feb 6, 2012 at 11:43 PM, Martin Grigorov mgrigo...@apache.org wrote: Hi, On Tue, Feb 7, 2012 at 1:32 AM, Daniel Watrous daniel.watr...@gmail.com wrote: Hi, I'm following up on a previous thread that's still unresolved. I would like GAE to automatically reload my HTML when I save changes. Classes are reloaded when I save (compile) them, but I have to restart each time for HTML changes. There are some old articles that show how to do this, but they deal with older versions of Wicket and GAE. For example: http://agilewombat.blogspot.com/2010/01/wicket-on-google-app-engine.html http://apache-wicket.1842946.n4.nabble.com/How-can-I-reload-HTML-in-app-engine-td3005241.html http://code.google.com/p/kickat26/source/browse/trunk/src/de/kickat26/ui/wicket/GAEModificationWatcher.java Those suggest creating a class MyWebRequestCycle extends WebRequestCycle, but wicket 1.5 doesn't have WebRequestCycle. How can I accomplish this same thing in the current version of wicket? application.getRequestCycleListeners().add(new MyRequestCycleListener()) class MyRequestCycleListener extends AbstractRequestCycleListener { // override the method you need here } Once you have it you can contribute it to gae-initializer project so other people can re-use it and improve it. Daniel - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.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: Reload html in Wicket + GAE
I've now created a class MyRequestCycleListener extends AbstractRequestCycleListener. I'm having a little trouble building class GaeModificationWatcher implements IModificationWatcher. I've tried following this example: http://agilewombat.blogspot.com/2010/01/wicket-on-google-app-engine.html to create the public void checkResources() function, but I'm not sure what Entry class to import. I have tried importing these two Entry classes: org.apache.wicket.util.collections.IntHashMap.Entry import com.google.appengine.repackaged.com.google.common.collect.Multiset.Entry It seems no matter which Entry class I import I get errors like: Multiple markers at this line - Entry cannot be resolved to a type - The constructor HashSetEntryIModifiable,SetIChangeListener(SetMap.EntryIModifiable,SetIChangeListener) is undefined - Incorrect number of arguments for type IntHashMap.Entry; it cannot be parameterized with arguments IModifiable, SetIChangeListener Thanks for any pointers. Daniel On Tue, Feb 7, 2012 at 7:07 AM, Martin Grigorov mgrigo...@apache.org wrote: On Tue, Feb 7, 2012 at 3:53 PM, Daniel Watrous daniel.watr...@gmail.com wrote: Thanks Martin, I did make that much progress yesterday after sending this, but I can't figure out how to get the Application inside the onBeginRequest method that I override. In the other examples they call getApplication() @Override protected void onBeginRequest() { if (getApplication().getConfigurationType().equals(Application.DEVELOPMENT)) { final GaeModificationWatcher resourceWatcher = (GaeModificationWatcher) getApplication() .getResourceSettings().getResourceWatcher(true); resourceWatcher.checkResources(); } } How can I get the Application object? Application.get() Daniel On Mon, Feb 6, 2012 at 11:43 PM, Martin Grigorov mgrigo...@apache.org wrote: Hi, On Tue, Feb 7, 2012 at 1:32 AM, Daniel Watrous daniel.watr...@gmail.com wrote: Hi, I'm following up on a previous thread that's still unresolved. I would like GAE to automatically reload my HTML when I save changes. Classes are reloaded when I save (compile) them, but I have to restart each time for HTML changes. There are some old articles that show how to do this, but they deal with older versions of Wicket and GAE. For example: http://agilewombat.blogspot.com/2010/01/wicket-on-google-app-engine.html http://apache-wicket.1842946.n4.nabble.com/How-can-I-reload-HTML-in-app-engine-td3005241.html http://code.google.com/p/kickat26/source/browse/trunk/src/de/kickat26/ui/wicket/GAEModificationWatcher.java Those suggest creating a class MyWebRequestCycle extends WebRequestCycle, but wicket 1.5 doesn't have WebRequestCycle. How can I accomplish this same thing in the current version of wicket? application.getRequestCycleListeners().add(new MyRequestCycleListener()) class MyRequestCycleListener extends AbstractRequestCycleListener { // override the method you need here } Once you have it you can contribute it to gae-initializer project so other people can re-use it and improve it. Daniel - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.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 -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.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: Reload html in Wicket + GAE
That helped. I'm getting really close. I'm now getting a null pointer exception in this function public boolean add(IModifiable modifiable, IChangeListener listener) { // TODO Auto-generated method stub checkResources(); SetIChangeListener listeners = listenersMap.putIfAbsent(modifiable, new HashSetIChangeListener()); return listeners.add(listener); } listeners is null. I noticed that start(Duration pollFrequency) in GaeModificationWatcher was never getting called, so I updated my WicketApplication to set it like this: IModificationWatcher watcher = new GaeModificationWatcher(); watcher.start(Duration.ONE_SECOND); getResourceSettings().setResourceWatcher(watcher); But that didn't help my problem. I'm still trying to follow http://agilewombat.blogspot.com/2010/01/wicket-on-google-app-engine.html Any pointers? Thanks, Daniel On Tue, Feb 7, 2012 at 8:42 AM, Martin Grigorov mgrigo...@apache.org wrote: Try with java.util.Map.Entry On Tue, Feb 7, 2012 at 5:39 PM, Daniel Watrous daniel.watr...@gmail.com wrote: I've now created a class MyRequestCycleListener extends AbstractRequestCycleListener. I'm having a little trouble building class GaeModificationWatcher implements IModificationWatcher. I've tried following this example: http://agilewombat.blogspot.com/2010/01/wicket-on-google-app-engine.html to create the public void checkResources() function, but I'm not sure what Entry class to import. I have tried importing these two Entry classes: org.apache.wicket.util.collections.IntHashMap.Entry import com.google.appengine.repackaged.com.google.common.collect.Multiset.Entry It seems no matter which Entry class I import I get errors like: Multiple markers at this line - Entry cannot be resolved to a type - The constructor HashSetEntryIModifiable,SetIChangeListener(SetMap.EntryIModifiable,SetIChangeListener) is undefined - Incorrect number of arguments for type IntHashMap.Entry; it cannot be parameterized with arguments IModifiable, SetIChangeListener Thanks for any pointers. Daniel On Tue, Feb 7, 2012 at 7:07 AM, Martin Grigorov mgrigo...@apache.org wrote: On Tue, Feb 7, 2012 at 3:53 PM, Daniel Watrous daniel.watr...@gmail.com wrote: Thanks Martin, I did make that much progress yesterday after sending this, but I can't figure out how to get the Application inside the onBeginRequest method that I override. In the other examples they call getApplication() @Override protected void onBeginRequest() { if (getApplication().getConfigurationType().equals(Application.DEVELOPMENT)) { final GaeModificationWatcher resourceWatcher = (GaeModificationWatcher) getApplication() .getResourceSettings().getResourceWatcher(true); resourceWatcher.checkResources(); } } How can I get the Application object? Application.get() Daniel On Mon, Feb 6, 2012 at 11:43 PM, Martin Grigorov mgrigo...@apache.org wrote: Hi, On Tue, Feb 7, 2012 at 1:32 AM, Daniel Watrous daniel.watr...@gmail.com wrote: Hi, I'm following up on a previous thread that's still unresolved. I would like GAE to automatically reload my HTML when I save changes. Classes are reloaded when I save (compile) them, but I have to restart each time for HTML changes. There are some old articles that show how to do this, but they deal with older versions of Wicket and GAE. For example: http://agilewombat.blogspot.com/2010/01/wicket-on-google-app-engine.html http://apache-wicket.1842946.n4.nabble.com/How-can-I-reload-HTML-in-app-engine-td3005241.html http://code.google.com/p/kickat26/source/browse/trunk/src/de/kickat26/ui/wicket/GAEModificationWatcher.java Those suggest creating a class MyWebRequestCycle extends WebRequestCycle, but wicket 1.5 doesn't have WebRequestCycle. How can I accomplish this same thing in the current version of wicket? application.getRequestCycleListeners().add(new MyRequestCycleListener()) class MyRequestCycleListener extends AbstractRequestCycleListener { // override the method you need here } Once you have it you can contribute it to gae-initializer project so other people can re-use it and improve it. Daniel - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.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
Re: Reload html in Wicket + GAE
So I was just looking at what I sent along and it seems that putIfAbsent(modifiable, new HashSetIChangeListener()) should return the value component, which should be the new HashSetIChangeListener. Even if the key modifiable already exists, it should return the previously created HashSetIChangeListener. I'm confused that listener is coming back null. Daniel On Tue, Feb 7, 2012 at 9:21 AM, Daniel Watrous daniel.watr...@gmail.com wrote: That helped. I'm getting really close. I'm now getting a null pointer exception in this function public boolean add(IModifiable modifiable, IChangeListener listener) { // TODO Auto-generated method stub checkResources(); SetIChangeListener listeners = listenersMap.putIfAbsent(modifiable, new HashSetIChangeListener()); return listeners.add(listener); } listeners is null. I noticed that start(Duration pollFrequency) in GaeModificationWatcher was never getting called, so I updated my WicketApplication to set it like this: IModificationWatcher watcher = new GaeModificationWatcher(); watcher.start(Duration.ONE_SECOND); getResourceSettings().setResourceWatcher(watcher); But that didn't help my problem. I'm still trying to follow http://agilewombat.blogspot.com/2010/01/wicket-on-google-app-engine.html Any pointers? Thanks, Daniel On Tue, Feb 7, 2012 at 8:42 AM, Martin Grigorov mgrigo...@apache.org wrote: Try with java.util.Map.Entry On Tue, Feb 7, 2012 at 5:39 PM, Daniel Watrous daniel.watr...@gmail.com wrote: I've now created a class MyRequestCycleListener extends AbstractRequestCycleListener. I'm having a little trouble building class GaeModificationWatcher implements IModificationWatcher. I've tried following this example: http://agilewombat.blogspot.com/2010/01/wicket-on-google-app-engine.html to create the public void checkResources() function, but I'm not sure what Entry class to import. I have tried importing these two Entry classes: org.apache.wicket.util.collections.IntHashMap.Entry import com.google.appengine.repackaged.com.google.common.collect.Multiset.Entry It seems no matter which Entry class I import I get errors like: Multiple markers at this line - Entry cannot be resolved to a type - The constructor HashSetEntryIModifiable,SetIChangeListener(SetMap.EntryIModifiable,SetIChangeListener) is undefined - Incorrect number of arguments for type IntHashMap.Entry; it cannot be parameterized with arguments IModifiable, SetIChangeListener Thanks for any pointers. Daniel On Tue, Feb 7, 2012 at 7:07 AM, Martin Grigorov mgrigo...@apache.org wrote: On Tue, Feb 7, 2012 at 3:53 PM, Daniel Watrous daniel.watr...@gmail.com wrote: Thanks Martin, I did make that much progress yesterday after sending this, but I can't figure out how to get the Application inside the onBeginRequest method that I override. In the other examples they call getApplication() @Override protected void onBeginRequest() { if (getApplication().getConfigurationType().equals(Application.DEVELOPMENT)) { final GaeModificationWatcher resourceWatcher = (GaeModificationWatcher) getApplication() .getResourceSettings().getResourceWatcher(true); resourceWatcher.checkResources(); } } How can I get the Application object? Application.get() Daniel On Mon, Feb 6, 2012 at 11:43 PM, Martin Grigorov mgrigo...@apache.org wrote: Hi, On Tue, Feb 7, 2012 at 1:32 AM, Daniel Watrous daniel.watr...@gmail.com wrote: Hi, I'm following up on a previous thread that's still unresolved. I would like GAE to automatically reload my HTML when I save changes. Classes are reloaded when I save (compile) them, but I have to restart each time for HTML changes. There are some old articles that show how to do this, but they deal with older versions of Wicket and GAE. For example: http://agilewombat.blogspot.com/2010/01/wicket-on-google-app-engine.html http://apache-wicket.1842946.n4.nabble.com/How-can-I-reload-HTML-in-app-engine-td3005241.html http://code.google.com/p/kickat26/source/browse/trunk/src/de/kickat26/ui/wicket/GAEModificationWatcher.java Those suggest creating a class MyWebRequestCycle extends WebRequestCycle, but wicket 1.5 doesn't have WebRequestCycle. How can I accomplish this same thing in the current version of wicket? application.getRequestCycleListeners().add(new MyRequestCycleListener()) class MyRequestCycleListener extends AbstractRequestCycleListener { // override the method you need here } Once you have it you can contribute it to gae-initializer project so other people can re-use it and improve it. Daniel - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
Re: Reload html in Wicket + GAE
I finally got it working. Here's the modified function: public boolean add(IModifiable modifiable, IChangeListener listener) { // TODO Auto-generated method stub checkResources(); HashSetIChangeListener listenerSet = new HashSetIChangeListener(); SetIChangeListener listeners = listenersMap.putIfAbsent(modifiable, listenerSet); if (listeners != null) { return listeners.add(listener); } else return listenerSet.add(listener); } I'm not sure if that's a good approach or not, but it works for me and that's fantastic. Daniel On Tue, Feb 7, 2012 at 9:30 AM, Daniel Watrous daniel.watr...@gmail.com wrote: So I was just looking at what I sent along and it seems that putIfAbsent(modifiable, new HashSetIChangeListener()) should return the value component, which should be the new HashSetIChangeListener. Even if the key modifiable already exists, it should return the previously created HashSetIChangeListener. I'm confused that listener is coming back null. Daniel On Tue, Feb 7, 2012 at 9:21 AM, Daniel Watrous daniel.watr...@gmail.com wrote: That helped. I'm getting really close. I'm now getting a null pointer exception in this function public boolean add(IModifiable modifiable, IChangeListener listener) { // TODO Auto-generated method stub checkResources(); SetIChangeListener listeners = listenersMap.putIfAbsent(modifiable, new HashSetIChangeListener()); return listeners.add(listener); } listeners is null. I noticed that start(Duration pollFrequency) in GaeModificationWatcher was never getting called, so I updated my WicketApplication to set it like this: IModificationWatcher watcher = new GaeModificationWatcher(); watcher.start(Duration.ONE_SECOND); getResourceSettings().setResourceWatcher(watcher); But that didn't help my problem. I'm still trying to follow http://agilewombat.blogspot.com/2010/01/wicket-on-google-app-engine.html Any pointers? Thanks, Daniel On Tue, Feb 7, 2012 at 8:42 AM, Martin Grigorov mgrigo...@apache.org wrote: Try with java.util.Map.Entry On Tue, Feb 7, 2012 at 5:39 PM, Daniel Watrous daniel.watr...@gmail.com wrote: I've now created a class MyRequestCycleListener extends AbstractRequestCycleListener. I'm having a little trouble building class GaeModificationWatcher implements IModificationWatcher. I've tried following this example: http://agilewombat.blogspot.com/2010/01/wicket-on-google-app-engine.html to create the public void checkResources() function, but I'm not sure what Entry class to import. I have tried importing these two Entry classes: org.apache.wicket.util.collections.IntHashMap.Entry import com.google.appengine.repackaged.com.google.common.collect.Multiset.Entry It seems no matter which Entry class I import I get errors like: Multiple markers at this line - Entry cannot be resolved to a type - The constructor HashSetEntryIModifiable,SetIChangeListener(SetMap.EntryIModifiable,SetIChangeListener) is undefined - Incorrect number of arguments for type IntHashMap.Entry; it cannot be parameterized with arguments IModifiable, SetIChangeListener Thanks for any pointers. Daniel On Tue, Feb 7, 2012 at 7:07 AM, Martin Grigorov mgrigo...@apache.org wrote: On Tue, Feb 7, 2012 at 3:53 PM, Daniel Watrous daniel.watr...@gmail.com wrote: Thanks Martin, I did make that much progress yesterday after sending this, but I can't figure out how to get the Application inside the onBeginRequest method that I override. In the other examples they call getApplication() @Override protected void onBeginRequest() { if (getApplication().getConfigurationType().equals(Application.DEVELOPMENT)) { final GaeModificationWatcher resourceWatcher = (GaeModificationWatcher) getApplication() .getResourceSettings().getResourceWatcher(true); resourceWatcher.checkResources(); } } How can I get the Application object? Application.get() Daniel On Mon, Feb 6, 2012 at 11:43 PM, Martin Grigorov mgrigo...@apache.org wrote: Hi, On Tue, Feb 7, 2012 at 1:32 AM, Daniel Watrous daniel.watr...@gmail.com wrote: Hi, I'm following up on a previous thread that's still unresolved. I would like GAE to automatically reload my HTML when I save changes. Classes are reloaded when I save (compile) them, but I have to restart each time for HTML changes. There are some old articles that show how to do this, but they deal with older versions of Wicket and GAE. For example: http://agilewombat.blogspot.com/2010/01/wicket-on-google-app-engine.html http://apache-wicket.1842946.n4.nabble.com/How-can-I-reload-HTML-in-app-engine-td3005241
Re: Reload html in Wicket + GAE
Here's my write up: http://software.danielwatrous.com/software-engineering/wicket-gae-automatic-reload I'm not sure if I can push directly into wicketstuff, but I'm happy to try. You can grab the source from my site and put it in there. You may even have a more clever way to composing things. Daniel On Tue, Feb 7, 2012 at 12:17 PM, Kayode Odeyemi drey...@gmail.com wrote: Glad you got it working Daniel, as Martin mentioned earlier, I'll appreciate if you can contribute this to existing GaeInitializer or somewhere comfortable with the full code so it can be valuable to us all. Thanks On Tue, Feb 7, 2012 at 5:31 PM, Daniel Watrous daniel.watr...@gmail.comwrote: I finally got it working. Here's the modified function: public boolean add(IModifiable modifiable, IChangeListener listener) { // TODO Auto-generated method stub checkResources(); HashSetIChangeListener listenerSet = new HashSetIChangeListener(); SetIChangeListener listeners = listenersMap.putIfAbsent(modifiable, listenerSet); if (listeners != null) { return listeners.add(listener); } else return listenerSet.add(listener); } I'm not sure if that's a good approach or not, but it works for me and that's fantastic. Daniel On Tue, Feb 7, 2012 at 9:30 AM, Daniel Watrous daniel.watr...@gmail.com wrote: So I was just looking at what I sent along and it seems that putIfAbsent(modifiable, new HashSetIChangeListener()) should return the value component, which should be the new HashSetIChangeListener. Even if the key modifiable already exists, it should return the previously created HashSetIChangeListener. I'm confused that listener is coming back null. Daniel On Tue, Feb 7, 2012 at 9:21 AM, Daniel Watrous daniel.watr...@gmail.com wrote: That helped. I'm getting really close. I'm now getting a null pointer exception in this function public boolean add(IModifiable modifiable, IChangeListener listener) { // TODO Auto-generated method stub checkResources(); SetIChangeListener listeners = listenersMap.putIfAbsent(modifiable, new HashSetIChangeListener()); return listeners.add(listener); } listeners is null. I noticed that start(Duration pollFrequency) in GaeModificationWatcher was never getting called, so I updated my WicketApplication to set it like this: IModificationWatcher watcher = new GaeModificationWatcher(); watcher.start(Duration.ONE_SECOND); getResourceSettings().setResourceWatcher(watcher); But that didn't help my problem. I'm still trying to follow http://agilewombat.blogspot.com/2010/01/wicket-on-google-app-engine.html Any pointers? Thanks, Daniel On Tue, Feb 7, 2012 at 8:42 AM, Martin Grigorov mgrigo...@apache.org wrote: Try with java.util.Map.Entry On Tue, Feb 7, 2012 at 5:39 PM, Daniel Watrous daniel.watr...@gmail.com wrote: I've now created a class MyRequestCycleListener extends AbstractRequestCycleListener. I'm having a little trouble building class GaeModificationWatcher implements IModificationWatcher. I've tried following this example: http://agilewombat.blogspot.com/2010/01/wicket-on-google-app-engine.html to create the public void checkResources() function, but I'm not sure what Entry class to import. I have tried importing these two Entry classes: org.apache.wicket.util.collections.IntHashMap.Entry import com.google.appengine.repackaged.com.google.common.collect.Multiset.Entry It seems no matter which Entry class I import I get errors like: Multiple markers at this line - Entry cannot be resolved to a type - The constructor HashSetEntryIModifiable,SetIChangeListener(SetMap.EntryIModifiable,SetIChangeListener) is undefined - Incorrect number of arguments for type IntHashMap.Entry; it cannot be parameterized with arguments IModifiable, SetIChangeListener Thanks for any pointers. Daniel On Tue, Feb 7, 2012 at 7:07 AM, Martin Grigorov mgrigo...@apache.org wrote: On Tue, Feb 7, 2012 at 3:53 PM, Daniel Watrous daniel.watr...@gmail.com wrote: Thanks Martin, I did make that much progress yesterday after sending this, but I can't figure out how to get the Application inside the onBeginRequest method that I override. In the other examples they call getApplication() @Override protected void onBeginRequest() { if (getApplication().getConfigurationType().equals(Application.DEVELOPMENT)) { final GaeModificationWatcher resourceWatcher = (GaeModificationWatcher) getApplication() .getResourceSettings().getResourceWatcher(true); resourceWatcher.checkResources
MulitFileUploadField looses state after validation error
Hi everyone Little advice needed: I have a Form with several TextField's and a MultiFileUploadField. If you select some files to upload and enter some text in the TextFields - after the submit everything is fine. Now if in case some TextField fire a validation error and the page is rendered again, you have to select the files to upload one more time. Is there any possibility to keep the state as long as validation errors occur? Btw same problem wit FileUploadField. Using wicket 1.5.3. thx
Reload html in Wicket + GAE
Hi, I'm following up on a previous thread that's still unresolved. I would like GAE to automatically reload my HTML when I save changes. Classes are reloaded when I save (compile) them, but I have to restart each time for HTML changes. There are some old articles that show how to do this, but they deal with older versions of Wicket and GAE. For example: http://agilewombat.blogspot.com/2010/01/wicket-on-google-app-engine.html http://apache-wicket.1842946.n4.nabble.com/How-can-I-reload-HTML-in-app-engine-td3005241.html http://code.google.com/p/kickat26/source/browse/trunk/src/de/kickat26/ui/wicket/GAEModificationWatcher.java Those suggest creating a class MyWebRequestCycle extends WebRequestCycle, but wicket 1.5 doesn't have WebRequestCycle. How can I accomplish this same thing in the current version of wicket? Daniel - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: AJAX Rating extension, multiple on a page
It turned out to be easier than I thought (must not have been thinking in the wicket way). Here's what I do (notice that inside populateItem I have access to movieItem, which I can use to getModelObject()): // Add movieListView of existing movies moviesForm.add(new PropertyListViewMovie(movies, movieList) { @Override public void populateItem(final ListItemMovie movieItem) { final RatingModel rating = new RatingModel(movieItem.getModelObject().getRating()); movieItem.add(new TextFieldString(name).setType(String.class)); movieItem.add(new DropDownChoiceCategory(category, Arrays.asList(Category.values()), new EnumChoiceRendererCategory(this))); movieItem.add(new RatingPanel (rating, new PropertyModelInteger(rating, rating), 5, new PropertyModelInteger(rating, numberOfVotes), false) { @Override public boolean onIsStarActive(int star) { return rating.isActive(star); } @Override public void onRated(int newRating, AjaxRequestTarget target) { movieItem.getModelObject().setRating(newRating); rating.updateRating(newRating); Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); session.update(movieItem.getModelObject()); session.getTransaction().commit(); movieList.detach(); } }); movieItem.add(new Link(removeLink) { @Override public void onClick() { System.out.print(movieItem.getModelObject().getId()); Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); session.delete(movieItem.getModelObject()); session.getTransaction().commit(); movieList.detach(); } }); } }).setVersioned(false); Daniel On Sun, Jan 22, 2012 at 12:46 PM, armhold armh...@gmail.com wrote: Just to be clear in case it wasn't obvious- thingBeingRated will be serialized with the rest of your page if you take this approach. If it's not serializable, use a reference (like a database ID) to look it up when needed, instead of marking the object itself as final. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AJAX-Rating-extension-multiple-on-a-page-tp4317346p4318956.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
form processing for multiple objects
I have populated a form with values representing several different objects. This is what my markup looks like: form wicket:id = moviesForm id = moviesForm span wicket:id = movies id = movies a wicket:id = removeLink(remove)/a input type=text wicket:id=name class=nospam/ select wicket:id=category/ span wicket:id=ratingrating/span br / /span input type = submit value = Update Movies id=formsubmit/ /form The span is reproduced for each object that I pull from a database. There is a different identifier for each span, as you can see here: http://screencast.com/t/l8pLGZnJVn8 I want to be able to access these objects when I click submit the form, but I'm not sure how to get access to them. This is what I have tried so far: Form moviesForm = new FormValueMap(moviesForm) { /** * Show the resulting valid new movie */ @Override public final void onSubmit() { ValueMap values = getModelObject(); // perform validation and security here if (StringUtils.isBlank((String) values.get(name))) { error(Received bad input!!!); return; } Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); Movie movie = new Movie(); movie.setName((String) values.get(name)); movie.setCategory((Category) values.get(category)); session.save(movie); session.getTransaction().commit(); } }; The ValueMap values comes back null from getModelObject(). Any pointers for me to get these objects back in a way that I can easily update them? Thanks. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: form processing for multiple objects
Let me give a little more detail. The way that markup is managed is through this: // Add movieListView of existing movies moviesForm.add(new PropertyListViewMovie(movies, movieList) { @Override public void populateItem(final ListItemMovie movieItem) { final RatingModel rating = new RatingModel(movieItem.getModelObject().getRating()); movieItem.add(new TextFieldString(name).setType(String.class)); movieItem.add(new DropDownChoiceCategory(category, Arrays.asList(Category.values()), new EnumChoiceRendererCategory(this))); movieItem.add(new RatingPanel (rating, new PropertyModelInteger(rating, rating), 5, new PropertyModelInteger(rating, numberOfVotes), false) { @Override public boolean onIsStarActive(int star) { return rating.isActive(star); } @Override public void onRated(int newRating, AjaxRequestTarget target) { movieItem.getModelObject().setRating(newRating); rating.updateRating(newRating); Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); session.update(movieItem.getModelObject()); session.getTransaction().commit(); movieList.detach(); } }); movieItem.add(new Link(removeLink) { @Override public void onClick() { System.out.print(movieItem.getModelObject().getId()); Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); session.delete(movieItem.getModelObject()); session.getTransaction().commit(); movieList.detach(); } }); } }).setVersioned(false); I suppose that means that I'm not actually adding new items to the list as a form. Maybe what I need is to treat the entire component as a form from the beginning. I'm just not sure exactly how to do that. Any ideas? Daniel On Mon, Jan 23, 2012 at 9:07 AM, Daniel Watrous daniel.watr...@gmail.com wrote: I have populated a form with values representing several different objects. This is what my markup looks like: form wicket:id = moviesForm id = moviesForm span wicket:id = movies id = movies a wicket:id = removeLink(remove)/a input type=text wicket:id=name class=nospam/ select wicket:id=category/ span wicket:id=ratingrating/span br / /span input type = submit value = Update Movies id=formsubmit/ /form The span is reproduced for each object that I pull from a database. There is a different identifier for each span, as you can see here: http://screencast.com/t/l8pLGZnJVn8 I want to be able to access these objects when I click submit the form, but I'm not sure how to get access to them. This is what I have tried so far: Form moviesForm = new FormValueMap(moviesForm) { /** * Show the resulting valid new movie */ @Override public final void onSubmit() { ValueMap values = getModelObject(); // perform validation and security here if (StringUtils.isBlank((String) values.get(name))) { error(Received bad input!!!); return; } Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); Movie movie = new Movie(); movie.setName((String) values.get(name)); movie.setCategory((Category) values.get(category)); session.save(movie); session.getTransaction().commit(); } }; The ValueMap values comes back null from getModelObject(). Any pointers for me to get these objects back in a way that I can easily update them? Thanks. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: form processing for multiple objects
Note that I can access the objects that I populate using a PropertyListView individually just fine. What I am trying to do now is access them as part of a larger form so that I can update multiple items at once. I was hoping to be able to iterate through the items that the PropertyListView had rendered so that I can update them one by one. That's where I'm failing. That Form and onSubmit are defined outside of the PropertyListView. I'm sorry if I'm not explaining this very well. Daniel On Mon, Jan 23, 2012 at 9:27 AM, Daniel Watrous daniel.watr...@gmail.com wrote: The problem is that I can't seem to access the form submitted values in onSubmit(). ValueMap values = getModelObject(); values is null... Daniel On Mon, Jan 23, 2012 at 9:24 AM, Sven Meier s...@meiers.net wrote: So you're already using PropertyListView, fine. What's your problem once again? Sven Am 23.01.2012 17:20, schrieb Daniel Watrous: Let me give a little more detail. The way that markup is managed is through this: // Add movieListView of existing movies moviesForm.add(new PropertyListViewMovie(movies, movieList) { @Override public void populateItem(final ListItemMovie movieItem) { final RatingModel rating = new RatingModel(movieItem.getModelObject().getRating()); movieItem.add(new TextFieldString(name).setType(String.class)); movieItem.add(new DropDownChoiceCategory(category, Arrays.asList(Category.values()), new EnumChoiceRendererCategory(this))); movieItem.add(new RatingPanel (rating, new PropertyModelInteger(rating, rating), 5, new PropertyModelInteger(rating, numberOfVotes), false) { @Override public boolean onIsStarActive(int star) { return rating.isActive(star); } @Override public void onRated(int newRating, AjaxRequestTarget target) { movieItem.getModelObject().setRating(newRating); rating.updateRating(newRating); Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); session.update(movieItem.getModelObject()); session.getTransaction().commit(); movieList.detach(); } }); movieItem.add(new Link(removeLink) { @Override public void onClick() { System.out.print(movieItem.getModelObject().getId()); Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); session.delete(movieItem.getModelObject()); session.getTransaction().commit(); movieList.detach(); } }); } }).setVersioned(false); I suppose that means that I'm not actually adding new items to the list as a form. Maybe what I need is to treat the entire component as a form from the beginning. I'm just not sure exactly how to do that. Any ideas? Daniel On Mon, Jan 23, 2012 at 9:07 AM, Daniel Watrous daniel.watr...@gmail.com wrote: I have populated a form with values representing several different objects. This is what my markup looks like: form wicket:id = moviesForm id = moviesForm span wicket:id = movies id = movies a wicket:id = removeLink(remove)/a input type=text wicket:id=name class=nospam/ select wicket:id=category/ span wicket:id=ratingrating/span br / /span input type = submit value = Update Movies id=formsubmit/ /form The span is reproduced for each object that I pull from a database. There is a different identifier for each span, as you can see here: http://screencast.com/t/l8pLGZnJVn8 I want to be able to access these objects when I click submit the form, but I'm not sure how to get access to them. This is what I have tried so far: Form moviesForm = new FormValueMap(moviesForm) { /** * Show the resulting valid new movie */ @Override public final void onSubmit() { ValueMap values = getModelObject(); // perform validation and security here if (StringUtils.isBlank((String) values.get(name))) { error(Received bad input!!!); return; } Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); Movie movie
Re: form processing for multiple objects
Here's a little more code. You can see that I add the PropertyListView to moviesForm...My listView (movieList) is a LoadableDetachableModel, so it doesn't have the getModelObject() method. I'm still not quite sure how to get access to the form details in onSubmit(). Form moviesForm = new FormValueMap(moviesForm) { /** * Show the resulting valid new movie */ @Override public final void onSubmit() { Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); for (Movie movie : movieList.getModelObject()) { session.save(movie); } session.getTransaction().commit(); } }; // Add movieListView of existing movies moviesForm.add(new PropertyListViewMovie(movies, movieList) { @Override public void populateItem(final ListItemMovie movieItem) { final RatingModel rating = new RatingModel(movieItem.getModelObject().getRating()); movieItem.add(new TextFieldString(name).setType(String.class)); movieItem.add(new DropDownChoiceCategory(category, Arrays.asList(Category.values()), new EnumChoiceRendererCategory(this))); movieItem.add(new RatingPanel (rating, new PropertyModelInteger(rating, rating), 5, new PropertyModelInteger(rating, numberOfVotes), false) { @Override public boolean onIsStarActive(int star) { return rating.isActive(star); } @Override public void onRated(int newRating, AjaxRequestTarget target) { movieItem.getModelObject().setRating(newRating); rating.updateRating(newRating); Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); session.update(movieItem.getModelObject()); session.getTransaction().commit(); movieList.detach(); } }); movieItem.add(new Link(removeLink) { @Override public void onClick() { Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); session.delete(movieItem.getModelObject()); session.getTransaction().commit(); movieList.detach(); } }); } }).setVersioned(false); add(moviesForm); On Mon, Jan 23, 2012 at 9:33 AM, Sven Meier s...@meiers.net wrote: Do you have the ValueMap usage from a Wicket example (e.g. Guestbook)? You don't seem to have any code that wires a ValueMap into your form. The following should be enough: @Override public final void onSubmit() { Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); for (Movie movie : listView.getModelObject()) { session.save(movie); } session.getTransaction().commit(); } Hope this helps Sven Am 23.01.2012 17:27, schrieb Daniel Watrous: The problem is that I can't seem to access the form submitted values in onSubmit(). ValueMap values = getModelObject(); values is null... Daniel On Mon, Jan 23, 2012 at 9:24 AM, Sven Meiers...@meiers.net wrote: So you're already using PropertyListView, fine. What's your problem once again? Sven Am 23.01.2012 17:20, schrieb Daniel Watrous: Let me give a little more detail. The way that markup is managed is through this: // Add movieListView of existing movies moviesForm.add(new PropertyListViewMovie(movies, movieList) { @Override public void populateItem(final ListItemMovie movieItem) { final RatingModel rating = new RatingModel(movieItem.getModelObject().getRating()); movieItem.add(new TextFieldString(name).setType(String.class)); movieItem.add(new DropDownChoiceCategory(category, Arrays.asList(Category.values()), new EnumChoiceRendererCategory(this))); movieItem.add(new RatingPanel (rating, new PropertyModelInteger(rating, rating), 5, new PropertyModelInteger(rating, numberOfVotes), false) { @Override public boolean onIsStarActive(int star) { return rating.isActive(star); } @Override public void onRated(int newRating, AjaxRequestTarget target
Re: form processing for multiple objects
I ended up with something similar (see also this post: http://apache-wicket.1842946.n4.nabble.com/Add-new-items-to-a-list-within-a-form-by-ajaxlink-td2017446.html) http://paste.pocoo.org/show/539351/ I created a class level variable that would hold my PropertyListView which made it available to the my onSubmit() method in the form. Thank you so much for your help. Daniel On Mon, Jan 23, 2012 at 10:20 AM, Sven Meier s...@meiers.net wrote: How about this: http://paste.pocoo.org/show/539346/ Sven Am 23.01.2012 17:53, schrieb Daniel Watrous: Here's a little more code. You can see that I add the PropertyListView to moviesForm...My listView (movieList) is a LoadableDetachableModel, so it doesn't have the getModelObject() method. I'm still not quite sure how to get access to the form details in onSubmit(). Form moviesForm = new FormValueMap(moviesForm) { /** * Show the resulting valid new movie */ @Override public final void onSubmit() { Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); for (Movie movie : movieList.getModelObject()) { session.save(movie); } session.getTransaction().commit(); } }; // Add movieListView of existing movies moviesForm.add(new PropertyListViewMovie(movies, movieList) { @Override public void populateItem(final ListItemMovie movieItem) { final RatingModel rating = new RatingModel(movieItem.getModelObject().getRating()); movieItem.add(new TextFieldString(name).setType(String.class)); movieItem.add(new DropDownChoiceCategory(category, Arrays.asList(Category.values()), new EnumChoiceRendererCategory(this))); movieItem.add(new RatingPanel (rating, new PropertyModelInteger(rating, rating), 5, new PropertyModelInteger(rating, numberOfVotes), false) { @Override public boolean onIsStarActive(int star) { return rating.isActive(star); } @Override public void onRated(int newRating, AjaxRequestTarget target) { movieItem.getModelObject().setRating(newRating); rating.updateRating(newRating); Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); session.update(movieItem.getModelObject()); session.getTransaction().commit(); movieList.detach(); } }); movieItem.add(new Link(removeLink) { @Override public void onClick() { Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); session.delete(movieItem.getModelObject()); session.getTransaction().commit(); movieList.detach(); } }); } }).setVersioned(false); add(moviesForm); On Mon, Jan 23, 2012 at 9:33 AM, Sven Meiers...@meiers.net wrote: Do you have the ValueMap usage from a Wicket example (e.g. Guestbook)? You don't seem to have any code that wires a ValueMap into your form. The following should be enough: @Override public final void onSubmit() { Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); for (Movie movie : listView.getModelObject()) { session.save(movie); } session.getTransaction().commit(); } Hope this helps Sven Am 23.01.2012 17:27, schrieb Daniel Watrous: The problem is that I can't seem to access the form submitted values in onSubmit(). ValueMap values = getModelObject(); values is null... Daniel On Mon, Jan 23, 2012 at 9:24 AM, Sven Meiers...@meiers.net wrote: So you're already using PropertyListView, fine. What's your problem once again? Sven Am 23.01.2012 17:20, schrieb Daniel Watrous: Let me give a little more detail. The way that markup is managed is through this: // Add movieListView of existing movies moviesForm.add(new PropertyListViewMovie(movies, movieList) { @Override public void populateItem(final ListItemMovie movieItem) { final RatingModel rating = new RatingModel(movieItem.getModelObject().getRating()); movieItem.add(new TextFieldString(name
Weekend in Wicket
Hi, I spent the weekend working on a pre-interview exercise. The outcome was a wicket+hibernate app deployed on Amazon EC2. I'm sending it to the list because I love finding small examples like this when I'm trying to do something new with a technology like Wicket. I hope it's helpful, and thanks for all your replies to my questions :) http://software.danielwatrous.com/software-engineering/java-wicket-and-hibernate-on-ec2-pre-interview-project Daniel - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Can't instantiate page using constructor
When I build my wicket project I'm getting the following error Tests in error: homepageRendersSuccessfully(com.danielwatrous.movieratings.TestHomePage): Can't instantiate page using constructor 'public com.danielwatrous.movieratings.HomePage(org.apache.wicket.request.mapper.parameter.PageParameters)' and argument ''. Might be it doesn't exist, may be it is not visible (public). I can't see any errors in my code. I am trying to use Hibernate and if I comment out the hibernate code then the page compiles fine. I don't see how the hibernate code causes an error with the class. Here's my code. package com.danielwatrous.movieratings; import org.hibernate.Session; import org.apache.wicket.request.mapper.parameter.PageParameters; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.WebPage; import com.danielwatrous.movieratings.domain.*; import com.danielwatrous.movieratings.util.HibernateUtil; public class HomePage extends WebPage { private static final long serialVersionUID = 1L; public HomePage(final PageParameters parameters) { add(new Label(version, getApplication().getFrameworkSettings().getVersion())); // TODO Add your page's components here Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); Movie movie = new Movie(); movie.setName(Ocean's Eleven); movie.setCategory(Category.COMEDY); movie.setRating(Rating.FOURSTARS); session.save(movie); session.getTransaction().commit(); } } - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Can't instantiate page using constructor
That was the only error produced when running build. However, I tried running the server (jetty:run) anyway and found it started and provided a stack trace when I loaded the homepage. That helped me to solve my problem. I had errors outside of wicket, related to hibernate. Thank you, Daniel On Sat, Jan 21, 2012 at 10:26 AM, Per Newgro per.new...@gmx.ch wrote: The stack trace is what? Am 21.01.2012 18:21, schrieb Daniel Watrous: When I build my wicket project I'm getting the following error Tests in error: homepageRendersSuccessfully(com.danielwatrous.movieratings.TestHomePage): Can't instantiate page using constructor 'public com.danielwatrous.movieratings.HomePage(org.apache.wicket.request.mapper.parameter.PageParameters)' and argument ''. Might be it doesn't exist, may be it is not visible (public). I can't see any errors in my code. I am trying to use Hibernate and if I comment out the hibernate code then the page compiles fine. I don't see how the hibernate code causes an error with the class. Here's my code. package com.danielwatrous.movieratings; import org.hibernate.Session; import org.apache.wicket.request.mapper.parameter.PageParameters; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.WebPage; import com.danielwatrous.movieratings.domain.*; import com.danielwatrous.movieratings.util.HibernateUtil; public class HomePage extends WebPage { private static final long serialVersionUID = 1L; public HomePage(final PageParameters parameters) { add(new Label(version, getApplication().getFrameworkSettings().getVersion())); // TODO Add your page's components here Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); Movie movie = new Movie(); movie.setName(Ocean's Eleven); movie.setCategory(Category.COMEDY); movie.setRating(Rating.FOURSTARS); session.save(movie); session.getTransaction().commit(); } } - 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: What to add to pom.xml to use hibernate?
Thank you. That link helped be get this working. Daniel On Sat, Jan 21, 2012 at 1:32 AM, Per Newgro per.new...@gmx.ch wrote: Hmm. Firstly you ask the wrong list. Hibernate is off topic. At second - did you do a search? With maven hibernate i found this link quickly: http://stackoverflow.com/questions/3345816/hibernate-projects-and-building-with-maven See the answer with the green check at the side. I think that will anser you question. You have to exhange the version numbers by 4.0.1... Cheers Per Am 21.01.2012 08:53, schrieb Daniel Watrous: I'm interested in using hibernate in my wicket application, but I can't find any up to date examples combining the two. Is there something other than hibernate that the wicket community uses for ORM? If not, what can I add to the pom.xml file to include hibernate. I tried adding this: dependency groupIdorg.hibernate/groupId artifactIdhibernate/artifactId version4.0.1-Final/version /dependency but it doesn't work. I an error that it Could not resolve dependencies for project... I also attempted to add this alongside the other repository that is there. repository idjboss/id urlhttp://repository.jboss.org/maven2//url /repository I get the error about Could not resolve dependencies for project... but now many other jar files are not found. I started with the quickstart, if that helps. - 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
guestbook application with database update
I'm creating a small app based on the guestbook: http://www.wicket-library.com/wicket-examples/guestbook/?1 In the guestbook app, the page view is updated every time a new comment is added. The variable commentList is initialized at the top like this private static final ListComment commentList = new ArrayListComment(); // Add commentListView of existing comments add(new PropertyListViewComment(comments, commentList) { @Override public void populateItem(final ListItemComment listItem) { listItem.add(new Label(date)); listItem.add(new MultiLineLabel(text)); } }).setVersioned(false); I wanted to use a database instead, so I made the following changes private ListMovie movieList = new ArrayListMovie(); Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); movieList = session.createQuery(from Movie).list(); session.getTransaction().commit(); // Add commentListView of existing comments add(new PropertyListViewMovie(movies, movieList) { @Override public void populateItem(final ListItemMovie listItem) { listItem.add(new TextFieldString(name).setType(String.class)); listItem.add(new DropDownChoiceCategory(category, Arrays.asList(Category.values()), new EnumChoiceRendererCategory(this))); listItem.add(new Label(rating)); } }).setVersioned(false); With this change, all the items in the database come up when the page first loads, but not after each new item is added to the database. I have to clear out the URL and load the page fresh to see what has been added since the last fresh load. I did try resetting movieList in the onSubmit function to load the current database items into the variable movieList, but that still doesn't update the list. Any idea how to update movieList after each new item is submitted. Daniel - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: guestbook application with database update
This worked GREAT! Thank you. On Sat, Jan 21, 2012 at 2:51 PM, Sven Meier s...@meiers.net wrote: Use a LoadableDetachableModel to load a fresh list of movies on each request. Sven On 01/21/2012 10:35 PM, Daniel Watrous wrote: I'm creating a small app based on the guestbook: http://www.wicket-library.com/wicket-examples/guestbook/?1 In the guestbook app, the page view is updated every time a new comment is added. The variable commentList is initialized at the top like this private static final ListComment commentList = new ArrayListComment(); // Add commentListView of existing comments add(new PropertyListViewComment(comments, commentList) { @Override public void populateItem(final ListItemComment listItem) { listItem.add(new Label(date)); listItem.add(new MultiLineLabel(text)); } }).setVersioned(false); I wanted to use a database instead, so I made the following changes private ListMovie movieList = new ArrayListMovie(); Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); movieList = session.createQuery(from Movie).list(); session.getTransaction().commit(); // Add commentListView of existing comments add(new PropertyListViewMovie(movies, movieList) { @Override public void populateItem(final ListItemMovie listItem) { listItem.add(new TextFieldString(name).setType(String.class)); listItem.add(new DropDownChoiceCategory(category, Arrays.asList(Category.values()), new EnumChoiceRendererCategory(this))); listItem.add(new Label(rating)); } }).setVersioned(false); With this change, all the items in the database come up when the page first loads, but not after each new item is added to the database. I have to clear out the URL and load the page fresh to see what has been added since the last fresh load. I did try resetting movieList in the onSubmit function to load the current database items into the variable movieList, but that still doesn't update the list. Any idea how to update movieList after each new item is submitted. Daniel - 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
AJAX Rating extension, multiple on a page
Hi, I've been working with the Rating extension found here: http://www.wicket-library.com/wicket-examples/ajax/ratings?0 I have a case where I need to render multiple on a page, and they render fine. Each rating panel that displays corresponds to a specific record in a database. I would like to be able to get information from the request to indicate which record the rating is for. The RatingPanel as a method onRated that accepts the rating and runs an update, like this: @Override public void onRated(int rating, AjaxRequestTarget target) { HomePage.rating.addRating(rating); } I also noticed that the URL contains some additional information a href=?0-4.ILinkListener-movies-0-rating-rater-element-0-link wicket:id=link id=linkbb onclick=var wcall=wicketAjaxGet(#039;?0-4.IBehaviorListener.0-movies-0-rating-rater-element-0-link#039;,function() { }.bind(this),function() { }.bind(this), function() {return Wicket.$(#039;linkbb#039;) != null;}.bind(this));return !wcall;img wicket:id=star src=wicket/resource/org.apache.wicket.extensions.rating.RatingPanel/star1-ver-1326919989539.gif//a The number between ...movies-_-rating... (where the underscore is) is different for each group. Is there some direct way to access information about the URL or to modify this extension to pass the record information along with it? Thanks, Daniel - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
What to add to pom.xml to use hibernate?
I'm interested in using hibernate in my wicket application, but I can't find any up to date examples combining the two. Is there something other than hibernate that the wicket community uses for ORM? If not, what can I add to the pom.xml file to include hibernate. I tried adding this: dependency groupIdorg.hibernate/groupId artifactIdhibernate/artifactId version4.0.1-Final/version /dependency but it doesn't work. I an error that it Could not resolve dependencies for project... I also attempted to add this alongside the other repository that is there. repository idjboss/id urlhttp://repository.jboss.org/maven2//url /repository I get the error about Could not resolve dependencies for project... but now many other jar files are not found. I started with the quickstart, if that helps. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
does the breadcrumb extension support bookmarkable links?
I've been working with the breadcrumb components in the extensions library today. Now that I have it working the way I need it to, I noticed that none of the links are bookmarkable. I wondered if it were possible to use this feature and still have links be bookmarkable? I did some searching and found only a handful of references to creating bookmarkable pages instead of panels, but before I went too far down that road I wanted to ask if it's possible and straight forward. Thanks, Daniel - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket on Google App Engine
Rahman, From the error that you show in your link it appears that your application can't find the WicketFilter class. Are you sure that you copied the three wicket jar files (core, util, request) to your WEB-INF/lib folder? Daniel On Fri, Jan 6, 2012 at 7:28 AM, Rahman USTA rahman.usta...@gmail.com wrote: i did Daniel's way, but when run the application, http://chopapp.com/#1gyxqdm6 2012/1/6 Hielke Hoeve hielke.ho...@topicus.nl Hey Daniel, Glad to hear you got it working as well. I have some apps on google app engine as well. Tried all the tutorials and 'useful' maven plugins but all just didn't do the trick for me. I now use maven's resources plugin to copy the resources from the maven repository to the war/lib folder. Which allows me to update/add dependencies in the pom.xml, run maven and add the dependencies in eclipse manually. I have not found a maven plugin which just adds the google sdk as dependency for me so I don't have to mess around in eclipse everytime I run maven. Did you solve that? Hielke -Original Message- From: Daniel Watrous [mailto:daniel.watr...@gmail.com] Sent: donderdag 5 januari 2012 19:35 To: users@wicket.apache.org Subject: Re: Wicket on Google App Engine Thanks for all your help. I've just posted the steps required to get current versions of wicket and gae to work together. http://software.danielwatrous.com/software-engineering/wordpress-plugin-licensing-wicket-on-google-app-engine Daniel On Thu, Jan 5, 2012 at 12:46 AM, Ernesto Reinaldo Barreiro ernesto.reina...@jweekend.com wrote: I think the class to use is http://code.google.com/p/kickat26/source/browse/trunk/src/de/kickat26/ ui/wicket/GAEModificationWatcher.java On Thu, Jan 5, 2012 at 8:31 AM, Ernesto Reinaldo Barreiro ernesto.reina...@jweekend.com wrote: You could use a modified version of resource watcher that does not use threads and modify request cycle so that watcher is executed before each request cycle. I remember there was some blog somewhere explaining this technique... Maybe it was this... http://stronglytypedblog.blogspot.com/2009/07/wicket-spring-jdo-on-go ogle-app-engine.html On Wed, Jan 4, 2012 at 11:18 PM, Daniel Watrous daniel.watr...@gmail.comwrote: I tried putting in this: getResourceSettings().setResourcePollFrequency(Duration.ONE_SECOND); But the resource still doesn't update without restarting the google app engine environment. I just tried it by running Start and that no longer updates automatically either. In the process of trying to make it work with GAE, I changed the pom.xml to have these lines in the build section directorysrc/main/webapp/WEB-INF/directory outputDirectorysrc/main/webapp/WEB-INF/classes/outputDirectory That means files are no longer placed in the target directory, but in the WEB-INF folder. Could this affect it? Have I missed another setting somewhere that relates to changing where the compiled classes are placed? Daniel On Wed, Jan 4, 2012 at 3:01 PM, Sven Meier s...@meiers.net wrote: Read here: https://cwiki.apache.org/WICKET/faqs.html#FAQs-Deployment The relevant setting is: getResourceSettings().setResourcePollFrequency(duration); Sven On 01/04/2012 10:31 PM, Daniel Watrous wrote: Great. I now have it working with either the jar download or the dependency in the pom.xml file. In the dependency xml snippet I didn't realize that I needed to manually provide the version, but after I did then it worked fine. Whenever I update a class and save it in Eclipse, that class is updated in the running server and I don't have to restart to see the changes. This is great. However, when I change an HTML page, it's not updated in the running server, so I have to restart everything. I know that when I run a quickstart app directly (using the Start class) that updates to the HTML are updated without requiring a restart. Do you know how to make it so the HTML files are updated in the live server? Thanks so much. Daniel On Wed, Jan 4, 2012 at 1:38 PM, Sven Meiers...@meiers.net wrote: With maven it's very easy, just add the dependency to your pom as suggested and forget about it. Alternatively you can download the jar form maven central manually and add it to your project: http://repo2.maven.org/maven2/org/wicketstuff/wicketstuff-gae-initia lizer/ Hope this helps Sven On 01/04/2012 09:28 PM, Daniel Watrous wrote: I'm still not sure how to create the jar file. No one is commenting on it so I feel a bit silly. Should it be obvious? Am I supposed to include the source with my project or a jar. If a jar, how should I build the jar? On Wed, Jan 4, 2012 at 1:11 PM, Sven Meiers...@meiers.net wrote: Hi, make sure you have compatible versions for Wicket
Re: Wicket on Google App Engine
Hielke, I'm not very sophisticated when it comes to Maven. I think what I go through in my tutorial is more of a brute force update of my eclipse environment so that it works with the quickstart project on GAE. I'll have a look at the resources approach you mentioned. That might simplify setup of future projects. Daniel On Fri, Jan 6, 2012 at 3:39 AM, Hielke Hoeve hielke.ho...@topicus.nl wrote: Hey Daniel, Glad to hear you got it working as well. I have some apps on google app engine as well. Tried all the tutorials and 'useful' maven plugins but all just didn't do the trick for me. I now use maven's resources plugin to copy the resources from the maven repository to the war/lib folder. Which allows me to update/add dependencies in the pom.xml, run maven and add the dependencies in eclipse manually. I have not found a maven plugin which just adds the google sdk as dependency for me so I don't have to mess around in eclipse everytime I run maven. Did you solve that? Hielke -Original Message- From: Daniel Watrous [mailto:daniel.watr...@gmail.com] Sent: donderdag 5 januari 2012 19:35 To: users@wicket.apache.org Subject: Re: Wicket on Google App Engine Thanks for all your help. I've just posted the steps required to get current versions of wicket and gae to work together. http://software.danielwatrous.com/software-engineering/wordpress-plugin-licensing-wicket-on-google-app-engine Daniel On Thu, Jan 5, 2012 at 12:46 AM, Ernesto Reinaldo Barreiro ernesto.reina...@jweekend.com wrote: I think the class to use is http://code.google.com/p/kickat26/source/browse/trunk/src/de/kickat26/ ui/wicket/GAEModificationWatcher.java On Thu, Jan 5, 2012 at 8:31 AM, Ernesto Reinaldo Barreiro ernesto.reina...@jweekend.com wrote: You could use a modified version of resource watcher that does not use threads and modify request cycle so that watcher is executed before each request cycle. I remember there was some blog somewhere explaining this technique... Maybe it was this... http://stronglytypedblog.blogspot.com/2009/07/wicket-spring-jdo-on-go ogle-app-engine.html On Wed, Jan 4, 2012 at 11:18 PM, Daniel Watrous daniel.watr...@gmail.comwrote: I tried putting in this: getResourceSettings().setResourcePollFrequency(Duration.ONE_SECOND); But the resource still doesn't update without restarting the google app engine environment. I just tried it by running Start and that no longer updates automatically either. In the process of trying to make it work with GAE, I changed the pom.xml to have these lines in the build section directorysrc/main/webapp/WEB-INF/directory outputDirectorysrc/main/webapp/WEB-INF/classes/outputDirectory That means files are no longer placed in the target directory, but in the WEB-INF folder. Could this affect it? Have I missed another setting somewhere that relates to changing where the compiled classes are placed? Daniel On Wed, Jan 4, 2012 at 3:01 PM, Sven Meier s...@meiers.net wrote: Read here: https://cwiki.apache.org/WICKET/faqs.html#FAQs-Deployment The relevant setting is: getResourceSettings().setResourcePollFrequency(duration); Sven On 01/04/2012 10:31 PM, Daniel Watrous wrote: Great. I now have it working with either the jar download or the dependency in the pom.xml file. In the dependency xml snippet I didn't realize that I needed to manually provide the version, but after I did then it worked fine. Whenever I update a class and save it in Eclipse, that class is updated in the running server and I don't have to restart to see the changes. This is great. However, when I change an HTML page, it's not updated in the running server, so I have to restart everything. I know that when I run a quickstart app directly (using the Start class) that updates to the HTML are updated without requiring a restart. Do you know how to make it so the HTML files are updated in the live server? Thanks so much. Daniel On Wed, Jan 4, 2012 at 1:38 PM, Sven Meiers...@meiers.net wrote: With maven it's very easy, just add the dependency to your pom as suggested and forget about it. Alternatively you can download the jar form maven central manually and add it to your project: http://repo2.maven.org/maven2/org/wicketstuff/wicketstuff-gae-initia lizer/ Hope this helps Sven On 01/04/2012 09:28 PM, Daniel Watrous wrote: I'm still not sure how to create the jar file. No one is commenting on it so I feel a bit silly. Should it be obvious? Am I supposed to include the source with my project or a jar. If a jar, how should I build the jar? On Wed, Jan 4, 2012 at 1:11 PM, Sven Meiers...@meiers.net wrote: Hi, make sure you have compatible versions for Wicket and gae-initializer, i.e. they should be the same. Sven On 01/04/2012 08:49 PM, Daniel Watrous wrote: I'm slowly making
Re: Wicket on Google App Engine
This time I think you didn't include the gae-initializer jar in your WEB-INF/lib directory. On Fri, Jan 6, 2012 at 8:50 AM, Rahman USTA rahman.usta...@gmail.com wrote: i handled them, but now server is giving me internal error, http://chopapp.com/#8lc105ni 2012/1/6 Daniel Watrous daniel.watr...@gmail.com Rahman, From the error that you show in your link it appears that your application can't find the WicketFilter class. Are you sure that you copied the three wicket jar files (core, util, request) to your WEB-INF/lib folder? Daniel On Fri, Jan 6, 2012 at 7:28 AM, Rahman USTA rahman.usta...@gmail.com wrote: i did Daniel's way, but when run the application, http://chopapp.com/#1gyxqdm6 2012/1/6 Hielke Hoeve hielke.ho...@topicus.nl Hey Daniel, Glad to hear you got it working as well. I have some apps on google app engine as well. Tried all the tutorials and 'useful' maven plugins but all just didn't do the trick for me. I now use maven's resources plugin to copy the resources from the maven repository to the war/lib folder. Which allows me to update/add dependencies in the pom.xml, run maven and add the dependencies in eclipse manually. I have not found a maven plugin which just adds the google sdk as dependency for me so I don't have to mess around in eclipse everytime I run maven. Did you solve that? Hielke -Original Message- From: Daniel Watrous [mailto:daniel.watr...@gmail.com] Sent: donderdag 5 januari 2012 19:35 To: users@wicket.apache.org Subject: Re: Wicket on Google App Engine Thanks for all your help. I've just posted the steps required to get current versions of wicket and gae to work together. http://software.danielwatrous.com/software-engineering/wordpress-plugin-licensing-wicket-on-google-app-engine Daniel On Thu, Jan 5, 2012 at 12:46 AM, Ernesto Reinaldo Barreiro ernesto.reina...@jweekend.com wrote: I think the class to use is http://code.google.com/p/kickat26/source/browse/trunk/src/de/kickat26/ ui/wicket/GAEModificationWatcher.java On Thu, Jan 5, 2012 at 8:31 AM, Ernesto Reinaldo Barreiro ernesto.reina...@jweekend.com wrote: You could use a modified version of resource watcher that does not use threads and modify request cycle so that watcher is executed before each request cycle. I remember there was some blog somewhere explaining this technique... Maybe it was this... http://stronglytypedblog.blogspot.com/2009/07/wicket-spring-jdo-on-go ogle-app-engine.html On Wed, Jan 4, 2012 at 11:18 PM, Daniel Watrous daniel.watr...@gmail.comwrote: I tried putting in this: getResourceSettings().setResourcePollFrequency(Duration.ONE_SECOND); But the resource still doesn't update without restarting the google app engine environment. I just tried it by running Start and that no longer updates automatically either. In the process of trying to make it work with GAE, I changed the pom.xml to have these lines in the build section directorysrc/main/webapp/WEB-INF/directory outputDirectorysrc/main/webapp/WEB-INF/classes/outputDirectory That means files are no longer placed in the target directory, but in the WEB-INF folder. Could this affect it? Have I missed another setting somewhere that relates to changing where the compiled classes are placed? Daniel On Wed, Jan 4, 2012 at 3:01 PM, Sven Meier s...@meiers.net wrote: Read here: https://cwiki.apache.org/WICKET/faqs.html#FAQs-Deployment The relevant setting is: getResourceSettings().setResourcePollFrequency(duration); Sven On 01/04/2012 10:31 PM, Daniel Watrous wrote: Great. I now have it working with either the jar download or the dependency in the pom.xml file. In the dependency xml snippet I didn't realize that I needed to manually provide the version, but after I did then it worked fine. Whenever I update a class and save it in Eclipse, that class is updated in the running server and I don't have to restart to see the changes. This is great. However, when I change an HTML page, it's not updated in the running server, so I have to restart everything. I know that when I run a quickstart app directly (using the Start class) that updates to the HTML are updated without requiring a restart. Do you know how to make it so the HTML files are updated in the live server? Thanks so much. Daniel On Wed, Jan 4, 2012 at 1:38 PM, Sven Meiers...@meiers.net wrote: With maven it's very easy, just add the dependency to your pom as suggested and forget about it. Alternatively you can download the jar form maven central manually and add it to your project: http://repo2.maven.org/maven2/org/wicketstuff/wicketstuff-gae-initia lizer
Re: Wicket on Google App Engine
You might be clever enough to do it in maven. I wasn't, so I added the jar files like I show in my tutorial. On Fri, Jan 6, 2012 at 8:55 AM, Rahman USTA rahman.usta...@gmail.com wrote: i did it in pom.xml, why must i add jars to lib manually? cant i do it with maven? 2012/1/6 Daniel Watrous daniel.watr...@gmail.com This time I think you didn't include the gae-initializer jar in your WEB-INF/lib directory. On Fri, Jan 6, 2012 at 8:50 AM, Rahman USTA rahman.usta...@gmail.com wrote: i handled them, but now server is giving me internal error, http://chopapp.com/#8lc105ni 2012/1/6 Daniel Watrous daniel.watr...@gmail.com Rahman, From the error that you show in your link it appears that your application can't find the WicketFilter class. Are you sure that you copied the three wicket jar files (core, util, request) to your WEB-INF/lib folder? Daniel On Fri, Jan 6, 2012 at 7:28 AM, Rahman USTA rahman.usta...@gmail.com wrote: i did Daniel's way, but when run the application, http://chopapp.com/#1gyxqdm6 2012/1/6 Hielke Hoeve hielke.ho...@topicus.nl Hey Daniel, Glad to hear you got it working as well. I have some apps on google app engine as well. Tried all the tutorials and 'useful' maven plugins but all just didn't do the trick for me. I now use maven's resources plugin to copy the resources from the maven repository to the war/lib folder. Which allows me to update/add dependencies in the pom.xml, run maven and add the dependencies in eclipse manually. I have not found a maven plugin which just adds the google sdk as dependency for me so I don't have to mess around in eclipse everytime I run maven. Did you solve that? Hielke -Original Message- From: Daniel Watrous [mailto:daniel.watr...@gmail.com] Sent: donderdag 5 januari 2012 19:35 To: users@wicket.apache.org Subject: Re: Wicket on Google App Engine Thanks for all your help. I've just posted the steps required to get current versions of wicket and gae to work together. http://software.danielwatrous.com/software-engineering/wordpress-plugin-licensing-wicket-on-google-app-engine Daniel On Thu, Jan 5, 2012 at 12:46 AM, Ernesto Reinaldo Barreiro ernesto.reina...@jweekend.com wrote: I think the class to use is http://code.google.com/p/kickat26/source/browse/trunk/src/de/kickat26/ ui/wicket/GAEModificationWatcher.java On Thu, Jan 5, 2012 at 8:31 AM, Ernesto Reinaldo Barreiro ernesto.reina...@jweekend.com wrote: You could use a modified version of resource watcher that does not use threads and modify request cycle so that watcher is executed before each request cycle. I remember there was some blog somewhere explaining this technique... Maybe it was this... http://stronglytypedblog.blogspot.com/2009/07/wicket-spring-jdo-on-go ogle-app-engine.html On Wed, Jan 4, 2012 at 11:18 PM, Daniel Watrous daniel.watr...@gmail.comwrote: I tried putting in this: getResourceSettings().setResourcePollFrequency(Duration.ONE_SECOND); But the resource still doesn't update without restarting the google app engine environment. I just tried it by running Start and that no longer updates automatically either. In the process of trying to make it work with GAE, I changed the pom.xml to have these lines in the build section directorysrc/main/webapp/WEB-INF/directory outputDirectorysrc/main/webapp/WEB-INF/classes/outputDirectory That means files are no longer placed in the target directory, but in the WEB-INF folder. Could this affect it? Have I missed another setting somewhere that relates to changing where the compiled classes are placed? Daniel On Wed, Jan 4, 2012 at 3:01 PM, Sven Meier s...@meiers.net wrote: Read here: https://cwiki.apache.org/WICKET/faqs.html#FAQs-Deployment The relevant setting is: getResourceSettings().setResourcePollFrequency(duration); Sven On 01/04/2012 10:31 PM, Daniel Watrous wrote: Great. I now have it working with either the jar download or the dependency in the pom.xml file. In the dependency xml snippet I didn't realize that I needed to manually provide the version, but after I did then it worked fine. Whenever I update a class and save it in Eclipse, that class is updated in the running server and I don't have to restart to see the changes. This is great. However, when I change an HTML page, it's not updated in the running server, so I have to restart everything. I know that when I run a quickstart app directly (using the Start class) that updates to the HTML are updated without requiring a restart. Do you know how to make it so the HTML
Re: Wicket on Google App Engine
Rahman, Are you following my tutorial or are you trying to adapt it to work some other way. I have to admit that I'm not very savvy when it comes to Maven and I like the eclipse environment well enough. The Eclipse + GAE plugin makes development easy. Maybe I should be embarrassed to say that it took me three days to finally get wicket going on GAE and the result of that is the tutorial I put together. If you have something in mind other than what I documented then I'm not going to be much help. Daniel On Fri, Jan 6, 2012 at 9:00 AM, Rahman USTA rahman.usta...@gmail.com wrote: Now, http://chopapp.com/#7pmdaqmd 2012/1/6 Rahman USTA rahman.usta...@gmail.com i did it in pom.xml, why must i add jars to lib manually? cant i do it with maven? 2012/1/6 Daniel Watrous daniel.watr...@gmail.com This time I think you didn't include the gae-initializer jar in your WEB-INF/lib directory. On Fri, Jan 6, 2012 at 8:50 AM, Rahman USTA rahman.usta...@gmail.com wrote: i handled them, but now server is giving me internal error, http://chopapp.com/#8lc105ni 2012/1/6 Daniel Watrous daniel.watr...@gmail.com Rahman, From the error that you show in your link it appears that your application can't find the WicketFilter class. Are you sure that you copied the three wicket jar files (core, util, request) to your WEB-INF/lib folder? Daniel On Fri, Jan 6, 2012 at 7:28 AM, Rahman USTA rahman.usta...@gmail.com wrote: i did Daniel's way, but when run the application, http://chopapp.com/#1gyxqdm6 2012/1/6 Hielke Hoeve hielke.ho...@topicus.nl Hey Daniel, Glad to hear you got it working as well. I have some apps on google app engine as well. Tried all the tutorials and 'useful' maven plugins but all just didn't do the trick for me. I now use maven's resources plugin to copy the resources from the maven repository to the war/lib folder. Which allows me to update/add dependencies in the pom.xml, run maven and add the dependencies in eclipse manually. I have not found a maven plugin which just adds the google sdk as dependency for me so I don't have to mess around in eclipse everytime I run maven. Did you solve that? Hielke -Original Message- From: Daniel Watrous [mailto:daniel.watr...@gmail.com] Sent: donderdag 5 januari 2012 19:35 To: users@wicket.apache.org Subject: Re: Wicket on Google App Engine Thanks for all your help. I've just posted the steps required to get current versions of wicket and gae to work together. http://software.danielwatrous.com/software-engineering/wordpress-plugin-licensing-wicket-on-google-app-engine Daniel On Thu, Jan 5, 2012 at 12:46 AM, Ernesto Reinaldo Barreiro ernesto.reina...@jweekend.com wrote: I think the class to use is http://code.google.com/p/kickat26/source/browse/trunk/src/de/kickat26/ ui/wicket/GAEModificationWatcher.java On Thu, Jan 5, 2012 at 8:31 AM, Ernesto Reinaldo Barreiro ernesto.reina...@jweekend.com wrote: You could use a modified version of resource watcher that does not use threads and modify request cycle so that watcher is executed before each request cycle. I remember there was some blog somewhere explaining this technique... Maybe it was this... http://stronglytypedblog.blogspot.com/2009/07/wicket-spring-jdo-on-go ogle-app-engine.html On Wed, Jan 4, 2012 at 11:18 PM, Daniel Watrous daniel.watr...@gmail.comwrote: I tried putting in this: getResourceSettings().setResourcePollFrequency(Duration.ONE_SECOND); But the resource still doesn't update without restarting the google app engine environment. I just tried it by running Start and that no longer updates automatically either. In the process of trying to make it work with GAE, I changed the pom.xml to have these lines in the build section directorysrc/main/webapp/WEB-INF/directory outputDirectorysrc/main/webapp/WEB-INF/classes/outputDirectory That means files are no longer placed in the target directory, but in the WEB-INF folder. Could this affect it? Have I missed another setting somewhere that relates to changing where the compiled classes are placed? Daniel On Wed, Jan 4, 2012 at 3:01 PM, Sven Meier s...@meiers.net wrote: Read here: https://cwiki.apache.org/WICKET/faqs.html#FAQs-Deployment The relevant setting is: getResourceSettings().setResourcePollFrequency(duration); Sven On 01/04/2012 10:31 PM, Daniel Watrous wrote: Great. I now have it working with either the jar download or the dependency in the pom.xml file. In the dependency xml snippet I didn't realize that I needed to manually provide the version, but after I did then it worked fine
Re: Wicket on Google App Engine
Thanks for all your help. I've just posted the steps required to get current versions of wicket and gae to work together. http://software.danielwatrous.com/software-engineering/wordpress-plugin-licensing-wicket-on-google-app-engine Daniel On Thu, Jan 5, 2012 at 12:46 AM, Ernesto Reinaldo Barreiro ernesto.reina...@jweekend.com wrote: I think the class to use is http://code.google.com/p/kickat26/source/browse/trunk/src/de/kickat26/ui/wicket/GAEModificationWatcher.java On Thu, Jan 5, 2012 at 8:31 AM, Ernesto Reinaldo Barreiro ernesto.reina...@jweekend.com wrote: You could use a modified version of resource watcher that does not use threads and modify request cycle so that watcher is executed before each request cycle. I remember there was some blog somewhere explaining this technique... Maybe it was this... http://stronglytypedblog.blogspot.com/2009/07/wicket-spring-jdo-on-google-app-engine.html On Wed, Jan 4, 2012 at 11:18 PM, Daniel Watrous daniel.watr...@gmail.comwrote: I tried putting in this: getResourceSettings().setResourcePollFrequency(Duration.ONE_SECOND); But the resource still doesn't update without restarting the google app engine environment. I just tried it by running Start and that no longer updates automatically either. In the process of trying to make it work with GAE, I changed the pom.xml to have these lines in the build section directorysrc/main/webapp/WEB-INF/directory outputDirectorysrc/main/webapp/WEB-INF/classes/outputDirectory That means files are no longer placed in the target directory, but in the WEB-INF folder. Could this affect it? Have I missed another setting somewhere that relates to changing where the compiled classes are placed? Daniel On Wed, Jan 4, 2012 at 3:01 PM, Sven Meier s...@meiers.net wrote: Read here: https://cwiki.apache.org/WICKET/faqs.html#FAQs-Deployment The relevant setting is: getResourceSettings().setResourcePollFrequency(duration); Sven On 01/04/2012 10:31 PM, Daniel Watrous wrote: Great. I now have it working with either the jar download or the dependency in the pom.xml file. In the dependency xml snippet I didn't realize that I needed to manually provide the version, but after I did then it worked fine. Whenever I update a class and save it in Eclipse, that class is updated in the running server and I don't have to restart to see the changes. This is great. However, when I change an HTML page, it's not updated in the running server, so I have to restart everything. I know that when I run a quickstart app directly (using the Start class) that updates to the HTML are updated without requiring a restart. Do you know how to make it so the HTML files are updated in the live server? Thanks so much. Daniel On Wed, Jan 4, 2012 at 1:38 PM, Sven Meiers...@meiers.net wrote: With maven it's very easy, just add the dependency to your pom as suggested and forget about it. Alternatively you can download the jar form maven central manually and add it to your project: http://repo2.maven.org/maven2/org/wicketstuff/wicketstuff-gae-initializer/ Hope this helps Sven On 01/04/2012 09:28 PM, Daniel Watrous wrote: I'm still not sure how to create the jar file. No one is commenting on it so I feel a bit silly. Should it be obvious? Am I supposed to include the source with my project or a jar. If a jar, how should I build the jar? On Wed, Jan 4, 2012 at 1:11 PM, Sven Meiers...@meiers.net wrote: Hi, make sure you have compatible versions for Wicket and gae-initializer, i.e. they should be the same. Sven On 01/04/2012 08:49 PM, Daniel Watrous wrote: I'm slowly making progress. I see now that what Sven replied with goes in the pom.xml. What I'm not sure of is if I still need a jar file or the source as part of my project. I have made the update to my pom.xml, and I'm now getting this error when I attempt to run my application: java.lang.NoClassDefFoundError: org/apache/wicket/pageStore/memory/IDataStoreEvictionStrategy at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Unknown Source) at java.lang.Class.getConstructor0(Unknown Source) at java.lang.Class.getDeclaredConstructor(Unknown Source) at com.google.appengine.tools.development.agent.runtime.Runtime$2.run(Runtime.java:133) at com.google.appengine.tools.development.agent.runtime.Runtime$2.run(Runtime.java:131) at java.security.AccessController.doPrivileged(Native Method) at com.google.appengine.tools.development.agent.runtime.Runtime.newInstance(Runtime.java:130) at org.apache.wicket.util.lang.WicketObjects.newInstance(WicketObjects.java:377) at org.apache.wicket.Application.addInitializer(Application.java:577
Re: Wicket on Google App Engine
How do I create the gae-initializer.jar? I have run mvn compile and generated the class files. I can zip those up, but I'm not sure if there should be a META-INF folder and what it should have. Daniel On Wed, Jan 4, 2012 at 12:21 AM, Martin Grigorov mgrigo...@apache.org wrote: Hi, gae-initializer project provides https://github.com/wicketstuff/core/blob/master/jdk-1.6-parent/gae-initializer-parent/gae-initializer/src/main/java/org/wicketstuff/gae/GaeInitializer.java which is an implementation of org.apache.wicket.IInitializer and declares it in https://github.com/wicketstuff/core/blob/master/jdk-1.6-parent/gae-initializer-parent/gae-initializer/src/main/resources/wicket.properties. That means that when gae-initializer.jar is in the classpath Wicket will use it to initialize the Application instance. Check the source of GaeInitializer.jar to see what exactly it configures. On Wed, Jan 4, 2012 at 1:52 AM, Daniel Watrous daniel.watr...@gmail.com wrote: Hi, I've been working for a few days to get a wicket application going for Google App Engine with mixed results. I hope these questions aren't too noobie for this list? There are a couple of really old articles which Google brings up first: http://stronglytypedblog.blogspot.com/2009/04/wicket-on-google-app-engine.html http://www.danwalmsley.com/2009/04/08/apache-wicket-on-google-app-engine-for-java/ I've also found this resource after digging through the wicket users list, but I can't figure out how I'm supposed to use it: https://github.com/wicketstuff/core/tree/master/jdk-1.6-parent/gae-initializer-parent I'm using eclipse with the GAE plugin. So far this is what I have accomplished. 1) the first link above provides a download demo as an eclipse project. I can get this to run, but it's working with old versions (wicket 1.3.5, appengine sdk 1.2.0). I haven't successfully updated. 2) I can create a new google app engine project in eclipse. It runs fine and I can develop servlets. 3) I can user the maven build script from the quickstart to get a functional wicket project. I'm really struggling trying to figure out how to use the gae-initializer or a base GAE project from eclipse and end up with a functional wicket application... I'm not sure what other information to include at this point. Please share any pointers or links to other tutorials that might help me. Daniel - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.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: Wicket on Google App Engine
Also, where do I put the wicket.properties file, and do I need to update any xml files to indicate that there is a wicket.properties file On Wed, Jan 4, 2012 at 11:30 AM, Daniel Watrous daniel.watr...@gmail.com wrote: How do I create the gae-initializer.jar? I have run mvn compile and generated the class files. I can zip those up, but I'm not sure if there should be a META-INF folder and what it should have. Daniel On Wed, Jan 4, 2012 at 12:21 AM, Martin Grigorov mgrigo...@apache.org wrote: Hi, gae-initializer project provides https://github.com/wicketstuff/core/blob/master/jdk-1.6-parent/gae-initializer-parent/gae-initializer/src/main/java/org/wicketstuff/gae/GaeInitializer.java which is an implementation of org.apache.wicket.IInitializer and declares it in https://github.com/wicketstuff/core/blob/master/jdk-1.6-parent/gae-initializer-parent/gae-initializer/src/main/resources/wicket.properties. That means that when gae-initializer.jar is in the classpath Wicket will use it to initialize the Application instance. Check the source of GaeInitializer.jar to see what exactly it configures. On Wed, Jan 4, 2012 at 1:52 AM, Daniel Watrous daniel.watr...@gmail.com wrote: Hi, I've been working for a few days to get a wicket application going for Google App Engine with mixed results. I hope these questions aren't too noobie for this list? There are a couple of really old articles which Google brings up first: http://stronglytypedblog.blogspot.com/2009/04/wicket-on-google-app-engine.html http://www.danwalmsley.com/2009/04/08/apache-wicket-on-google-app-engine-for-java/ I've also found this resource after digging through the wicket users list, but I can't figure out how I'm supposed to use it: https://github.com/wicketstuff/core/tree/master/jdk-1.6-parent/gae-initializer-parent I'm using eclipse with the GAE plugin. So far this is what I have accomplished. 1) the first link above provides a download demo as an eclipse project. I can get this to run, but it's working with old versions (wicket 1.3.5, appengine sdk 1.2.0). I haven't successfully updated. 2) I can create a new google app engine project in eclipse. It runs fine and I can develop servlets. 3) I can user the maven build script from the quickstart to get a functional wicket project. I'm really struggling trying to figure out how to use the gae-initializer or a base GAE project from eclipse and end up with a functional wicket application... I'm not sure what other information to include at this point. Please share any pointers or links to other tutorials that might help me. Daniel - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.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: Wicket on Google App Engine
Is that the same thing as adding the jar file to the build path in eclipse? How do I build gae-initializer.jar? I tried running 'mvn jar', but it gave an error about unknown lifecycle phase. Daniel On Wed, Jan 4, 2012 at 11:38 AM, Sven Meier s...@meiers.net wrote: Hi Daniel, you just have to add the gae-initializer as a dependency to your project: dependency groupIdorg.wicketstuff/groupId artifactIdwicketstuff-gae-initializer/artifactId version${wicket.version}/version /dependency That's all. Sven On 01/04/2012 07:35 PM, Daniel Watrous wrote: Also, where do I put the wicket.properties file, and do I need to update any xml files to indicate that there is a wicket.properties file On Wed, Jan 4, 2012 at 11:30 AM, Daniel Watrous daniel.watr...@gmail.com wrote: How do I create the gae-initializer.jar? I have run mvn compile and generated the class files. I can zip those up, but I'm not sure if there should be a META-INF folder and what it should have. Daniel On Wed, Jan 4, 2012 at 12:21 AM, Martin Grigorovmgrigo...@apache.org wrote: Hi, gae-initializer project provides https://github.com/wicketstuff/core/blob/master/jdk-1.6-parent/gae-initializer-parent/gae-initializer/src/main/java/org/wicketstuff/gae/GaeInitializer.java which is an implementation of org.apache.wicket.IInitializer and declares it in https://github.com/wicketstuff/core/blob/master/jdk-1.6-parent/gae-initializer-parent/gae-initializer/src/main/resources/wicket.properties. That means that when gae-initializer.jar is in the classpath Wicket will use it to initialize the Application instance. Check the source of GaeInitializer.jar to see what exactly it configures. On Wed, Jan 4, 2012 at 1:52 AM, Daniel Watrousdaniel.watr...@gmail.com wrote: Hi, I've been working for a few days to get a wicket application going for Google App Engine with mixed results. I hope these questions aren't too noobie for this list? There are a couple of really old articles which Google brings up first: http://stronglytypedblog.blogspot.com/2009/04/wicket-on-google-app-engine.html http://www.danwalmsley.com/2009/04/08/apache-wicket-on-google-app-engine-for-java/ I've also found this resource after digging through the wicket users list, but I can't figure out how I'm supposed to use it: https://github.com/wicketstuff/core/tree/master/jdk-1.6-parent/gae-initializer-parent I'm using eclipse with the GAE plugin. So far this is what I have accomplished. 1) the first link above provides a download demo as an eclipse project. I can get this to run, but it's working with old versions (wicket 1.3.5, appengine sdk 1.2.0). I haven't successfully updated. 2) I can create a new google app engine project in eclipse. It runs fine and I can develop servlets. 3) I can user the maven build script from the quickstart to get a functional wicket project. I'm really struggling trying to figure out how to use the gae-initializer or a base GAE project from eclipse and end up with a functional wicket application... I'm not sure what other information to include at this point. Please share any pointers or links to other tutorials that might help me. Daniel - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.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 - 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: Wicket on Google App Engine
I'm slowly making progress. I see now that what Sven replied with goes in the pom.xml. What I'm not sure of is if I still need a jar file or the source as part of my project. I have made the update to my pom.xml, and I'm now getting this error when I attempt to run my application: java.lang.NoClassDefFoundError: org/apache/wicket/pageStore/memory/IDataStoreEvictionStrategy at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Unknown Source) at java.lang.Class.getConstructor0(Unknown Source) at java.lang.Class.getDeclaredConstructor(Unknown Source) at com.google.appengine.tools.development.agent.runtime.Runtime$2.run(Runtime.java:133) at com.google.appengine.tools.development.agent.runtime.Runtime$2.run(Runtime.java:131) at java.security.AccessController.doPrivileged(Native Method) at com.google.appengine.tools.development.agent.runtime.Runtime.newInstance(Runtime.java:130) at org.apache.wicket.util.lang.WicketObjects.newInstance(WicketObjects.java:377) at org.apache.wicket.Application.addInitializer(Application.java:577) at org.apache.wicket.Application.load(Application.java:615) at org.apache.wicket.Application.initializeComponents(Application.java:501) at org.apache.wicket.Application.initApplication(Application.java:808) at org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:346) at org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:286) at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:662) at org.mortbay.jetty.servlet.Context.startContext(Context.java:140) at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250) at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517) at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) at org.mortbay.jetty.Server.doStart(Server.java:224) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at com.google.appengine.tools.development.JettyContainerService.startContainer(JettyContainerService.java:191) at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:239) at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:146) at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:164) at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48) at com.google.appengine.tools.development.DevAppServerMain.init(DevAppServerMain.java:113) at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:89) Caused by: java.lang.ClassNotFoundException: org.apache.wicket.pageStore.memory.IDataStoreEvictionStrategy at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at com.google.appengine.tools.development.IsolatedAppClassLoader.loadClass(IsolatedAppClassLoader.java:176) at java.lang.ClassLoader.loadClass(Unknown Source) ... 35 more Since gae-initializer did compile when I compiled with maven I also tried simply putting the compile classes next to my other classes for the deployment, but it still gives this error. Thanks for all your help. Daniel On Wed, Jan 4, 2012 at 11:45 AM, Daniel Watrous daniel.watr...@gmail.com wrote: Is that the same thing as adding the jar file to the build path in eclipse? How do I build gae-initializer.jar? I tried running 'mvn jar', but it gave an error about unknown lifecycle phase. Daniel On Wed, Jan 4, 2012 at 11:38 AM, Sven Meier s...@meiers.net wrote: Hi Daniel, you just have to add the gae-initializer as a dependency to your project: dependency groupIdorg.wicketstuff/groupId artifactIdwicketstuff-gae-initializer/artifactId version${wicket.version}/version /dependency That's all. Sven On 01/04/2012 07:35 PM, Daniel Watrous wrote: Also, where do I put the wicket.properties file, and do I need to update any xml files to indicate that there is a wicket.properties file On Wed, Jan 4, 2012 at 11:30 AM
Re: Wicket on Google App Engine
I'm still not sure how to create the jar file. No one is commenting on it so I feel a bit silly. Should it be obvious? Am I supposed to include the source with my project or a jar. If a jar, how should I build the jar? On Wed, Jan 4, 2012 at 1:11 PM, Sven Meier s...@meiers.net wrote: Hi, make sure you have compatible versions for Wicket and gae-initializer, i.e. they should be the same. Sven On 01/04/2012 08:49 PM, Daniel Watrous wrote: I'm slowly making progress. I see now that what Sven replied with goes in the pom.xml. What I'm not sure of is if I still need a jar file or the source as part of my project. I have made the update to my pom.xml, and I'm now getting this error when I attempt to run my application: java.lang.NoClassDefFoundError: org/apache/wicket/pageStore/memory/IDataStoreEvictionStrategy at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Unknown Source) at java.lang.Class.getConstructor0(Unknown Source) at java.lang.Class.getDeclaredConstructor(Unknown Source) at com.google.appengine.tools.development.agent.runtime.Runtime$2.run(Runtime.java:133) at com.google.appengine.tools.development.agent.runtime.Runtime$2.run(Runtime.java:131) at java.security.AccessController.doPrivileged(Native Method) at com.google.appengine.tools.development.agent.runtime.Runtime.newInstance(Runtime.java:130) at org.apache.wicket.util.lang.WicketObjects.newInstance(WicketObjects.java:377) at org.apache.wicket.Application.addInitializer(Application.java:577) at org.apache.wicket.Application.load(Application.java:615) at org.apache.wicket.Application.initializeComponents(Application.java:501) at org.apache.wicket.Application.initApplication(Application.java:808) at org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:346) at org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:286) at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:662) at org.mortbay.jetty.servlet.Context.startContext(Context.java:140) at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250) at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517) at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) at org.mortbay.jetty.Server.doStart(Server.java:224) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at com.google.appengine.tools.development.JettyContainerService.startContainer(JettyContainerService.java:191) at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:239) at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:146) at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:164) at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48) at com.google.appengine.tools.development.DevAppServerMain.init(DevAppServerMain.java:113) at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:89) Caused by: java.lang.ClassNotFoundException: org.apache.wicket.pageStore.memory.IDataStoreEvictionStrategy at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at com.google.appengine.tools.development.IsolatedAppClassLoader.loadClass(IsolatedAppClassLoader.java:176) at java.lang.ClassLoader.loadClass(Unknown Source) ... 35 more Since gae-initializer did compile when I compiled with maven I also tried simply putting the compile classes next to my other classes for the deployment, but it still gives this error. Thanks for all your help. Daniel On Wed, Jan 4, 2012 at 11:45 AM, Daniel Watrous daniel.watr...@gmail.com wrote: Is that the same thing as adding the jar file to the build path in eclipse? How do I build gae-initializer.jar? I tried running 'mvn jar', but it gave an error about unknown lifecycle phase. Daniel On Wed, Jan 4, 2012 at 11:38 AM, Sven Meiers...@meiers.net wrote
Re: Wicket on Google App Engine
Great. I now have it working with either the jar download or the dependency in the pom.xml file. In the dependency xml snippet I didn't realize that I needed to manually provide the version, but after I did then it worked fine. Whenever I update a class and save it in Eclipse, that class is updated in the running server and I don't have to restart to see the changes. This is great. However, when I change an HTML page, it's not updated in the running server, so I have to restart everything. I know that when I run a quickstart app directly (using the Start class) that updates to the HTML are updated without requiring a restart. Do you know how to make it so the HTML files are updated in the live server? Thanks so much. Daniel On Wed, Jan 4, 2012 at 1:38 PM, Sven Meier s...@meiers.net wrote: With maven it's very easy, just add the dependency to your pom as suggested and forget about it. Alternatively you can download the jar form maven central manually and add it to your project: http://repo2.maven.org/maven2/org/wicketstuff/wicketstuff-gae-initializer/ Hope this helps Sven On 01/04/2012 09:28 PM, Daniel Watrous wrote: I'm still not sure how to create the jar file. No one is commenting on it so I feel a bit silly. Should it be obvious? Am I supposed to include the source with my project or a jar. If a jar, how should I build the jar? On Wed, Jan 4, 2012 at 1:11 PM, Sven Meiers...@meiers.net wrote: Hi, make sure you have compatible versions for Wicket and gae-initializer, i.e. they should be the same. Sven On 01/04/2012 08:49 PM, Daniel Watrous wrote: I'm slowly making progress. I see now that what Sven replied with goes in the pom.xml. What I'm not sure of is if I still need a jar file or the source as part of my project. I have made the update to my pom.xml, and I'm now getting this error when I attempt to run my application: java.lang.NoClassDefFoundError: org/apache/wicket/pageStore/memory/IDataStoreEvictionStrategy at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Unknown Source) at java.lang.Class.getConstructor0(Unknown Source) at java.lang.Class.getDeclaredConstructor(Unknown Source) at com.google.appengine.tools.development.agent.runtime.Runtime$2.run(Runtime.java:133) at com.google.appengine.tools.development.agent.runtime.Runtime$2.run(Runtime.java:131) at java.security.AccessController.doPrivileged(Native Method) at com.google.appengine.tools.development.agent.runtime.Runtime.newInstance(Runtime.java:130) at org.apache.wicket.util.lang.WicketObjects.newInstance(WicketObjects.java:377) at org.apache.wicket.Application.addInitializer(Application.java:577) at org.apache.wicket.Application.load(Application.java:615) at org.apache.wicket.Application.initializeComponents(Application.java:501) at org.apache.wicket.Application.initApplication(Application.java:808) at org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:346) at org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:286) at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:662) at org.mortbay.jetty.servlet.Context.startContext(Context.java:140) at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250) at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517) at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) at org.mortbay.jetty.Server.doStart(Server.java:224) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at com.google.appengine.tools.development.JettyContainerService.startContainer(JettyContainerService.java:191) at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:239) at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:146) at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:164) at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48) at com.google.appengine.tools.development.DevAppServerMain.init(DevAppServerMain.java:113
Re: Wicket on Google App Engine
I tried putting in this: getResourceSettings().setResourcePollFrequency(Duration.ONE_SECOND); But the resource still doesn't update without restarting the google app engine environment. I just tried it by running Start and that no longer updates automatically either. In the process of trying to make it work with GAE, I changed the pom.xml to have these lines in the build section directorysrc/main/webapp/WEB-INF/directory outputDirectorysrc/main/webapp/WEB-INF/classes/outputDirectory That means files are no longer placed in the target directory, but in the WEB-INF folder. Could this affect it? Have I missed another setting somewhere that relates to changing where the compiled classes are placed? Daniel On Wed, Jan 4, 2012 at 3:01 PM, Sven Meier s...@meiers.net wrote: Read here: https://cwiki.apache.org/WICKET/faqs.html#FAQs-Deployment The relevant setting is: getResourceSettings().setResourcePollFrequency(duration); Sven On 01/04/2012 10:31 PM, Daniel Watrous wrote: Great. I now have it working with either the jar download or the dependency in the pom.xml file. In the dependency xml snippet I didn't realize that I needed to manually provide the version, but after I did then it worked fine. Whenever I update a class and save it in Eclipse, that class is updated in the running server and I don't have to restart to see the changes. This is great. However, when I change an HTML page, it's not updated in the running server, so I have to restart everything. I know that when I run a quickstart app directly (using the Start class) that updates to the HTML are updated without requiring a restart. Do you know how to make it so the HTML files are updated in the live server? Thanks so much. Daniel On Wed, Jan 4, 2012 at 1:38 PM, Sven Meiers...@meiers.net wrote: With maven it's very easy, just add the dependency to your pom as suggested and forget about it. Alternatively you can download the jar form maven central manually and add it to your project: http://repo2.maven.org/maven2/org/wicketstuff/wicketstuff-gae-initializer/ Hope this helps Sven On 01/04/2012 09:28 PM, Daniel Watrous wrote: I'm still not sure how to create the jar file. No one is commenting on it so I feel a bit silly. Should it be obvious? Am I supposed to include the source with my project or a jar. If a jar, how should I build the jar? On Wed, Jan 4, 2012 at 1:11 PM, Sven Meiers...@meiers.net wrote: Hi, make sure you have compatible versions for Wicket and gae-initializer, i.e. they should be the same. Sven On 01/04/2012 08:49 PM, Daniel Watrous wrote: I'm slowly making progress. I see now that what Sven replied with goes in the pom.xml. What I'm not sure of is if I still need a jar file or the source as part of my project. I have made the update to my pom.xml, and I'm now getting this error when I attempt to run my application: java.lang.NoClassDefFoundError: org/apache/wicket/pageStore/memory/IDataStoreEvictionStrategy at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Unknown Source) at java.lang.Class.getConstructor0(Unknown Source) at java.lang.Class.getDeclaredConstructor(Unknown Source) at com.google.appengine.tools.development.agent.runtime.Runtime$2.run(Runtime.java:133) at com.google.appengine.tools.development.agent.runtime.Runtime$2.run(Runtime.java:131) at java.security.AccessController.doPrivileged(Native Method) at com.google.appengine.tools.development.agent.runtime.Runtime.newInstance(Runtime.java:130) at org.apache.wicket.util.lang.WicketObjects.newInstance(WicketObjects.java:377) at org.apache.wicket.Application.addInitializer(Application.java:577) at org.apache.wicket.Application.load(Application.java:615) at org.apache.wicket.Application.initializeComponents(Application.java:501) at org.apache.wicket.Application.initApplication(Application.java:808) at org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:346) at org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:286) at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:662) at org.mortbay.jetty.servlet.Context.startContext(Context.java:140) at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250) at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517) at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50
Handling POST, PUT and DELETE from a resource
I'm building a web service and I wonder if there's some way to detect and do something unique when calling a ResourceReference with different HTTP methods. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Handling POST, PUT and DELETE from a resource
That's a fantastic answer. I'll look at other solutions. Daniel On Wed, Jan 4, 2012 at 7:03 PM, 7zark7 7za...@gmail.com wrote: I know these sort of replies are annoying, but I don't think Wicket is a good choice for handling web service calls - it's pretty easy to map other paths to servlets or other handlers that better deal with PUT, DELETE, etc. -- Anh My Sent with Sparrow (http://www.sparrowmailapp.com/?sig) On Wednesday, January 4, 2012 at 3:49 PM, Daniel Watrous wrote: I'm building a web service and I wonder if there's some way to detect and do something unique when calling a ResourceReference with different HTTP methods. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org (mailto:users-unsubscr...@wicket.apache.org) For additional commands, e-mail: users-h...@wicket.apache.org (mailto: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 on Google App Engine
Hi, I've been working for a few days to get a wicket application going for Google App Engine with mixed results. I hope these questions aren't too noobie for this list? There are a couple of really old articles which Google brings up first: http://stronglytypedblog.blogspot.com/2009/04/wicket-on-google-app-engine.html http://www.danwalmsley.com/2009/04/08/apache-wicket-on-google-app-engine-for-java/ I've also found this resource after digging through the wicket users list, but I can't figure out how I'm supposed to use it: https://github.com/wicketstuff/core/tree/master/jdk-1.6-parent/gae-initializer-parent I'm using eclipse with the GAE plugin. So far this is what I have accomplished. 1) the first link above provides a download demo as an eclipse project. I can get this to run, but it's working with old versions (wicket 1.3.5, appengine sdk 1.2.0). I haven't successfully updated. 2) I can create a new google app engine project in eclipse. It runs fine and I can develop servlets. 3) I can user the maven build script from the quickstart to get a functional wicket project. I'm really struggling trying to figure out how to use the gae-initializer or a base GAE project from eclipse and end up with a functional wicket application... I'm not sure what other information to include at this point. Please share any pointers or links to other tutorials that might help me. Daniel - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Throwing RestartResponseException within RequestCycleListener [1.5 - incl. quickstart]
) at org.eclipse.jetty.io.UncheckedPrintWriter.write(UncheckedPrintWriter.java:274) ... 36 more On 14.12.2011 15:28, Martin Grigorov wrote: Hi, No need to throw exceptions. You just need to return IRequestHandler impl that should be used to handle the error (I assume you talk about IRequestCycleListener#onException()) Try with: return new RenderPageRequestHandler(new PageProvider(SomePage.class)) On Wed, Dec 14, 2011 at 4:20 PM, Daniel Soneira daniel.sone...@joyn-it.at wrote: Hi there, Throwing a RestartResponseException in a custom RequestCycleListener does not yield the result I was hoping for. Instead of redirecting to the specified page the DefaultExceptionMapper only shows an Unexpected RuntimeException page. The equivalent code (within a custom RequestCycle) used to work in 1.4. Here's the log: ERROR - DefaultExceptionMapper - Unexpected error occurred org.apache.wicket.RestartResponseException The listener tries do redirect the very FIRST request - so you have to restart the jetty server when analyzing the problem. Attached you'll find a quickstart that demonstrates the problem. Note: The code is essentially the same as in WICKET-3248. Any help on this matter is appreciated. I can also create a JIRA issue if needed. Kind regards, Daniel Soneira -- www.joyn-it.at - 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: Throwing RestartResponseException within RequestCycleListener [1.5 - incl. quickstart]
OK, I've managed to get rid of all exceptions that were logged. Here's the working code: @Override public void onBeginRequest(RequestCycle cycle) { Session session = Session.get(); if (session.getMetaData(REDIRECTED_JSESSIONID) == null) { logger.debug(first application request - redirecting to loading page); session.setMetaData(REDIRECTED_JSESSIONID, Boolean.TRUE); String url = getServletRequestContextPath() + / + cycle.getRequest().getUrl(); cycle.replaceAllRequestHandlers(new RenderPageRequestHandler(new PageProvider(newLoadingPage(url)), RedirectPolicy.ALWAYS_REDIRECT)); cycle.getResponse().reset(); } } It sure is MORE code than the previous one-liner (throwing the exception). If the user should not use a RestartResponseException within a RequestCycleListener in 1.5 any more (since it worked in 1.4) I suggest this to be stated in its JavaDoc. I'm also not sure in which cases it _IS_ considered to be OK to do so?! Cheers, Daniel - - - - - - - - Side note: The resetting of the response was in the right direction but only doing it AFTER setting a new request handler eliminates the following exception: java.lang.IllegalStateException: Header was already written to response! at org.apache.wicket.protocol.http.HeaderBufferingWebResponse.checkHeader(HeaderBufferingWebResponse.java:64) at org.apache.wicket.protocol.http.HeaderBufferingWebResponse.setDateHeader(HeaderBufferingWebResponse.java:134) at org.apache.wicket.protocol.http.BufferedWebResponse$SetDateHeaderAction.invoke(BufferedWebResponse.java:310) at org.apache.wicket.protocol.http.BufferedWebResponse.writeTo(BufferedWebResponse.java:580) at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:185) at org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:167) at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:750) at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64) at org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:301) at org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:310) at org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:310) at org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:310) at org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:310) at org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:310) at org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:310) at org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:310) at org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:310) at org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:310) at org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:310) at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:224) at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:280) at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162) at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:218) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1326) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:479) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:520) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:940) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:409) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:874) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110) at org.eclipse.jetty.server.Server.handle(Server.java:349) at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:441) at org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:904) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:565
FileUpload vs. CryptoURL in Wicket 1.5
Hello, i'm, experiencing a problem with FileUpload within a ModalWindow when enabling the CryptoURLMapper in my application as being done in Wicket 1.5 via the following: setRootRequestMapper(new CryptoMapper(getRootRequestMapper(), this)); Is there any possibility to take out the fileupload URL from encryption? Or how does it work? The error I receive within the WICKET AJAX DEBUG-console just says: *NFO: *Invoking pre-call handler(s)... *ERROR: * Wicket.Ajax.Call.failure: Error while parsing response: Could not find root ajax-response element *INFO: *Invoking post-call handler(s)... *INFO: *Invoking failure handler(s)... Thanks for help!
Re: Download file from ModalWindow problem
Have you tried to put modal itself inside of another form, too? Am 08.12.2011 um 13:29 schrieb heapifyman heapify...@gmail.com: Hello again. Here's some more information about my problem: in the ModalWindow's SubmitButton's onSubmit() I call at the end: ModalWindow.closeCurrent(target); download.initiate(target); The AJAXDownload behaviour is added to the SubmitButton in the ModalWindow. Or do I have to add it to the button on my page that opens the ModalWindow? Thanks in advance. 2011/12/7 heapifyman heapify...@gmail.com Hello all, I have a problem with a file download from a ModalWindow. The ModalWindow contains a form in which the user can specify some parameters. When clicking submit I generate a PDF based on the chosen parameters and offer it for download. The ModalWindow is closed then. I followed the approach described here https://cwiki.apache.org/WICKET/ajax-update-and-file-download-in-one-blow.html and it actually works quite nice. My problem is that after the file is downloaded and the ModalWindow is closed all my Ajax stuff on the page from which the ModalWindow was opened are not working anymore. Only when I reload the page, the Ajax stuff is working again. I would appreciate any hints as to what I might be doing wrong. Or maybe someone has another code example of how to download a file from a ModalWindow? Thanks in advance. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Download file from ModalWindow problem
No, it's doesn't look nested, yet. You may nest forms in Wicket, where the modal windows markup is in between. This worked for me when I experienced a similar problem. Von meinem iPad gesendet Am 08.12.2011 um 14:12 schrieb heapifyman heapify...@gmail.com: I believe it already is. My markup looks like this: form wicket:id=form fieldset button wicket:id=downloadButtonspan wicket:id=downloadButtonLabel/span/button ... more buttons here ... /fieldset div wicket:id=dataPanel/div /form where dataPanel is: wicket:panel wicket:container wicket:id=checkGroup div wicket:id=dataContainer/div /wicket:container div wicket:id=downloadDialog/div wicket:panel 2011/12/8 Daniel Weidele daniel.weid...@uni-konstanz.de Have you tried to put modal itself inside of another form, too? Am 08.12.2011 um 13:29 schrieb heapifyman heapify...@gmail.com: Hello again. Here's some more information about my problem: in the ModalWindow's SubmitButton's onSubmit() I call at the end: ModalWindow.closeCurrent(target); download.initiate(target); The AJAXDownload behaviour is added to the SubmitButton in the ModalWindow. Or do I have to add it to the button on my page that opens the ModalWindow? Thanks in advance. 2011/12/7 heapifyman heapify...@gmail.com Hello all, I have a problem with a file download from a ModalWindow. The ModalWindow contains a form in which the user can specify some parameters. When clicking submit I generate a PDF based on the chosen parameters and offer it for download. The ModalWindow is closed then. I followed the approach described here https://cwiki.apache.org/WICKET/ajax-update-and-file-download-in-one-blow.htmland it actually works quite nice. My problem is that after the file is downloaded and the ModalWindow is closed all my Ajax stuff on the page from which the ModalWindow was opened are not working anymore. Only when I reload the page, the Ajax stuff is working again. I would appreciate any hints as to what I might be doing wrong. Or maybe someone has another code example of how to download a file from a ModalWindow? Thanks in advance. - 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: best way to accommodate dynamic properties
I'm still trying to figure this out. I would like to be able to do something like the following: HTML: img wicket:id=testimage JAVA: public class ImageTestPage extends WebPage{ public ImageTestPage() { Image myImg = new Image(testimage); myImg.setUrlForImageSrc(http://path/to/image.gif;); myImg.setWidth(200); myImg.setHeight(100); add(myImg); } } Obviously the Image class doesn't work that way... Can someone tell me how I would accomplish this so that I can define the image, height and width independent from the markup? Daniel -Original Message- From: Daniel Watrous [mailto:daniel.watr...@bodybuilding.com] Sent: Friday, December 02, 2011 5:20 PM To: users@wicket.apache.org Subject: best way to accommodate dynamic properties I'm interested in having pulling the width and height for an img from a database, but I'm not sure what the best way is to create a component and corresponding HTML mapping. Please send an example or link to previous response if possible. I've searched the users list archives but didn't find what I was looking for. Thanks. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
AbstractAjaxTimerBehavior with restart ability
Hi, Current implementation of AbstractAjaxTimerBehavior has a functionality to stop() pooling. But once stopped it cannot be restarted. There are situations when we want to periodically refresh components from one event to another, but not all the time (to avoid unnecessary requests to server). So it would be nice to have a restarting ability in AbstractAjaxTimerBehavior. Something like: public final void start(final AjaxRequestTarget target) { target.getHeaderResponse().renderOnLoadJavascript(getJsTimeoutCall(getUpdateInterval())); } But this method does not work in all situations. Eg. when you stopped this timer using stop() method, the above start() does not work (but this is probably because a stopped flag cannot be reset to false). What do you think about such improvement in AbstractAjaxTimerBehavior? It would be great to has it also in 1.4 because I cannot upgrade to 1.5 ;). -- Daniel - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Apache Wicket is a Flawed Framework
I was searching for a Java framework two years ago because I wanted server-side persistence and a statically typed language with the option for easy AJAX and debugging while the output markup is largely maintained the way I wrote the templates. I think I found Wicket via DZone due to the 1.4 release. I already read a book from Manning before and liked that it was written in a way that enables the reader to jump right into programming after having read the introductory chapters. I was happy when I saw that Wicket in Action seemed to use a similar structure. I think I tried Wicket without the book first but got stuck really quick (at latest when I got to the point when I needed models which was quite immediate) and so buying WiA was a quick (and good) decision. As with any framework, it takes at least one project to get your head around it, so you better start with some personal project in your free time. On the following 2-3 projects you are iterating on the maybe I could have done it better that way process. But that's just the way it is for any framework in any language (and also without any framework at all). I assume the OP is using Wicket the first time without any guidance and just hasn't found into it yet. I wasn't able to put Wicket in use at work until January this year but now we are on our 2nd (my 4th) Wicket project. What I could observe is that 1) you usually don't find into Wicket until you read a book (with WiA it's sufficient to read the introductory chapters, jump into coding and come back to the chapters whenever you need to know something) 2) there is an aversion until you get your head around the correct use of models and anonymous inner classes, at least if you never did something like that before (WiA introduces it quite good but you have to start coding before you really get it) 3) you should follow the (excellent) mailing list to read about issues you may encounter and use it as a knowledge base once you hit some problem/question (better on an own email account than on the archives) 4) if documentation does not help, read the source code (I found it pretty readable which is much different from other frameworks I have used/tried before - being easily accessible with Maven and a decent IDE, there is no excuse not to look into it) So, the conclusion is: There should be better free documentation but if you pick up a book it's quite easy to get started and the best 30€ ever spent. - I agree that it is rather too easy for Wicket to make things stateful, when you don't want it To turn that into a point of critique: It may be hard to get stateless pages. I've made a similar experience where I had a search form that would not go stateless. I couldn't figure out where anything was persisted but if I had dug deeper, I may have found the cause, but that issue wasn't important enough to invest more time in it. - and in my opinion the stuff you need to do to achieve normal URLs (no ?, no version number, no nothing) is just a pain. *Every* URL, for stateless or stateless pages or whatever, should be normal, otherwise it is just not acceptable -- users never want to see those complicated-looking URLs under any circumstance I prefer the way Wicket handles persistence with at-most-once semantics by simply adding version numbers on the URL (after a redirect from an internal URL) as other methods are less successful in achieving that out of the box, pollute URLs even further or add hidden markup. IMO, two numbers on the URL are quite unobtrusive, especially as they are simply ignored and transparently reassigned if the session does not match (i.e. on a URL that has been pasted into an email etc.). - did not yet try out Ajax with Wicket, so I have no opinion on that It's incredibly easy to use; you should really try it. :) Just my 2¢. In all, a great framework that is much easier to use than e.g. things based on JSP. Keep up the good work, guys ! Full ack! :) - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Display HTML in Label with validation
Thanks for your suggestion. But I need to validate a fragment of HTML, but it seems that HtmlDocumentValidator validates only whole documents. From my point of view the following texts are valid HTML fragments: - This is sample text - bThis is/b sample pparagraph/p -- Daniel On Thu, Sep 15, 2011 at 5:31 PM, manuelbarzi manuelba...@gmail.com wrote: may HtmlDocumentValidator help you. . On Thu, Sep 15, 2011 at 5:05 PM, Daniel Stoch daniel.st...@gmail.com wrote: Hi, How to display dynamic HTML content on page which can be invalid (because this HTML is entered by a user). I can use Label.setEscapeModelStrings(false), but with invalid HTML content the page will not be rendered (because of HTML parsing error). So maybe I can use some of standard Wicket mechanisms to parse this HTML first to check if I can display it on page? There are some parsers within framework... -- Daniel - 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
Display HTML in Label with validation
Hi, How to display dynamic HTML content on page which can be invalid (because this HTML is entered by a user). I can use Label.setEscapeModelStrings(false), but with invalid HTML content the page will not be rendered (because of HTML parsing error). So maybe I can use some of standard Wicket mechanisms to parse this HTML first to check if I can display it on page? There are some parsers within framework... -- Daniel - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
setRenderAllowed called for invisible components
Hi, Is it a valid behavior that setRenderAllowed(...) method is called for invisible components (components that are not visible in hierarchy). I have a use case with DataView component displaying list of links. When I hide this DataView (eg. by setting dataView.setVisible(false)) then for each of the links components (created in previous request) setRenderAllowed(...) method is called. I have a quickstart app to simulate this, but I don't know is it a bug and should I create JIRA issue for this? -- Daniel - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: setRenderAllowed called for invisible components
Wicket 1.4.18 On Mon, Sep 5, 2011 at 12:29 PM, Daniel Stoch daniel.st...@gmail.com wrote: Hi, Is it a valid behavior that setRenderAllowed(...) method is called for invisible components (components that are not visible in hierarchy). I have a use case with DataView component displaying list of links. When I hide this DataView (eg. by setting dataView.setVisible(false)) then for each of the links components (created in previous request) setRenderAllowed(...) method is called. I have a quickstart app to simulate this, but I don't know is it a bug and should I create JIRA issue for this? -- Daniel - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: setRenderAllowed called for invisible components
Hi, Yes, it should be called also on invisible components, but only when it is any chance that these components can be rendered. If one of theirs parents are not visible, then such component will not be rendered. In my scenario DataView is visible only when dataView.getItemCount() 0. But it leads to an abnormal situation: 1. First request: dataView.getItemCount()=3 so DataView renders 3 subitems (children). 2. Second request: dataView.getItemCount()=0 (eg. someone remove all 3 records from DB), so I set DataView.setVisible(false), but DataView subitems are not removed from its children list before calling DataView.setRenderAllowed (MarkupContainer.setRenderAllowed). MarkupContainer.setRenderAllowed calls setRenderAllowed for all 3 subitems in visitChildren(...). But these subitems should not exists in current request because dataView.getItemCount()=0. They are not removed from DataView because it is not visible and calling setRenderAllowed for these subitems is a bug for me. -- Daniel On Mon, Sep 5, 2011 at 4:21 PM, Andrea Del Bene adelb...@ciseonweb.it wrote: Hi, I'm not completely sure, but setRenderAllowed is called to check rendering authorization, so it should be called also on invisible components. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: new user registration email verification
It's like you already said in your first mail. For one of our websites the behaviour is: 1) generate some kind of a random, unique token s.th. like UUID.randomUUID().toString() 2) register token to user in database 3) email link including the token to the user (use a readily available email library) For your application to process the link, the link should end in a bookmarkable page with a short URL (so it doesn't take too much space in the email). If you append the token like you usually do (depending on the UrlCodingStrategy used), the page can get the token by accessing the PageParameters. If you have multiple types of opt-ins/confirmations (user accounts, newsletters etc.) then you could use one page to process all tokens and let it decide which additional page should be instantiated and redirected to after token verification depending on the token type you saved in your database. On our website we check the token for the correct pattern using a regular expression and then get the user's email address/data from the database and let the user confirm his address by re-entering it and continue with an account setup wizard. However, such a double-safety should rarely be necessary. We could as well confirm the account right away (or immediately show/redirect to the wizard instead); once you have the token you know what user is intended to be accessed so you can do whatever you want. Also make sure your tokens will time out after a week or so. You may also want to count token requests/validations and block users in case the number gets too high (get the client IP address by accessing the servlet request and record it somewhere). Maybe we are just a bit too cautious but our application hosts quite some data, so it can't be wrong. :) - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket / Hibernate / Databinder (dead?)
jbrookover wrote: We've been using Wicket 1.4 + Hibernate 3.3 + Databinder 1.3.0 for quite some time now. I wanted to update to a more recent version of Hibernate, but Databinder was incompatible and seems pretty dead. My question is what do people use for their bridge between Wicket and Hibernate? Do you all write your own LoadableDetachableModels to load from the database? Is there an alternative to Databinder that I don't know about? A wicketstuff wiki page mentioned 'HibernateModel' but I haven't seen any actual code. I love Databinder's HibernateObjectModel, SortableHibernateProvider, etc. If there's nothing else, I'll keep on updating them, but I wanted to make sure there wasn't some more active alternative. Hi, AFAIK Nathan was not maintaining it anymore but Rodolfo Hansen was working on it a while ago to get it up to new versions of Hibernate and Wicket, please check here: https://github.com/kryptt, last updates are from April 5. Cheers, Daniel -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-Hibernate-Databinder-dead-tp3557635p3557902.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
Re: [VOTE] Behavior of CheckBox With Respect to setRequired(true)
I would stick with 1 (required to be checked). The main reason would be not to break compatibility with old versions. I actually used .setRequired(true) on legal checkboxes (disclaimers) in one of our applications because if I have a required checkbox I expect it to be needed to be checked. Although I will change that in our project now that I know such a change is being discussed, I wouldn't expect others to be that observant of the issue and have unit tests that prevent anything from breaking on a future upgrade. BTW an empty string (that's not null) is a string nevertheless. Following the argument that an unchecked (false) checkbox should be regarded as valid if it is required, an empty string should be accepted as a valid input as well. I've just tested it with Wicket 1.4 and actually both of the following TextFields validate to a failed state: TextField tf1 = new TextField(text1, new PropertyModelString(this, test1)); tf1.setRequired(true); tf1.setConvertEmptyInputStringToNull(false); form.add(tf1); TextField tf2 = new TextField(text2, new PropertyModelString(this, test2)); tf2.setRequired(true); tf2.setConvertEmptyInputStringToNull(true); form.add(tf2); So, TextField.setRequired doesn't validate the syntactic meaning as well, instead it validates the semantic meaning, just as CheckBox.setRequired does. If that's consistently used throughout Wicket, I would expect CheckBox.setRequired to validate false unless the CheckBox is actually checked. Just my 2 cents, Daniel - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: flexible authentication
Hi! We have the same situation in one of our web applications (profile pages may be hidden for everyone except the profile owner). Since I wasn't able to find a clean way to check such conditions from our page authorization strategy, I added that to the checks I already had in the page constructor method (other checks are to catch invalid indices etc.). If the validation fails I redirect the user to a friendly-written error page and call return to stop the method afterwards. Maybe it's possible to get the page parameters by accessing the request cycle directly from an authorization strategy? However, if there are more situations like that I would expect the authorization strategy to become big and cluttered very fast, so I don't think such checks should go there but instead be performed by the page class they are meant for. If the same checks are performed in different classes, they could go into a (static) method, maybe in a super class. If there's (yet) another good place to put such checks in, I would be interested in it as well. :) Bye, Daniel - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Extend AjaxFormComponentUpdatingBehavior functionality for required FormComponents
Maybe I should explain one of use-cases. Let's say we have a form to enter RSS feed information. There are two TextFields: - url for RSS feed (urlModel) - custom RSS feed name (nameModel). Both are required and both have OnChangeBehavior attached. When user enter url for RSS the name of it is retrieved and set into nameModel. But only when nameModel has null object or nameEdited (boolean flag) is false. Now user can edit name field (then nameEdited flag is set to true, to avoid changing this name when user change url). But when user clears name field nameModel should be updated to null, but behavior does not allow this (because of validation of required field). what you want can be done in a simple manner. do not mark your field as required, since it is not. write your own validator that allows setting the field value to null when the edit flag is set, and fails when it is not. But this field is required - from user point of view. User cannot submit form without filling the name. you can create your own updating behavior that calls setrequired(false) on the component prior to running validation/model update if that is what you want. but we will not ship something like this as part of core because it doesnt generally make sense. Probably I'll write my own behavior, because it seems this is the only solution :). Maybe it does not make sense from your point of view, but from mine it does. I think your point of view is sometimes too narrow. my point of view has to be narrow. as developers of the framework we try to make the 95% usecase as simple as possible, while leaving the door open for the other rare 5%. unfortunately for you, this is the other 5%. My post was only a proposal, because it is not possible to easy extend AjaxFormComponentUpdatingBehavior because onEvent() is final. I want to avoid copy/paste code with only a little change. And I think this change is very useful. But ok, I understand you, so I'll implement it by myself. But always is good to try convince you first :). -- Daniel - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Extend AjaxFormComponentUpdatingBehavior functionality for required FormComponents
On Thu, Feb 17, 2011 at 10:37 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: validation is there to make sure the user of the webapp cannot push an illegal value into a model. it doesnt matter if its just the component that is being submitted or the entire form. components decide whether or not a user can push null in by using their required flag. you want to push null, dont mark the component as required. it is as simple as that. you can create your own updating behavior that calls setrequired(false) on the component prior to running validation/model update if that is what you want. but we will not ship something like this as part of core because it doesnt generally make sense. -igor I've found examples in Wicket core, which are very similar to my use-cases, so it looks like sometimes it does make sense :). Look at the classes which implements IOnChangeListener. There is a method onSelectionChanged() which implementation in many cases looks like: public final void onSelectionChanged() { convertInput(); updateModel(); onSelectionChanged(getModelObject()); } So as you can see here validation is bypassed and null values can be push into the model even if FormComponent is required. Eg. DropDownChoice: when I use non-ajax wantOnSelectionChangedNotifications() I can push null into its model, but the same thing does not work with OnChangeAjaxBehavior(). So there is a small inconsistence between ajax and non-ajax functionality. My case is to allow the same behavior for ajax calls. -- Daniel - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Extend AjaxFormComponentUpdatingBehavior functionality for required FormComponents
It can be called with null value when you set DropDownChoice.setNullValid(true). You don't want to understand that this is a good behavior in many cases, not a bug. But ok it is your framework, so you decide. But maybe other Wicket commiters have a different feeling about it? -- Daniel On Fri, Feb 18, 2011 at 5:36 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: that looks like a bug to me. the reason it has gone unnoticed for so long is that someone would have to hack html to cause it. onchange only fires in browsers when there is a value selected, so that code would not typically be called with a null, and thus no need to check required. -igor On Fri, Feb 18, 2011 at 7:22 AM, Daniel Stoch daniel.st...@gmail.com wrote: On Thu, Feb 17, 2011 at 10:37 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: validation is there to make sure the user of the webapp cannot push an illegal value into a model. it doesnt matter if its just the component that is being submitted or the entire form. components decide whether or not a user can push null in by using their required flag. you want to push null, dont mark the component as required. it is as simple as that. you can create your own updating behavior that calls setrequired(false) on the component prior to running validation/model update if that is what you want. but we will not ship something like this as part of core because it doesnt generally make sense. -igor I've found examples in Wicket core, which are very similar to my use-cases, so it looks like sometimes it does make sense :). Look at the classes which implements IOnChangeListener. There is a method onSelectionChanged() which implementation in many cases looks like: public final void onSelectionChanged() { convertInput(); updateModel(); onSelectionChanged(getModelObject()); } So as you can see here validation is bypassed and null values can be push into the model even if FormComponent is required. Eg. DropDownChoice: when I use non-ajax wantOnSelectionChangedNotifications() I can push null into its model, but the same thing does not work with OnChangeAjaxBehavior(). So there is a small inconsistence between ajax and non-ajax functionality. My case is to allow the same behavior for ajax calls. -- Daniel - 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: Extend AjaxFormComponentUpdatingBehavior functionality for required FormComponents
On Fri, Feb 18, 2011 at 10:09 AM, Daniel Stoch daniel.st...@gmail.com wrote: My post was only a proposal, because it is not possible to easy extend AjaxFormComponentUpdatingBehavior because onEvent() is final. I want to avoid copy/paste code with only a little change. And I think this change is very useful. But ok, I understand you, so I'll implement it by myself. I've tried to implement my own behavior (with an option to bypass validation step). But unfortunately I cannot call formComponent.convertInput() which is necessary to get value from input. This is a protected method. Can you make it a public method? -- Daniel - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org