Wicket and Struts together have a problem when not adding mountpath to the Wicket-Page
Hi! We are having two frameworks for one project (wicket 1.4 and struts). Was no problem until now. We want to migrate the whole client to wicket 6.2. From my struts pages I have a URL like http://localhost:8080/application/wicket/foo?id= to my wicket-page. That works, because of the annotation MountPath with the value foo on the Pageclass. And on this wicket page i am linking to another wicketpage, but not with mountpath (I don't need it here), but with setResponsePage(new BarPage());. Now my URL is something like http://localhost:8080/application/wicket/wicket/page?3. This is the result of PageInstanceMapper mapHandlerL:137-141 That would be OK, if my whole application would be wicket. But from these wicket-pages I am also linking to Struts-Pages with the prefix ../. Because wicket/ is two times in the URL now, this doesn't work anymore and results in a not-found exception. Strange thing is, when I am annotating my pageclass with MountPath(value = wtf), it works perfectly, although I am calling this page with setResponsePage(new Page()) and not via MountPath. Then the MountedMapper is used for the UR -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-and-Struts-together-have-a-problem-when-not-adding-mountpath-to-the-Wicket-Page-tp4654360.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: Wicket and Struts together have a problem when not adding mountpath to the Wicket-Page
I believe this question has been asked few weeks ago and we found the solution, no ? On Fri, Nov 30, 2012 at 9:07 AM, cknafl chr.kn...@gmail.com wrote: Hi! We are having two frameworks for one project (wicket 1.4 and struts). Was no problem until now. We want to migrate the whole client to wicket 6.2. From my struts pages I have a URL like http://localhost:8080/application/wicket/foo?id= to my wicket-page. That works, because of the annotation MountPath with the value foo on the Pageclass. And on this wicket page i am linking to another wicketpage, but not with mountpath (I don't need it here), but with setResponsePage(new BarPage());. Now my URL is something like http://localhost:8080/application/wicket/wicket/page?3. This is the result of PageInstanceMapper mapHandlerL:137-141 That would be OK, if my whole application would be wicket. But from these wicket-pages I am also linking to Struts-Pages with the prefix ../. Because wicket/ is two times in the URL now, this doesn't work anymore and results in a not-found exception. Strange thing is, when I am annotating my pageclass with MountPath(value = wtf), it works perfectly, although I am calling this page with setResponsePage(new Page()) and not via MountPath. Then the MountedMapper is used for the UR -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-and-Struts-together-have-a-problem-when-not-adding-mountpath-to-the-Wicket-Page-tp4654360.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 -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Re: Pages, Panels, and Dependency Injection
Hi, Most of the time people inject services to their components. To test just components you can use WicketTester#startComponentInPage() methods. On Fri, Nov 30, 2012 at 3:18 AM, William Speirs wspe...@apache.org wrote: I'm having trouble understanding how to inject components into a page so that the page will be easy to unit test later. Say I have a page that contains two panels. I can easily use constructor injection to inject these panels into the page: class MyPage extends WebPage { @Inject public MyPage(PanelA a, PanelB b) { ... } } The problem is that all Panels require an id during construction.[1] How do I supply the id to my Panels? I could simply construct every PanelA with an id of panela and every PanelB with an id of panel, but that doesn't seem very flexible. What do other people do in this situation? The hope would be to pass mocked panels into the page during unit testing, the separately test each panel. What if instead of a panel it was a button where the onSubmit method must be specified by overriding the method. How does one go about injecting such a component so that it's still easy to test later in unit tests? All thoughts and/or best practices are greatly welcomed. For reference I'm using Guice as my dependency injection framework and GuiceWebApplicationFactory to inject components into pages. Thanks... Bill- [1] http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/markup/html/panel/Panel.html -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Re: understanding ajax response
Paste few of the generated evaluate and priority-evaluate elements in an Ajax response. I guess the response is after click on an IndicatingAjaxLink ? On Thu, Nov 29, 2012 at 4:37 PM, saty satya...@gmail.com wrote: Most of these are coming from using IndicatingAjaxLink link = new IndicatingAjaxLink(link) That launches a model window. The data grid i have , many rows (hence every cell on that row) have a AJAX link that opens a model window to show more details. I don't have anything else that is adding java script calls on this page, do you see anything can can be done here (instead) to overcome the issue. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/understanding-ajax-response-tp4654310p4654342.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 -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Re: Jetty Gzip Compression
Hi, The gzip filter should be before Wicket filter. This way it has the chance to manipulate the response generated by Wicket. Wicket just calls httpServletResponse.setContentType(text/application) and httpServletResponse.write(someStringWithJS). GZipFilter's job is to change the content type and gzip the JS string. I recommend you to put a breakpoint in GZipFilter and see what happens. On Thu, Nov 29, 2012 at 8:30 PM, Nick Pratt nbpr...@gmail.com wrote: Ive enabled Gzip compression via the Jetty filter for my application (Jetty v6 and v8). Based on Chrome Dev Tools and Firebug in Firefox, my .js and .css files are not being compressed (browser states in the request that it will take gzip response), although text/html is, and Im trying to understand why. Ive got the mimeTypes configured in the GzipFilter servlet, minGzipSize defaults to 0 bytes. In Wicket 6, is there anything going on with the resources that would prevent Jetty's GzipFilter from working? Ive tried placing the filter both before and after the WicketFilter. Chrome's PageSpeed analyzer also thinks most of my larger JS files are not compressed (Ive been looking at the Response headers) Any thoughts? N -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Recommended way to generate REST URLs in Wicket 6.3
Hi all Searching the net I found various ways to support RESTful URLs in Wicket, including the MixedParamUrlCodingStrategy. I am just curious if there is an easier way, as it looks cumbersome. I like the method mountPage (example in Scala below), but it does not generate RESTful URLs, the URL looks like this: guide//step/?3 - the guideId and stepNo is missing. What is the recommended way of generating REST URLs in Wicket 6.3? mountPage(/guide/${guideId}/step/${stepNo}, classOf[GuidePage])
Re: Recommended way to generate REST URLs in Wicket 6.3
Hi, Read http://wicketinaction.com/2011/07/wicket-1-5-mounting-pages/ On Fri, Nov 30, 2012 at 11:52 AM, René Vangsgaard rene.vangsga...@gmail.com wrote: Hi all Searching the net I found various ways to support RESTful URLs in Wicket, including the MixedParamUrlCodingStrategy. I am just curious if there is an easier way, as it looks cumbersome. I like the method mountPage (example in Scala below), but it does not generate RESTful URLs, the URL looks like this: guide//step/?3 - the guideId and stepNo is missing. What is the recommended way of generating REST URLs in Wicket 6.3? mountPage(/guide/${guideId}/step/${stepNo}, classOf[GuidePage]) -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Re: Recommended way to generate REST URLs in Wicket 6.3
Thank you, but my second was more on generating REST-like URLs, not consuming them. I have rephrased my example below. In init: mountPage(/guide/${guideId}/step/${stepNo}, classOf[GuidePage]) In StateLessLink.onClick: setResponsePage(new GuidePage(1984, 1)) It generate this URL (the last number changing): http://localhost:8080/guide//step/?3 On 30 November 2012 12:03, Martin Grigorov mgrigo...@apache.org wrote: Hi, Read http://wicketinaction.com/2011/07/wicket-1-5-mounting-pages/ On Fri, Nov 30, 2012 at 11:52 AM, René Vangsgaard rene.vangsga...@gmail.com wrote: Hi all Searching the net I found various ways to support RESTful URLs in Wicket, including the MixedParamUrlCodingStrategy. I am just curious if there is an easier way, as it looks cumbersome. I like the method mountPage (example in Scala below), but it does not generate RESTful URLs, the URL looks like this: guide//step/?3 - the guideId and stepNo is missing. What is the recommended way of generating REST URLs in Wicket 6.3? mountPage(/guide/${guideId}/step/${stepNo}, classOf[GuidePage]) -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Re: Recommended way to generate REST URLs in Wicket 6.3
No worries. I still have problem to understand why people call Urls with path parameters REST-urls. There is no problem to read query string parameters in RESTful app. On Fri, Nov 30, 2012 at 12:47 PM, René Vangsgaard rene.vangsga...@gmail.com wrote: Thank you, but my second was more on generating REST-like URLs, not consuming them. I have rephrased my example below. In init: mountPage(/guide/${guideId}/step/${stepNo}, classOf[GuidePage]) In StateLessLink.onClick: setResponsePage(new GuidePage(1984, 1)) It generate this URL (the last number changing): http://localhost:8080/guide//step/?3 There are two problems here. 1) encoded in the url path or query string these parameters are still parameters In your code about GuidePage is created without PageParameters being used, so Wicket has no way to find values for the placeholders Solution: val params = new PageParameters(); params.set(guideId, 1984) params.set(stepNo, 1) setResponsePage(classOf[GuidePage], params) 2) the extra pageId in the query string is used internally by Wicket It is not needed only when your page is stateless If GuidePage has no stateful components/behaviors then all will be fine. Set log level to DEBUG for org.apache.wicket.Page to see whether a Page is stateful and why On 30 November 2012 12:03, Martin Grigorov mgrigo...@apache.org wrote: Hi, Read http://wicketinaction.com/2011/07/wicket-1-5-mounting-pages/ On Fri, Nov 30, 2012 at 11:52 AM, René Vangsgaard rene.vangsga...@gmail.com wrote: Hi all Searching the net I found various ways to support RESTful URLs in Wicket, including the MixedParamUrlCodingStrategy. I am just curious if there is an easier way, as it looks cumbersome. I like the method mountPage (example in Scala below), but it does not generate RESTful URLs, the URL looks like this: guide//step/?3 - the guideId and stepNo is missing. What is the recommended way of generating REST URLs in Wicket 6.3? mountPage(/guide/${guideId}/step/${stepNo}, classOf[GuidePage]) -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/ -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
problem with editable datatable
Hi, I am using Wicket 6.3. I have searched a lot, but somehow didn't find how to solve this: I would like to have texfields and checkboxes in a datatable. The following code is not working: Java: ListIColumnlt;Feststellung, String columns = new ArrayListIColumnlt;Feststellung, String(); columns.add(new PropertyColumnFeststellung, String(new ModelString(Status), status) { @Override public void populateItem(ItemICellPopulatorlt;Feststellung item, String componentId, IModelFeststellung rowModel) { super.populateItem(item, componentId, rowModel); item.add(new CheckBox(status)); } }); this.table = new DefaultDataTableFeststellung, String(feststellungen, columns, this.dataProvider, 10); Html: form wicket:id=tableForm /form I get the following error message: Last cause: The component(s) below failed to render. Possible reasons could be that: 1) you have added a component in code but forgot to reference it in the markup (thus the component will never be rendered), 2) if your components were added in a parent container then make sure the markup for the child container includes them in wicket:extend. 1. [CheckBox [Component id = status]] 2. [CheckBox [Component id = status]] 3. [CheckBox [Component id = status]] Is it possible what I want to do? Kind regards, Hannes -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/problem-with-editable-datatable-tp4654370.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: Recommended way to generate REST URLs in Wicket 6.3
Using the class and PageParameters together did it. Thanks a lot. On 30 November 2012 13:01, Martin Grigorov mgrigo...@apache.org wrote: No worries. I still have problem to understand why people call Urls with path parameters REST-urls. There is no problem to read query string parameters in RESTful app. On Fri, Nov 30, 2012 at 12:47 PM, René Vangsgaard rene.vangsga...@gmail.com wrote: Thank you, but my second was more on generating REST-like URLs, not consuming them. I have rephrased my example below. In init: mountPage(/guide/${guideId}/step/${stepNo}, classOf[GuidePage]) In StateLessLink.onClick: setResponsePage(new GuidePage(1984, 1)) It generate this URL (the last number changing): http://localhost:8080/guide//step/?3 There are two problems here. 1) encoded in the url path or query string these parameters are still parameters In your code about GuidePage is created without PageParameters being used, so Wicket has no way to find values for the placeholders Solution: val params = new PageParameters(); params.set(guideId, 1984) params.set(stepNo, 1) setResponsePage(classOf[GuidePage], params) 2) the extra pageId in the query string is used internally by Wicket It is not needed only when your page is stateless If GuidePage has no stateful components/behaviors then all will be fine. Set log level to DEBUG for org.apache.wicket.Page to see whether a Page is stateful and why On 30 November 2012 12:03, Martin Grigorov mgrigo...@apache.org wrote: Hi, Read http://wicketinaction.com/2011/07/wicket-1-5-mounting-pages/ On Fri, Nov 30, 2012 at 11:52 AM, René Vangsgaard rene.vangsga...@gmail.com wrote: Hi all Searching the net I found various ways to support RESTful URLs in Wicket, including the MixedParamUrlCodingStrategy. I am just curious if there is an easier way, as it looks cumbersome. I like the method mountPage (example in Scala below), but it does not generate RESTful URLs, the URL looks like this: guide//step/?3 - the guideId and stepNo is missing. What is the recommended way of generating REST URLs in Wicket 6.3? mountPage(/guide/${guideId}/step/${stepNo}, classOf[GuidePage]) -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/ -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Re: master branch compiler error in core?
No errors here. Igor added an exclusion in parent pom.xml for this change. https://git-wip-us.apache.org/repos/asf/wicket/repo?p=wicket.git;a=commitdiff;h=c3d47448d1bf5b5d0e8207bb8c0cf605cef8c18c On Fri, Nov 30, 2012 at 1:36 PM, Chris Colman chr...@stepaheadsoftware.comwrote: I've just updated the master branch and I get the following build errors: [INFO] --- clirr-maven-plugin:2.5:check (clirr-check) @ wicket-core --- [INFO] Comparing to version: 6.0.0 [ERROR] org.apache.wicket.feedback.FeedbackCollector: Method 'public java.util.List collect()' is now final [ERROR] org.apache.wicket.feedback.FeedbackCollector: Method 'public java.util.List collect(org.apache.wicket.feedback.IFeedbackMessageFilter)' is now final [ERROR] org.apache.wicket.feedback.FeedbackCollector: Method 'public org.apache.wicket.feedback.FeedbackCollector setIncludeSession(boolean)' is now final [ERROR] org.apache.wicket.feedback.FeedbackCollector: Method 'public org.apache.wicket.feedback.FeedbackCollector setRecursive(boolean)' is now final [INFO] Am I doing something wrong or is there an error in the latest source? -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Re: problem with editable datatable
thank you, but then I get the following error: Last cause: The component(s) below failed to render. Possible reasons could be that: 1) you have added a component in code but forgot to reference it in the markup (thus the component will never be rendered), 2) if your components were added in a parent container then make sure the markup for the child container includes them in wicket:extend. 1. [MyPanel [Component id = panel]] 2. [CheckBox [Component id = status]] 3. [MyPanel [Component id = panel]] 4. [CheckBox [Component id = status]] 5. [MyPanel [Component id = panel]] 6. [CheckBox [Component id = status]] -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/problem-with-editable-datatable-tp4654370p4654375.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: Wicket and Struts together have a problem when not adding mountpath to the Wicket-Page
I found nothing with struts and wicket... :( Maybe somebody knows the other topic, where the problem is solved? Or maybe somone could post the solution here again :) Regards Christoph -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-and-Struts-together-have-a-problem-when-not-adding-mountpath-to-the-Wicket-Page-tp4654359p4654377.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: master branch compiler error in core?
I see Igor's exlusion in the parent pom.xml but it doesn't seem to help the build succeed. -Original Message- From: Martin Grigorov [mailto:mgrigo...@apache.org] Sent: Friday, 30 November 2012 11:52 PM To: users@wicket.apache.org Subject: Re: master branch compiler error in core? No errors here. Igor added an exclusion in parent pom.xml for this change. https://git-wip- us.apache.org/repos/asf/wicket/repo?p=wicket.git;a=commitdiff;h=c3d4744 8d1b f5b5d0e8207bb8c0cf605cef8c18c On Fri, Nov 30, 2012 at 1:36 PM, Chris Colman chr...@stepaheadsoftware.comwrote: I've just updated the master branch and I get the following build errors: [INFO] --- clirr-maven-plugin:2.5:check (clirr-check) @ wicket-core --- [INFO] Comparing to version: 6.0.0 [ERROR] org.apache.wicket.feedback.FeedbackCollector: Method 'public java.util.List collect()' is now final [ERROR] org.apache.wicket.feedback.FeedbackCollector: Method 'public java.util.List collect(org.apache.wicket.feedback.IFeedbackMessageFilter)' is now final [ERROR] org.apache.wicket.feedback.FeedbackCollector: Method 'public org.apache.wicket.feedback.FeedbackCollector setIncludeSession(boolean)' is now final [ERROR] org.apache.wicket.feedback.FeedbackCollector: Method 'public org.apache.wicket.feedback.FeedbackCollector setRecursive(boolean)' is now final [INFO] Am I doing something wrong or is there an error in the latest source? -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket and Struts together have a problem when not adding mountpath to the Wicket-Page
https://issues.apache.org/jira/browse/WICKET-4870 It seems the problem is still unresolved. You have asked the same in a ticket. Did you try my proposals ? On Fri, Nov 30, 2012 at 2:04 PM, cknafl chr.kn...@gmail.com wrote: I found nothing with struts and wicket... :( Maybe somebody knows the other topic, where the problem is solved? Or maybe somone could post the solution here again :) Regards Christoph -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-and-Struts-together-have-a-problem-when-not-adding-mountpath-to-the-Wicket-Page-tp4654359p4654377.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 -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Resources used as an API
Hi, I needed to implement a dynamic JSON API for programmatic consumption by another application. I ended up implementing AbstractResource to accomplish this task (using Wicket 6.2.0.). First question, does this violate the intent of resources? If so, is there a good way to do this within Wicket? Or, would you strongly suggest I use a more traditional API framework (e.g., Jersey)? If resources should be able to perform this task, I ran into some weird behavior. When I explicitly setStatusCode on ResourceResponse to 200, the HTTP body of the response came back empty. I'm pretty sure this is due to the following check in AbstractResource#respond: if (!data.dataNeedsToBeWritten(attributes) || data.getErrorCode() != null || data.getStatusCode() != null) { return; } My use case is trivial (200 on success, 500 on error). So, it was easy enough to remove the explicit declaration of a 200 and let it default to OK. However there are many other status codes that are not errors that might warrant a HTTP body. This seems like a bug to me. Is this by design? Thanks in advance! Ben - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Jetty Gzip Compression
Ive stepped through the GzipFilter, and things look to be processed through the Gzip compression, but only my welcome.html page is returned as gzipped - all the .css and .js resources do not have a gzip Content-Encoding set on them. Just to clarify, did you really mean text/application instead of text/css and application/javascript ? N On Fri, Nov 30, 2012 at 3:45 AM, Martin Grigorov mgrigo...@apache.orgwrote: Hi, The gzip filter should be before Wicket filter. This way it has the chance to manipulate the response generated by Wicket. Wicket just calls httpServletResponse.setContentType(text/application) and httpServletResponse.write(someStringWithJS). GZipFilter's job is to change the content type and gzip the JS string. I recommend you to put a breakpoint in GZipFilter and see what happens. On Thu, Nov 29, 2012 at 8:30 PM, Nick Pratt nbpr...@gmail.com wrote: Ive enabled Gzip compression via the Jetty filter for my application (Jetty v6 and v8). Based on Chrome Dev Tools and Firebug in Firefox, my .js and .css files are not being compressed (browser states in the request that it will take gzip response), although text/html is, and Im trying to understand why. Ive got the mimeTypes configured in the GzipFilter servlet, minGzipSize defaults to 0 bytes. In Wicket 6, is there anything going on with the resources that would prevent Jetty's GzipFilter from working? Ive tried placing the filter both before and after the WicketFilter. Chrome's PageSpeed analyzer also thinks most of my larger JS files are not compressed (Ive been looking at the Response headers) Any thoughts? N -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Re: Jetty Gzip Compression
Try with wget/curl client instead. I meant text/javascript .. On Fri, Nov 30, 2012 at 4:08 PM, Nick Pratt nbpr...@gmail.com wrote: Ive stepped through the GzipFilter, and things look to be processed through the Gzip compression, but only my welcome.html page is returned as gzipped - all the .css and .js resources do not have a gzip Content-Encoding set on them. Just to clarify, did you really mean text/application instead of text/css and application/javascript ? N On Fri, Nov 30, 2012 at 3:45 AM, Martin Grigorov mgrigo...@apache.org wrote: Hi, The gzip filter should be before Wicket filter. This way it has the chance to manipulate the response generated by Wicket. Wicket just calls httpServletResponse.setContentType(text/application) and httpServletResponse.write(someStringWithJS). GZipFilter's job is to change the content type and gzip the JS string. I recommend you to put a breakpoint in GZipFilter and see what happens. On Thu, Nov 29, 2012 at 8:30 PM, Nick Pratt nbpr...@gmail.com wrote: Ive enabled Gzip compression via the Jetty filter for my application (Jetty v6 and v8). Based on Chrome Dev Tools and Firebug in Firefox, my .js and .css files are not being compressed (browser states in the request that it will take gzip response), although text/html is, and Im trying to understand why. Ive got the mimeTypes configured in the GzipFilter servlet, minGzipSize defaults to 0 bytes. In Wicket 6, is there anything going on with the resources that would prevent Jetty's GzipFilter from working? Ive tried placing the filter both before and after the WicketFilter. Chrome's PageSpeed analyzer also thinks most of my larger JS files are not compressed (Ive been looking at the Response headers) Any thoughts? N -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/ -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Re: Resources used as an API
Please file a ticket. On Fri, Nov 30, 2012 at 3:55 PM, Benjamin Heiskell ben.heisk...@gmail.comwrote: Hi, I needed to implement a dynamic JSON API for programmatic consumption by another application. I ended up implementing AbstractResource to accomplish this task (using Wicket 6.2.0.). First question, does this violate the intent of resources? If so, is there a good way to do this within Wicket? Or, would you strongly suggest I use a more traditional API framework (e.g., Jersey)? If resources should be able to perform this task, I ran into some weird behavior. When I explicitly setStatusCode on ResourceResponse to 200, the HTTP body of the response came back empty. I'm pretty sure this is due to the following check in AbstractResource#respond: if (!data.dataNeedsToBeWritten(attributes) || data.getErrorCode() != null || data.getStatusCode() != null) { return; } My use case is trivial (200 on success, 500 on error). So, it was easy enough to remove the explicit declaration of a 200 and let it default to OK. However there are many other status codes that are not errors that might warrant a HTTP body. This seems like a bug to me. Is this by design? Thanks in advance! Ben - 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/
Re: Unit Test AjaxRequestTarget.appendJavascript
You can use PowerMock to register a mock via WebApplication#newAjaxRequestTarget() On Fri, Nov 30, 2012 at 4:16 PM, Tom Norton tomwnorton.mailing.li...@gmail.com wrote: Is it possible to test that appendJavascript is called on wicket 1.5? Thanks, Tom -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Re: Unit Test AjaxRequestTarget.appendJavascript
Thanks a bunch :D On Fri, Nov 30, 2012 at 10:19 AM, Martin Grigorov mgrigo...@apache.orgwrote: You can use PowerMock to register a mock via WebApplication#newAjaxRequestTarget() On Fri, Nov 30, 2012 at 4:16 PM, Tom Norton tomwnorton.mailing.li...@gmail.com wrote: Is it possible to test that appendJavascript is called on wicket 1.5? Thanks, Tom -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Re: Unit Test AjaxRequestTarget.appendJavascript
I tried to implement this, but newAjaxRequestTarget is final :( On Fri, Nov 30, 2012 at 10:24 AM, Tom Norton tomwnorton.mailing.li...@gmail.com wrote: Thanks a bunch :D On Fri, Nov 30, 2012 at 10:19 AM, Martin Grigorov mgrigo...@apache.orgwrote: You can use PowerMock to register a mock via WebApplication#newAjaxRequestTarget() On Fri, Nov 30, 2012 at 4:16 PM, Tom Norton tomwnorton.mailing.li...@gmail.com wrote: Is it possible to test that appendJavascript is called on wicket 1.5? Thanks, Tom -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Re: Unit Test AjaxRequestTarget.appendJavascript
Sorry. See org.apache.wicket.protocol.http.WebApplication#setAjaxRequestTargetProvider On Fri, Nov 30, 2012 at 4:34 PM, Tom Norton tomwnorton.mailing.li...@gmail.com wrote: I tried to implement this, but newAjaxRequestTarget is final :( On Fri, Nov 30, 2012 at 10:24 AM, Tom Norton tomwnorton.mailing.li...@gmail.com wrote: Thanks a bunch :D On Fri, Nov 30, 2012 at 10:19 AM, Martin Grigorov mgrigo...@apache.org wrote: You can use PowerMock to register a mock via WebApplication#newAjaxRequestTarget() On Fri, Nov 30, 2012 at 4:16 PM, Tom Norton tomwnorton.mailing.li...@gmail.com wrote: Is it possible to test that appendJavascript is called on wicket 1.5? Thanks, Tom -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/ -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Re: Resources used as an API
Thanks! For posterity: https://issues.apache.org/jira/browse/WICKET-4900 On Fri, Nov 30, 2012 at 10:13 AM, Martin Grigorov mgrigo...@apache.org wrote: Please file a ticket. On Fri, Nov 30, 2012 at 3:55 PM, Benjamin Heiskell ben.heisk...@gmail.comwrote: Hi, I needed to implement a dynamic JSON API for programmatic consumption by another application. I ended up implementing AbstractResource to accomplish this task (using Wicket 6.2.0.). First question, does this violate the intent of resources? If so, is there a good way to do this within Wicket? Or, would you strongly suggest I use a more traditional API framework (e.g., Jersey)? If resources should be able to perform this task, I ran into some weird behavior. When I explicitly setStatusCode on ResourceResponse to 200, the HTTP body of the response came back empty. I'm pretty sure this is due to the following check in AbstractResource#respond: if (!data.dataNeedsToBeWritten(attributes) || data.getErrorCode() != null || data.getStatusCode() != null) { return; } My use case is trivial (200 on success, 500 on error). So, it was easy enough to remove the explicit declaration of a 200 and let it default to OK. However there are many other status codes that are not errors that might warrant a HTTP body. This seems like a bug to me. Is this by design? Thanks in advance! Ben - 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
Re: Unit Test AjaxRequestTarget.appendJavascript
I was finally able to get it to work with PowerMock. I forgot to add both the WebApplication and the AjaxRequestTarget to the PrepareForTest annotation. Thanks for your help, Tom On Fri, Nov 30, 2012 at 10:40 AM, Martin Grigorov mgrigo...@apache.orgwrote: Sorry. See org.apache.wicket.protocol.http.WebApplication#setAjaxRequestTargetProvider On Fri, Nov 30, 2012 at 4:34 PM, Tom Norton tomwnorton.mailing.li...@gmail.com wrote: I tried to implement this, but newAjaxRequestTarget is final :( On Fri, Nov 30, 2012 at 10:24 AM, Tom Norton tomwnorton.mailing.li...@gmail.com wrote: Thanks a bunch :D On Fri, Nov 30, 2012 at 10:19 AM, Martin Grigorov mgrigo...@apache.org wrote: You can use PowerMock to register a mock via WebApplication#newAjaxRequestTarget() On Fri, Nov 30, 2012 at 4:16 PM, Tom Norton tomwnorton.mailing.li...@gmail.com wrote: Is it possible to test that appendJavascript is called on wicket 1.5? Thanks, Tom -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/ -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Re: understanding ajax response
I see a solution for this case. If you can provide a quickstart app then please attach it to a ticket in our Jira so I can test with it. On Fri, Nov 30, 2012 at 7:45 PM, saty satya...@gmail.com wrote: Below is a part of overall response, the error in this run is: [13:33:14.799] Wicket.Ajax: Wicket.Ajax.Call.processEvaluation: Exception evaluating javascript: InternalError: too much recursion, text: Wicket.Ajax.ajax({f:form371,u:./?2-5.IBehaviorListener.0-homePageTabs-panel-pricingPropertyTabs-panel-fitlerGridPanel-snapshotGridForm-snapshotGrid-form-bodyContainer-body-row-2-item-checkBox-checkbox,e:click,c:checkbox383,pre:[function(attrs){window.setTimeout(function(){this.checked=!this.checked}.bind(this),0);null}],m:POST}); Also included this portion under evaluate... ajax-response component id=snapshot_date3ed ... /component component id=snapshotGrid3e6 . . . /component header-contribution encoding=wicket1 . . . /header-contribution priority-evaluate /priority-evaluate priority-evaluate /priority-evaluate /priority-evaluate priority-evaluate /priority-evaluate . . . . . evaluate encoding=wicket1 /evaluate evaluate encoding=wicket1 /evaluate evaluate /evaluate evaluate encoding=wicket1 /evaluate evaluate encoding=wicket1 /evaluate evaluate /evaluate evaluate encoding=wicket1 /evaluate . . . . . /ajax-response -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/understanding-ajax-response-tp4654310p4654393.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 -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Re: Validators in Wicket 6
So the intentional use that you register other converters with a field other than those intended for use with the model? An example: You've added a behavior to a component, which renders a value into the title attribute of the tag. The value might be a number, while the component's model object is a date. The component provides the converter for each of these values, i.e. a NumberConverter and a DateConverter. I just can't conceive of why you would even want a converter for a field's label. You would't ;). All vars of error messages are converted, it just happens that the label is one of them. We might want to shortcut this by checking the type of the variable if it's already a String (before trying to convert it). Hope this helps Sven On 11/30/2012 08:51 PM, Hobbes00uk wrote: So the intentional use that you register other converters with a field other than those intended for use with the model? I just can't conceive of why you would even want a converter for a field's label. It just seems a bizarre thing to do. I can sort of see that it's a place to stick handy converters perhaps, but it does seem like a weird hack. That was my point really, I was really trying to understand under what conditions this place to stuff converters other than the one for the model would be useful. I could see what the code did... I just didn't understand *why* that is considered useful (and it obviously wasn't legacy having been deliberately implemented). -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Validators-in-Wicket-6-tp4654349p4654396.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
Wicket 6 Ajax Behaviors
I have some older javascript code that I am migrating to work with Wicket 6 and not sure how to do so. I had some javascript that was triggering the onclick of an element in the following way, somedomeelement.click(); // post wicket 1.4 this causes error - TypeError: Property 'onclick' of object #HTMLTableRowElement is not a function. Post wicket 6 (1.5?) this will not work because of how wicket no longer produces the onclick attribute and instead uses event registration. So, my question, how do I need to modify my javascript to be able to trigger the click event, because elem.click(); doesn't work. J.D.
Re: Wicket 6 Ajax Behaviors
See http://api.jquery.com/triggerHandler/ On Fri, Nov 30, 2012 at 10:20 PM, Corbin, James jcor...@iqnavigator.comwrote: I have some older javascript code that I am migrating to work with Wicket 6 and not sure how to do so. I had some javascript that was triggering the onclick of an element in the following way, somedomeelement.click(); // post wicket 1.4 this causes error - TypeError: Property 'onclick' of object #HTMLTableRowElement is not a function. Post wicket 6 (1.5?) this will not work because of how wicket no longer produces the onclick attribute and instead uses event registration. So, my question, how do I need to modify my javascript to be able to trigger the click event, because elem.click(); doesn't work. J.D. -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Re: Validators in Wicket 6
You would't ;). All vars of error messages are converted, it just happens that the label is one of them. We might want to shortcut this by checking the type of the variable if it's already a String (before trying to convert it). Hope this helps It does and thank you for taking the time to explain it, it is appreciated. Matt -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Validators-in-Wicket-6-tp4654349p4654400.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
WicketRuntimeException: Attempted to set property value on a null object
I have a Person Hibernate/JPA entity with an @Embedded address object in it: @Entity public class Person { ... @Embedded private Address address; ... } I have a Panel with a Form for editing the Address (EditAddressFormPanel) and a panel for editing the Person which uses the Panel for editing (EditPersonFormPanel). public class EditPersonFormPanel extends Panel { public EditPersonFormPanel(String cid, IModelPerson model) { super(cid, model); // create the person form Form form = ... // add the address form panel to it form.add(new EditAddressFormPanel(address, new PropertyModelAddress(model, address)); ... } } This works if the Person.address field is not null. However, because of the way that JPA works, the address field will be null if all of the fields in the class are null. For example, if a Person object was persisted without an initial address (i.e., address = null). When this happens, org.apache.wicket.model.AbstractPropertyModel.getInnermostModelOrObject() returns null and I ultimately get a WicketRuntimeException: Attempted to set property value on a null object in PropertyResolver.setValue because the object is null. My question is how to deal this this correctly at the model level. I think IModel.setObject should create a new object if the incoming object is null and IModel.getObject should return null if no fields are set on the object to match how JPA/Hibernate handles this. How do other people handle this problem? Is there a good model to extend from (maybe something like IWrapModel)? Any examples? Thanks Andrew PS I'm already using EntityModels (http://wicketinaction.com/2008/09/building-a-smart-entitymodel/) - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: WicketRuntimeException: Attempted to set property value on a null object
Why not handle this in your domain objects already? @Entity public class Person { ... @Embedded private Address address; ... public Address getAddress() { if (address == null) { address = new Address(); } return address; } } Sven On 11/30/2012 11:49 PM, Andrew Geery wrote: I have a Person Hibernate/JPA entity with an @Embedded address object in it: @Entity public class Person { ... @Embedded private Address address; ... } I have a Panel with a Form for editing the Address (EditAddressFormPanel) and a panel for editing the Person which uses the Panel for editing (EditPersonFormPanel). public class EditPersonFormPanel extends Panel { public EditPersonFormPanel(String cid, IModelPerson model) { super(cid, model); // create the person form Form form = ... // add the address form panel to it form.add(new EditAddressFormPanel(address, new PropertyModelAddress(model, address)); ... } } This works if the Person.address field is not null. However, because of the way that JPA works, the address field will be null if all of the fields in the class are null. For example, if a Person object was persisted without an initial address (i.e., address = null). When this happens, org.apache.wicket.model.AbstractPropertyModel.getInnermostModelOrObject() returns null and I ultimately get a WicketRuntimeException: Attempted to set property value on a null object in PropertyResolver.setValue because the object is null. My question is how to deal this this correctly at the model level. I think IModel.setObject should create a new object if the incoming object is null and IModel.getObject should return null if no fields are set on the object to match how JPA/Hibernate handles this. How do other people handle this problem? Is there a good model to extend from (maybe something like IWrapModel)? Any examples? Thanks Andrew PS I'm already using EntityModels (http://wicketinaction.com/2008/09/building-a-smart-entitymodel/) - 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: WicketRuntimeException: Attempted to set property value on a null object
The problem with doing that is that Hibernate detects that as a change (a null object is not the same as an empty object) and does a database update (see some of the comments on this: https://issues.jboss.org/browse/HIBERNATE-50). Andrew On Fri, Nov 30, 2012 at 5:59 PM, Sven Meier s...@meiers.net wrote: d - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: select2 integration -Duplicate(selected) value are appear in drop down box
FooProvider implementation is public class FooProvider extends TextChoiceProviderFoo { FooService fooService=new FooService(); @Override protected String getDisplayText(Foo fooChoice) { return fooChoice.getName(); } @Override protected Object getId(Foo fooChoice) { return fooChoice.getName; } @Override public void query(String term, int page, ResponseFoo response) { response.addAll(queryMatches(term, page, 10)); response.setHasMore(response.size() == 10); } @Override public CollectionFoo toChoices(CollectionString ids) { ArrayListFoo foos = new ArrayListFoo(); for (String id : ids) { foos.add(fooService.findFooByName(id)); } return foos; } } private ListFoo queryMatches(String term, int page, int pageSize) { ListFoo result = new ArrayListFoo(); term = term.toUpperCase(); final int offset = page * pageSize; int matched = 0; for ( Foo foo : getAllFoos()) { if (result.size() == pageSize) { break; } if (foo.getName().toUpperCase().contains(term)) { matched++; if (matched offset) { result.add(foo); } } } return result; } public ListFoo getAllFoos() { //return all foos return fooService.findAll(); }