Implement Check Availability link
I need to implement a Check Availability link. When this link is clicked it will check if the entered username exists for not For this link I have used AjaxLink. The problem is in AjaxLink's onClick I am not sure how will I fetch the value of the text filed - username? The model seems not to hold the value.. Please suggest. Regards, Apple Grew my blog @ http://blog.applegrew.com/
Re: Implement Check Availability link
They already are in a form along with other text fields. I tired playing with AjaxSubmitLink, but here too I fail to fetch the username from model as other fields still do not have the required inputs, causing the form to report error. Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Sun, May 16, 2010 at 2:00 PM, Martin Makundi martin.maku...@koodaripalvelut.com wrote: Use ajaxButton : form wicket:id=nameform input type=text wicket:id=namefield/ input type=button wicket:id=ajax-button-for-name-form/ /form ** Martin 2010/5/16 Apple Grew appleg...@gmail.com: I need to implement a Check Availability link. When this link is clicked it will check if the entered username exists for not For this link I have used AjaxLink. The problem is in AjaxLink's onClick I am not sure how will I fetch the value of the text filed - username? The model seems not to hold the value.. Please suggest. Regards, Apple Grew my blog @ http://blog.applegrew.com/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Implement Check Availability link
They already are in a form along with other text fields. I tired playing with AjaxSubmitLink, but here too I fail to fetch the username from model as other fields still do not have the required inputs, causing the form to report error. Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Sun, May 16, 2010 at 2:00 PM, Martin Makundi martin.maku...@koodaripalvelut.com wrote: Use ajaxButton : form wicket:id=nameform input type=text wicket:id=namefield/ input type=button wicket:id=ajax-button-for-name-form/ /form ** Martin 2010/5/16 Apple Grew appleg...@gmail.com: I need to implement a Check Availability link. When this link is clicked it will check if the entered username exists for not For this link I have used AjaxLink. The problem is in AjaxLink's onClick I am not sure how will I fetch the value of the text filed - username? The model seems not to hold the value.. Please suggest. Regards, Apple Grew my blog @ http://blog.applegrew.com/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Implement Check Availability link
Is there any other way around? Adding nested form will change my markup which I don't want to do just for this purpose. The solution I am looking for, is there any way I can capture the username's value using javascript and send to my component via Wicket's Ajax? Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Sun, May 16, 2010 at 3:44 PM, Martin Makundi martin.maku...@koodaripalvelut.com wrote: Make smaller NESTED form with only components that you need. ** Martin 2010/5/16 Apple Grew appleg...@gmail.com: They already are in a form along with other text fields. I tired playing with AjaxSubmitLink, but here too I fail to fetch the username from model as other fields still do not have the required inputs, causing the form to report error. Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Sun, May 16, 2010 at 2:00 PM, Martin Makundi martin.maku...@koodaripalvelut.com wrote: Use ajaxButton : form wicket:id=nameform input type=text wicket:id=namefield/ input type=button wicket:id=ajax-button-for-name-form/ /form ** Martin 2010/5/16 Apple Grew appleg...@gmail.com: I need to implement a Check Availability link. When this link is clicked it will check if the entered username exists for not For this link I have used AjaxLink. The problem is in AjaxLink's onClick I am not sure how will I fetch the value of the text filed - username? The model seems not to hold the value.. Please suggest. Regards, Apple Grew my blog @ http://blog.applegrew.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: Implement Check Availability link
Unfortunately textfield.getconvertedinput() return null. That's why I am stuck. Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Sun, May 16, 2010 at 7:28 PM, vineet semwal vineetsemwal1...@gmail.comwrote: you can just do textfield.updateModel(),that will update textfield model for you,you can do it inside onerror of ajaxsubmitlink or inside a validator that you have written. if you just want to read textfield's user input use textfield.getconvertedinput(). On Sun, May 16, 2010 at 4:40 PM, Apple Grew appleg...@gmail.com wrote: Is there any other way around? Adding nested form will change my markup which I don't want to do just for this purpose. The solution I am looking for, is there any way I can capture the username's value using javascript and send to my component via Wicket's Ajax? Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Sun, May 16, 2010 at 3:44 PM, Martin Makundi martin.maku...@koodaripalvelut.com wrote: Make smaller NESTED form with only components that you need. ** Martin 2010/5/16 Apple Grew appleg...@gmail.com: They already are in a form along with other text fields. I tired playing with AjaxSubmitLink, but here too I fail to fetch the username from model as other fields still do not have the required inputs, causing the form to report error. Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Sun, May 16, 2010 at 2:00 PM, Martin Makundi martin.maku...@koodaripalvelut.com wrote: Use ajaxButton : form wicket:id=nameform input type=text wicket:id=namefield/ input type=button wicket:id=ajax-button-for-name-form/ /form ** Martin 2010/5/16 Apple Grew appleg...@gmail.com: I need to implement a Check Availability link. When this link is clicked it will check if the entered username exists for not For this link I have used AjaxLink. The problem is in AjaxLink's onClick I am not sure how will I fetch the value of the text filed - username? The model seems not to hold the value.. Please suggest. Regards, Apple Grew my blog @ http://blog.applegrew.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 -- regards, Vineet Semwal
Re: Implement Check Availability link
Thanks a lot to all. Finally it worked. I added AjaxFormUpdatingBehavior (triggered on onblur) to the textfield and used AjaxSubmitLink for the link, and now it works. One confusion though. I tried using AjaxLink and it didn't work. As I understand that AjaxFormUpdatingBehavior should be invoked on blur event, this has nothing to do with the nature of the link, then how come making the link-non-submitting doesn't work? Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Mon, May 17, 2010 at 2:56 AM, Jeremy Thomerson jer...@wickettraining.com wrote: Ah, but he's *not* using the ajaxsubmitlink - which (again) is the problem. He said he tried it and it didn't work for him because other fields failed validation. Which is why he needs the behavior that only validates a single field. -- Jeremy Thomerson http://www.wickettraining.com On Sun, May 16, 2010 at 4:23 PM, vineet semwal vineetsemwal1...@gmail.comwrote: he is using the textfield inside form,ajaxsubmitlink itself has formsubmittingbehavior so i think it should work.. btw ajaxformcomponentupdatingbehavior is nice for this usecase. On Mon, May 17, 2010 at 2:44 AM, Jeremy Thomerson jer...@wickettraining.com wrote: It's not going to work if he's not using a form submitting behavior or else a custom behavior that grabs the value of the textfield and adds it to the URL as a query param, then his behavior can get this from the request. But the simplest way (as mentioned earlier) is to use ajaxformcomponentupdatingbehavior -- Jeremy Thomerson http://www.wickettraining.com On Sun, May 16, 2010 at 4:03 PM, vineet semwal vineetsemwal1...@gmail.comwrote: should work,have you tried it in onerror method? On Sun, May 16, 2010 at 11:02 PM, Apple Grew appleg...@gmail.com wrote: Unfortunately textfield.getconvertedinput() return null. That's why I am stuck. Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Sun, May 16, 2010 at 7:28 PM, vineet semwal vineetsemwal1...@gmail.comwrote: you can just do textfield.updateModel(),that will update textfield model for you,you can do it inside onerror of ajaxsubmitlink or inside a validator that you have written. if you just want to read textfield's user input use textfield.getconvertedinput(). On Sun, May 16, 2010 at 4:40 PM, Apple Grew appleg...@gmail.com wrote: Is there any other way around? Adding nested form will change my markup which I don't want to do just for this purpose. The solution I am looking for, is there any way I can capture the username's value using javascript and send to my component via Wicket's Ajax? Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Sun, May 16, 2010 at 3:44 PM, Martin Makundi martin.maku...@koodaripalvelut.com wrote: Make smaller NESTED form with only components that you need. ** Martin 2010/5/16 Apple Grew appleg...@gmail.com: They already are in a form along with other text fields. I tired playing with AjaxSubmitLink, but here too I fail to fetch the username from model as other fields still do not have the required inputs, causing the form to report error. Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Sun, May 16, 2010 at 2:00 PM, Martin Makundi martin.maku...@koodaripalvelut.com wrote: Use ajaxButton : form wicket:id=nameform input type=text wicket:id=namefield/ input type=button wicket:id=ajax-button-for-name-form/ /form ** Martin 2010/5/16 Apple Grew appleg...@gmail.com: I need to implement a Check Availability link. When this link is clicked it will check if the entered username exists for not For this link I have used AjaxLink. The problem is in AjaxLink's onClick I am not sure how will I fetch the value of the text filed - username? The model seems not to hold the value.. Please suggest. Regards, Apple Grew my blog @ http://blog.applegrew.com/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Strip header contributors from Ajax response.
Hi All, Thanks for all the responses. I got this solved by making my behavior extend AbstractHeaderContributor. In its getHeaderContributors() I return the list of headers only if response is not ajax. In case of ajax I simply return null. Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Fri, Apr 30, 2010 at 3:44 AM, DV danielavalero...@gmail.com wrote: Another more complicated way seems to be using SharedResources and DynamicWebResources, an example of this, you can find it on UploadStatusResource class of wicket.extensions.ajax.markup.html.form.upload package -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Strip-header-contributors-from-Ajax-response-tp2019993p2076272.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Strip header contributors from Ajax response.
Hi Igor, It is not that duplicates items are getting rendered. What I want is that the Js should be rendered ONLY when rendering in non-Ajax mode. In Ajax mode the Js code should be stripped out. As these Js codes are not executed when in Ajax response so it doesn't make sense to render them there. This unnecessarily bloats the response. Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Thu, Apr 22, 2010 at 10:50 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote: wicket will filter duplicate contributions for you and even though they are rendered they are not executed. if you are writing out javascript directly you can set a string id which uniquely identifies the contribution and wicket will also filter by that. -igor On Wed, Apr 21, 2010 at 8:40 PM, Apple Grew appleg...@gmail.com wrote: I have a component which contributes Js headers. This component is also rendered by AjaxRequestTarget. The problem is that when rendering ajax response the Js codes too are getting rendered. These Js codes were already contributed when this component first rendered (in non-Ajax mode). To fix this what I initially did was that in the onBeforeRender method of the component I was checking if the response NOT isAjax then add the header contributors, else, remove them. This was working fine, but problem is if I want to implement this is other components I would have to copy n paste the codes. So I decided to implement a behavior. I added all the header contributors to that behavior and it was supposed to do the job of adding n removing the header contributors. But we can't modify hierarchy from beforeRender of behavior so I am now stuck. Furthermore, this approach is not capable of removing JS contributed by super calsses of the componenet. Please suggest. Thanks and regards, Apple Grew my blog @ http://blog.applegrew.com/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Strip header contributors from Ajax response.
@Igor I have a very tight budget so the resources are pretty limited, so I need to save the bandwidth wherever possible. BTW I didn't find any class - iheaderresponsecontributor. Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Fri, Apr 23, 2010 at 8:37 AM, Igor Vaynberg igor.vaynb...@gmail.comwrote: amd this bloating has caused a noticeable slowdown in your site's response times? how much latency is it adding to the response? that said, you can always output it using iheaderresponsecontributor and add an check if you are inside ajax or not using request.isajax() -igor On Thu, Apr 22, 2010 at 6:29 PM, Apple Grew appleg...@gmail.com wrote: Hi Igor, It is not that duplicates items are getting rendered. What I want is that the Js should be rendered ONLY when rendering in non-Ajax mode. In Ajax mode the Js code should be stripped out. As these Js codes are not executed when in Ajax response so it doesn't make sense to render them there. This unnecessarily bloats the response. Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Thu, Apr 22, 2010 at 10:50 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: wicket will filter duplicate contributions for you and even though they are rendered they are not executed. if you are writing out javascript directly you can set a string id which uniquely identifies the contribution and wicket will also filter by that. -igor On Wed, Apr 21, 2010 at 8:40 PM, Apple Grew appleg...@gmail.com wrote: I have a component which contributes Js headers. This component is also rendered by AjaxRequestTarget. The problem is that when rendering ajax response the Js codes too are getting rendered. These Js codes were already contributed when this component first rendered (in non-Ajax mode). To fix this what I initially did was that in the onBeforeRender method of the component I was checking if the response NOT isAjax then add the header contributors, else, remove them. This was working fine, but problem is if I want to implement this is other components I would have to copy n paste the codes. So I decided to implement a behavior. I added all the header contributors to that behavior and it was supposed to do the job of adding n removing the header contributors. But we can't modify hierarchy from beforeRender of behavior so I am now stuck. Furthermore, this approach is not capable of removing JS contributed by super calsses of the componenet. Please suggest. Thanks and regards, Apple Grew my blog @ http://blog.applegrew.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: Strip header contributors from Ajax response.
That's a good point. :) BTW if i implement my own IHeaderContributor how will take advantage of wicket's js code stripper and compressor provided by JavascriptPackageResource? Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Fri, Apr 23, 2010 at 9:46 AM, Igor Vaynberg igor.vaynb...@gmail.comwrote: if you have a million hit site you can probably afford the hosting :) -igor On Thu, Apr 22, 2010 at 8:16 PM, Tim L Casey tca...@cataphora.com wrote: In terms of hosting it is measurable. Each byte of request for a million hit site is 10Mbit of line cost. That being said most latency is about connections and not amount of data. At least in terms of speed up I would look first at reducing things like frames, then resources, then size. Inlined ajax, yeah /shrug with the caveat for hosting solutions. tim -Original Message- From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Sent: Thursday, April 22, 2010 8:08 PM To: users@wicket.apache.org Subject: Re: Strip header contributors from Ajax response. amd this bloating has caused a noticeable slowdown in your site's response times? how much latency is it adding to the response? that said, you can always output it using iheaderresponsecontributor and add an check if you are inside ajax or not using request.isajax() -igor On Thu, Apr 22, 2010 at 6:29 PM, Apple Grew appleg...@gmail.com wrote: Hi Igor, It is not that duplicates items are getting rendered. What I want is that the Js should be rendered ONLY when rendering in non-Ajax mode. In Ajax mode the Js code should be stripped out. As these Js codes are not executed when in Ajax response so it doesn't make sense to render them there. This unnecessarily bloats the response. Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Thu, Apr 22, 2010 at 10:50 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote: wicket will filter duplicate contributions for you and even though they are rendered they are not executed. if you are writing out javascript directly you can set a string id which uniquely identifies the contribution and wicket will also filter by that. -igor On Wed, Apr 21, 2010 at 8:40 PM, Apple Grew appleg...@gmail.com wrote: I have a component which contributes Js headers. This component is also rendered by AjaxRequestTarget. The problem is that when rendering ajax response the Js codes too are getting rendered. These Js codes were already contributed when this component first rendered (in non-Ajax mode). To fix this what I initially did was that in the onBeforeRender method of the component I was checking if the response NOT isAjax then add the header contributors, else, remove them. This was working fine, but problem is if I want to implement this is other components I would have to copy n paste the codes. So I decided to implement a behavior. I added all the header contributors to that behavior and it was supposed to do the job of adding n removing the header contributors. But we can't modify hierarchy from beforeRender of behavior so I am now stuck. Furthermore, this approach is not capable of removing JS contributed by super calsses of the componenet. Please suggest. Thanks and regards, Apple Grew my blog @ http://blog.applegrew.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: Strip header contributors from Ajax response.
ohk... will check. Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Fri, Apr 23, 2010 at 10:08 AM, Igor Vaynberg igor.vaynb...@gmail.comwrote: you use iheadercontributor to write out the url to the resourse, which i think will point to the javascriptpackageresource. -igor On Thu, Apr 22, 2010 at 9:29 PM, Apple Grew appleg...@gmail.com wrote: That's a good point. :) BTW if i implement my own IHeaderContributor how will take advantage of wicket's js code stripper and compressor provided by JavascriptPackageResource? Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Fri, Apr 23, 2010 at 9:46 AM, Igor Vaynberg igor.vaynb...@gmail.com wrote: if you have a million hit site you can probably afford the hosting :) -igor On Thu, Apr 22, 2010 at 8:16 PM, Tim L Casey tca...@cataphora.com wrote: In terms of hosting it is measurable. Each byte of request for a million hit site is 10Mbit of line cost. That being said most latency is about connections and not amount of data. At least in terms of speed up I would look first at reducing things like frames, then resources, then size. Inlined ajax, yeah /shrug with the caveat for hosting solutions. tim -Original Message- From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Sent: Thursday, April 22, 2010 8:08 PM To: users@wicket.apache.org Subject: Re: Strip header contributors from Ajax response. amd this bloating has caused a noticeable slowdown in your site's response times? how much latency is it adding to the response? that said, you can always output it using iheaderresponsecontributor and add an check if you are inside ajax or not using request.isajax() -igor On Thu, Apr 22, 2010 at 6:29 PM, Apple Grew appleg...@gmail.com wrote: Hi Igor, It is not that duplicates items are getting rendered. What I want is that the Js should be rendered ONLY when rendering in non-Ajax mode. In Ajax mode the Js code should be stripped out. As these Js codes are not executed when in Ajax response so it doesn't make sense to render them there. This unnecessarily bloats the response. Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Thu, Apr 22, 2010 at 10:50 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote: wicket will filter duplicate contributions for you and even though they are rendered they are not executed. if you are writing out javascript directly you can set a string id which uniquely identifies the contribution and wicket will also filter by that. -igor On Wed, Apr 21, 2010 at 8:40 PM, Apple Grew appleg...@gmail.com wrote: I have a component which contributes Js headers. This component is also rendered by AjaxRequestTarget. The problem is that when rendering ajax response the Js codes too are getting rendered. These Js codes were already contributed when this component first rendered (in non-Ajax mode). To fix this what I initially did was that in the onBeforeRender method of the component I was checking if the response NOT isAjax then add the header contributors, else, remove them. This was working fine, but problem is if I want to implement this is other components I would have to copy n paste the codes. So I decided to implement a behavior. I added all the header contributors to that behavior and it was supposed to do the job of adding n removing the header contributors. But we can't modify hierarchy from beforeRender of behavior so I am now stuck. Furthermore, this approach is not capable of removing JS contributed by super calsses of the componenet. Please suggest. Thanks and regards, Apple Grew my blog @ http://blog.applegrew.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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Strip header contributors from Ajax response.
I have a component which contributes Js headers. This component is also rendered by AjaxRequestTarget. The problem is that when rendering ajax response the Js codes too are getting rendered. These Js codes were already contributed when this component first rendered (in non-Ajax mode). To fix this what I initially did was that in the onBeforeRender method of the component I was checking if the response NOT isAjax then add the header contributors, else, remove them. This was working fine, but problem is if I want to implement this is other components I would have to copy n paste the codes. So I decided to implement a behavior. I added all the header contributors to that behavior and it was supposed to do the job of adding n removing the header contributors. But we can't modify hierarchy from beforeRender of behavior so I am now stuck. Furthermore, this approach is not capable of removing JS contributed by super calsses of the componenet. Please suggest. Thanks and regards, Apple Grew my blog @ http://blog.applegrew.com/
Re: Shutting down wicketstuff jira and confluence (temporarily)
Shame real shame. Why ppl have to exercise their intellectual evilness on community sites like these. Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Mon, Apr 19, 2010 at 11:02 PM, nino martinez wael nino.martinez.w...@gmail.com wrote: Great news :) 2010/4/19 Martijn Dashorst martijn.dasho...@gmail.com: In the light of the current JIRA XSS attacks I've shut down JIRA and Confluence, pending an investigation and upgrade of both products. Martijn -- Become a Wicket expert, learn from the best: http://wicketinaction.com Apache Wicket 1.4 increases type safety for web applications Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.4 - 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: resources folder / package
@Eyal Maybe you would like to have a look at this thread. http://n4.nabble.com/resource-css-loading-td1878209.html Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Fri, Apr 16, 2010 at 2:41 AM, Eyal Golan egola...@gmail.com wrote: hi, thanks. I know this, but my question was different. I saw in some projects that the JS and CSS files are in the same hierarchy as the class that is used for their scope, but the main folder is different. Example: I have a Java class: com.myCompany.ResourceScope.java it is located under src. I have a file called MyCss.css, which is located under com.myCompany but it is located under resources folder. both src and resources are under the same project. in the projects I saw, you can call for this resource reference with the ResourceScope class. I tried to do the same without success. Any thoughts? Eyal Golan egola...@gmail.com Visit: http://jvdrums.sourceforge.net/ LinkedIn: http://www.linkedin.com/in/egolan74 P Save a tree. Please don't print this e-mail unless it's really necessary On Thu, Apr 15, 2010 at 4:46 PM, Sigmar Muuga meedi...@gmail.com wrote: You can define packages and put all CSS / JS files into them. Note that there must be some class also along with them, it may be an empty class. Then you can reference these resources using that class declaration. Note that if your css uses images, then you have to put correct paths into that css. Sigmar On Thu, Apr 15, 2010 at 2:43 PM, Eyal Golan egola...@gmail.com wrote: Hello to you all, it's been a very long time since I wrote here. I have a question regarding folder locations. I am working with WiQuery and it is unbelievable great. Also the support there (thanks indiana ;) ) In WiQuery there are 'themes' and the location of the CSS and images is in a separate folder called 'resources' , which has the same structure as of the Java classes themselves. I wanted to do the same in my project without success. Should I configure something other than just put the same hierarchy? thanks for the help. My question is Eyal Golan egola...@gmail.com Visit: http://jvdrums.sourceforge.net/ LinkedIn: http://www.linkedin.com/in/egolan74 P Save a tree. Please don't print this e-mail unless it's really necessary
Re: resource (css) loading
u r welcome. Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Sun, Apr 11, 2010 at 11:48 AM, sahar rostami sahar.rost...@gmail.comwrote: Thanks so much dear apple grew! Regards On Sun, Apr 11, 2010 at 9:49 AM, Apple Grew appleg...@gmail.com wrote: Maybe it was stripped by Wicket Mailing list. Anyway I will paste the code in the mail itself. Regards, Apple Grew my blog @ http://blog.applegrew.com/ --Code Starts-- /** * Web based application for e-shopping. * Copyright (C) 2010 Nirupam Biswas (AppleGrew) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see http://www.gnu.org/licenses/. */ package com.sym.core; import java.util.Arrays; import java.util.List; import org.apache.wicket.util.resource.IResourceStream; import org.apache.wicket.util.resource.locator.ResourceStreamLocator; import com.sym.core.utils.MiscUtils; import com.sym.html.pages.BaseLayoutPage; public class AppStreamLocator extends ResourceStreamLocator { private static final String HTML_EXT = .html; private static final String CSS_EXT = .css; private static final String JS_PATH = /js/; private static final String CSS_PATH = /css/; private static final String IMG_PATH = /img/; private static final ListString IMG_EXTS = Arrays.asList(new String[]{ .png, .jpg, .gif, .svg }); private static final String PAGES_PACKAGE = BaseLayoutPage.class.getPackage().getName(); private static final int PG_PACKAGE_NAME_LEN = PAGES_PACKAGE.length(); private static final int GLOBAL_PACKAGE_NAME_LEN = ApplicationCore.class.getPackage().getName().length(); @Override public IResourceStream locate(final Class? clazz, String path) { //Only pages' (not components or panel etc.s') HTMLs and CSS will be fetched from 'res' directory. if(clazz.getName().startsWith(PAGES_PACKAGE)){ IResourceStream located = null; if (path.endsWith(HTML_EXT) || path.endsWith(CSS_EXT)) { located = super.locate(clazz, html/ + ApplicationCore.getThemeName() + trimFolders(path, false)); }else if (IMG_EXTS.contains(MiscUtils.getExt(path))) { located = super.locate(clazz, /img + trimFolders(path, false)); } if (located != null) { return located; } }else if(clazz.equals(ApplicationCore.class)){ //Global shared resources have been requested. IResourceStream located = null; path = trimFolders(path, true); if (path.startsWith(CSS_PATH) || path.startsWith(JS_PATH) || path.startsWith(IMG_PATH)) { located = super.locateByResourceFinder(clazz, path); if(located == null path.startsWith(CSS_PATH)) { located = super.locateByResourceFinder(clazz, CSS_PATH + ApplicationCore.getThemeName() + path.substring(path.indexOf(CSS_PATH) + CSS_PATH.length() - 1)); } } return located; } return super.locate(clazz, path); } private String trimFolders(final String path, final boolean isGlobalPath) { return isGlobalPath? path.substring(GLOBAL_PACKAGE_NAME_LEN) : path.substring(PG_PACKAGE_NAME_LEN); } } --Code Ends-- On Sun, Apr 11, 2010 at 9:18 AM, sahar rostami sahar.rost...@gmail.com wrote: thank you Apple Grew I can't receive your attachments. Are you sure they have been attached ? On Thu, Apr 8, 2010 at 6:34 AM, Apple Grew appleg...@gmail.com wrote: Maybe u can try writing a stream locator as I did. I am attaching my stream locator with this mail. The necessary plumbing required with this is:- resourceSettings.addResourceFolder(WEB-INF/res); resourceSettings.setResourceStreamLocator(new AppStreamLocator()); getSharedResources().putClassAlias(ApplicationCore.class, global); The above needs to be put in your Application class. Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Wed, Apr 7, 2010 at 10:19 PM, Stefan Lindner lind...@visionet.de wrote: You could e.g. write your own page class class MyCustomersPage extens Page
Re: resource (css) loading
Maybe it was stripped by Wicket Mailing list. Anyway I will paste the code in the mail itself. Regards, Apple Grew my blog @ http://blog.applegrew.com/ --Code Starts-- /** * Web based application for e-shopping. * Copyright (C) 2010 Nirupam Biswas (AppleGrew) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see http://www.gnu.org/licenses/. */ package com.sym.core; import java.util.Arrays; import java.util.List; import org.apache.wicket.util.resource.IResourceStream; import org.apache.wicket.util.resource.locator.ResourceStreamLocator; import com.sym.core.utils.MiscUtils; import com.sym.html.pages.BaseLayoutPage; public class AppStreamLocator extends ResourceStreamLocator { private static final String HTML_EXT = .html; private static final String CSS_EXT = .css; private static final String JS_PATH = /js/; private static final String CSS_PATH = /css/; private static final String IMG_PATH = /img/; private static final ListString IMG_EXTS = Arrays.asList(new String[]{ .png, .jpg, .gif, .svg }); private static final String PAGES_PACKAGE = BaseLayoutPage.class.getPackage().getName(); private static final int PG_PACKAGE_NAME_LEN = PAGES_PACKAGE.length(); private static final int GLOBAL_PACKAGE_NAME_LEN = ApplicationCore.class.getPackage().getName().length(); @Override public IResourceStream locate(final Class? clazz, String path) { //Only pages' (not components or panel etc.s') HTMLs and CSS will be fetched from 'res' directory. if(clazz.getName().startsWith(PAGES_PACKAGE)){ IResourceStream located = null; if (path.endsWith(HTML_EXT) || path.endsWith(CSS_EXT)) { located = super.locate(clazz, html/ + ApplicationCore.getThemeName() + trimFolders(path, false)); }else if (IMG_EXTS.contains(MiscUtils.getExt(path))) { located = super.locate(clazz, /img + trimFolders(path, false)); } if (located != null) { return located; } }else if(clazz.equals(ApplicationCore.class)){ //Global shared resources have been requested. IResourceStream located = null; path = trimFolders(path, true); if (path.startsWith(CSS_PATH) || path.startsWith(JS_PATH) || path.startsWith(IMG_PATH)) { located = super.locateByResourceFinder(clazz, path); if(located == null path.startsWith(CSS_PATH)) { located = super.locateByResourceFinder(clazz, CSS_PATH + ApplicationCore.getThemeName() + path.substring(path.indexOf(CSS_PATH) + CSS_PATH.length() - 1)); } } return located; } return super.locate(clazz, path); } private String trimFolders(final String path, final boolean isGlobalPath) { return isGlobalPath? path.substring(GLOBAL_PACKAGE_NAME_LEN) : path.substring(PG_PACKAGE_NAME_LEN); } } --Code Ends-- On Sun, Apr 11, 2010 at 9:18 AM, sahar rostami sahar.rost...@gmail.comwrote: thank you Apple Grew I can't receive your attachments. Are you sure they have been attached ? On Thu, Apr 8, 2010 at 6:34 AM, Apple Grew appleg...@gmail.com wrote: Maybe u can try writing a stream locator as I did. I am attaching my stream locator with this mail. The necessary plumbing required with this is:- resourceSettings.addResourceFolder(WEB-INF/res); resourceSettings.setResourceStreamLocator(new AppStreamLocator()); getSharedResources().putClassAlias(ApplicationCore.class, global); The above needs to be put in your Application class. Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Wed, Apr 7, 2010 at 10:19 PM, Stefan Lindner lind...@visionet.de wrote: You could e.g. write your own page class class MyCustomersPage extens Page { @Override public void renderHead(HtmlHeaderContainer container) { super.renderHead(container); cssResourceReference = Session.get().getCssResourceReferenceForcustomer() container.getHeaderResponse().renderCSSReference(cssResourceReference); } } And then let each of your pages be a child of MyCustomersPage Stefan -Ursprüngliche Nachricht- Von
Picking different CSS for different styles.
Hi All, I am trying to create a themable wicket application which has one html per page but different CSS files to change its looks. The CSS files are referenced in the head of the html. The CSS files have been named as - theme_name-all.css. I am very well able to dynamically generate the CSS urls based on the theme name. The theme names are fetched from session, as, MySession.getThemeName(). My concern is, that Wicket might cache the generated html file. So even if the theme changes at runtime, the html with old CSS names will be served. Furthermore, each user can have different themes, but here we have only html. If my understanding is correct then I should set the style to the theme name. I read somewhere that Wicket generates keys to reference the cached resources. So, I am guessing, that user A tries to access Home.html with 'classic' style then Wicket will render and cache that page as (say) classic-Home. Now, if user B tries to access the same page but with style 'jazzy' then Wicket will use another key to store cache. I am simply guessing. Am I on the right track? Will this work? Regards, Apple Grew my blog @ http://blog.applegrew.com/
Re: Picking different CSS for different styles.
@Jeremy If generated Htmls are not cached then how does wicket achieve such good performance? I guess the markups are loaded in memory and the wicket components are filled-in at each request. Is it so? So, if I have a link tag that points to a static url which is modified at runtime by AutoLinkResolver, will that too be refreshed at every request? @Igor CSS are are provided outside Wicket, i.e. by third party application. So if we have say 2 CSSes - all.css and base.css and, two themes - classic and jazzy, then they will be available at static urls like, /classic-all.css /classic-base.css, /jazzy-all.css and /jazzy-base.css. Now if Htmls will have link tag in the head. The urls of the link will be modified at runtime. If generated Htmls are cached then on next access to this page the code to refresh the link url can't be refreshed, and it will continue to point at /classic-all.css instead of /jazzy-all.css. Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Fri, Apr 9, 2010 at 11:08 PM, Jeremy Thomerson jer...@wickettraining.com wrote: Wicket does not cache the *generated HTML, which is I believe what you are concerned about.* -- Jeremy Thomerson http://www.wickettraining.com On Fri, Apr 9, 2010 at 12:18 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: why does it matter if html is cached? you already said its all the same. as far as css resource caching, the theme name is in the url to the css resource as per your example, so once again why does it matter if its cached? -igor On Fri, Apr 9, 2010 at 10:07 AM, Apple Grew appleg...@gmail.com wrote: Hi All, I am trying to create a themable wicket application which has one html per page but different CSS files to change its looks. The CSS files are referenced in the head of the html. The CSS files have been named as - theme_name-all.css. I am very well able to dynamically generate the CSS urls based on the theme name. The theme names are fetched from session, as, MySession.getThemeName(). My concern is, that Wicket might cache the generated html file. So even if the theme changes at runtime, the html with old CSS names will be served. Furthermore, each user can have different themes, but here we have only html. If my understanding is correct then I should set the style to the theme name. I read somewhere that Wicket generates keys to reference the cached resources. So, I am guessing, that user A tries to access Home.html with 'classic' style then Wicket will render and cache that page as (say) classic-Home. Now, if user B tries to access the same page but with style 'jazzy' then Wicket will use another key to store cache. I am simply guessing. Am I on the right track? Will this work? Regards, Apple Grew my blog @ http://blog.applegrew.com/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Picking different CSS for different styles.
Hey Thanks a lot. I guess header contributor will be the best choice. Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Fri, Apr 9, 2010 at 11:31 PM, Jeremy Thomerson jer...@wickettraining.com wrote: Inline On Fri, Apr 9, 2010 at 12:55 PM, Apple Grew appleg...@gmail.com wrote: @Jeremy If generated Htmls are not cached then how does wicket achieve such good performance? I guess the markups are loaded in memory and the wicket components are filled-in at each request. Is it so? Yes - the markup is parsed and cached. Then for each render, it is attached to those components and they render the dynamic portions So, if I have a link tag that points to a static url which is modified at runtime by AutoLinkResolver, will that too be refreshed at every request? It's been a while since I've used AutoLinkResolver, but this should be the case. Just test and see. That's the best answer. @Igor CSS are are provided outside Wicket, i.e. by third party application. So if we have say 2 CSSes - all.css and base.css and, two themes - classic and jazzy, then they will be available at static urls like, /classic-all.css /classic-base.css, /jazzy-all.css and /jazzy-base.css. Now if Htmls will have link tag in the head. The urls of the link will be modified at runtime. If generated Htmls are cached then on next access to this page the code to refresh the link url can't be refreshed, and it will continue to point at /classic-all.css instead of /jazzy-all.css. But generated HTML is not cached. The best way to accomplish what you're doing is not to put the CSS reference in the HTML, because then you have no way to modify it. You should add the CSS reference through a header contributor in your java code so that it is added on each request with the right reference to your themed file(s). -- Jeremy Thomerson http://www.wickettraining.com
Re: Javascript Compression not working.
Hi alex Thanks for the respose. I have thought of a scheme. I have clubed the css into groups with names as - themeName-all.css, eg. Classic-all.css, jazzy-all.css, etc. I will make sure wicket put correct css name in htmls. Can anyone point me as how to extend wiket:link tag or creat my own tag. On 4/8/10, Alex Objelean alex_objel...@yahoo.com wrote: Wro is responsible for resource cashing. That means that all requests for merged resource will be served with the same response. If you need something dynamic, like theming .. you should serve those outside of wro request. You can split your resources in two: 1) Static unchanged resources (to be served by wro filter) 2) Dynamic, theme dependent resources - served by stream locator Hope this helps! Alex AppleGrew wrote: Hi Alex n All, I managed to get this working. It was failing because of missing Apache Commons IO. Now I am stuck at another place. JS are fine, but the CSS files are chosen as per user's theme. When I was serving the CSS files via my stream locator, it picked up the correct file based on the theme name. Now since the WRO filter is before Wicket filter there seems to be no way to send this information to it. Note to achieve themability in my app, I have put the files in WEB-INF. Htmls, CSS and images are segregated into folders with theme's name. My stream locator fetches the correct Html and CSS based on theme name. Any suggestions how can I achieve this using WRO or can I integrate WRO-like minification of JS and CSS right into Wicket? Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Wed, Apr 7, 2010 at 10:21 PM, Alex Objelean alex_objel...@yahoo.comwrote: Actually you don't have to access the resources. The wro filter just handles the request for static resources, there no wicket specific integration. All you have to do, is to define the location of your resources in wro.xml (group descriptor). The location of resources can be virtually anything: external url, relative to servlet context, classpath or file resources (http://code.google.com/p/wro4j/wiki/ResourceTypes). I pretty sure there is no way to 'ask' wicket to gzip and minimize external resources, because wicket doesn't control them. Alex AppleGrew wrote: Checked it out. This is good, but I am not sure how to integrate this with Wicket. Currently it seems that WRO's url is being override by WicketFilter, so I am not being able to access WRO resources. BTW going back to original problem. I tired to debug the Wicket code and it seems for shared resources the SharedResourceRequestTraget simply invokes PackageResource, while for non globally shared resources JavascriptPackageResource is invoked. JavascriptPackageResource seems to be responsible for gzipping and minizing JS code. Not sure how do I 'ask' Wicket to do the same for globally resources. Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Wed, Apr 7, 2010 at 8:20 PM, Alex Objelean alex_objel...@yahoo.comwrote: You could take a look at wro4j: http://code.google.com/p/wro4j/ . It helps you keep you javascripts (and css) organized in a single location, merge and minimize them. It is also very easy configurable (http://code.google.com/p/wro4j/wiki/GettingStarted) and extensible (allow provide your own implementation of js or css minification algorithm). Also it provides a maven plugin ( http://code.google.com/p/wro4j/wiki/MavenPlugin) for build time merging and minification. You can see a complete list of features here: http://code.google.com/p/wro4j/wiki/Features Alex AppleGrew wrote: Hi All, I have put all my JS files in WEB-INF. To let Wicket find them I have created my own ResourceStreamLocator. The locator on getting class scope as Application simply locates the JS files from 'WEB-INF/js'. The problem is how do I enable Wicket's built-in Javascript compression? I tried the following code with a form:- add(JavascriptPackageResource.getHeaderContribution(ApplicationCore.class, js/form.js)); I can still see the white spaces in the JS code when I try to access them from my browser. Pls guide. Regards, Apple Grew my blog @ http://blog.applegrew.com/ -- View this message in context: http://old.nabble.com/Javascript-Compression-not-working.-tp28164115p28166133.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- View this message in context: http://old.nabble.com/Javascript-Compression-not-working.-tp28164115p28167755.html Sent from the Wicket - User mailing list archive at Nabble.com
Re: Javascript Compression not working.
From my Java code I can simply get the actual css name by; wro/ + MyApplication.getThemeName() + -all.css, but for cases where I would simply add the url to html's head, I find extending wicket:link more attractive. Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Thu, Apr 8, 2010 at 11:01 PM, Alex Objelean alex_objel...@yahoo.comwrote: I wouldn't recommend creating a wicket tag for this. That is exactly what wicket doesn't encourage to do. An alternative could be a simple servlet which forwards to wanted resource based on theme parameter... Alex AppleGrew wrote: Hi alex Thanks for the respose. I have thought of a scheme. I have clubed the css into groups with names as - themeName-all.css, eg. Classic-all.css, jazzy-all.css, etc. I will make sure wicket put correct css name in htmls. Can anyone point me as how to extend wiket:link tag or creat my own tag. On 4/8/10, Alex Objelean alex_objel...@yahoo.com wrote: Wro is responsible for resource cashing. That means that all requests for merged resource will be served with the same response. If you need something dynamic, like theming .. you should serve those outside of wro request. You can split your resources in two: 1) Static unchanged resources (to be served by wro filter) 2) Dynamic, theme dependent resources - served by stream locator Hope this helps! Alex AppleGrew wrote: Hi Alex n All, I managed to get this working. It was failing because of missing Apache Commons IO. Now I am stuck at another place. JS are fine, but the CSS files are chosen as per user's theme. When I was serving the CSS files via my stream locator, it picked up the correct file based on the theme name. Now since the WRO filter is before Wicket filter there seems to be no way to send this information to it. Note to achieve themability in my app, I have put the files in WEB-INF. Htmls, CSS and images are segregated into folders with theme's name. My stream locator fetches the correct Html and CSS based on theme name. Any suggestions how can I achieve this using WRO or can I integrate WRO-like minification of JS and CSS right into Wicket? Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Wed, Apr 7, 2010 at 10:21 PM, Alex Objelean alex_objel...@yahoo.comwrote: Actually you don't have to access the resources. The wro filter just handles the request for static resources, there no wicket specific integration. All you have to do, is to define the location of your resources in wro.xml (group descriptor). The location of resources can be virtually anything: external url, relative to servlet context, classpath or file resources (http://code.google.com/p/wro4j/wiki/ResourceTypes). I pretty sure there is no way to 'ask' wicket to gzip and minimize external resources, because wicket doesn't control them. Alex AppleGrew wrote: Checked it out. This is good, but I am not sure how to integrate this with Wicket. Currently it seems that WRO's url is being override by WicketFilter, so I am not being able to access WRO resources. BTW going back to original problem. I tired to debug the Wicket code and it seems for shared resources the SharedResourceRequestTraget simply invokes PackageResource, while for non globally shared resources JavascriptPackageResource is invoked. JavascriptPackageResource seems to be responsible for gzipping and minizing JS code. Not sure how do I 'ask' Wicket to do the same for globally resources. Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Wed, Apr 7, 2010 at 8:20 PM, Alex Objelean alex_objel...@yahoo.comwrote: You could take a look at wro4j: http://code.google.com/p/wro4j/ . It helps you keep you javascripts (and css) organized in a single location, merge and minimize them. It is also very easy configurable (http://code.google.com/p/wro4j/wiki/GettingStarted) and extensible (allow provide your own implementation of js or css minification algorithm). Also it provides a maven plugin ( http://code.google.com/p/wro4j/wiki/MavenPlugin) for build time merging and minification. You can see a complete list of features here: http://code.google.com/p/wro4j/wiki/Features Alex AppleGrew wrote: Hi All, I have put all my JS files in WEB-INF. To let Wicket find them I have created my own ResourceStreamLocator. The locator on getting class scope as Application simply locates the JS files from 'WEB-INF/js'. The problem is how do I enable Wicket's built-in Javascript compression? I tried the following code with a form:- add(JavascriptPackageResource.getHeaderContribution(ApplicationCore.class, js/form.js)); I can still see the white spaces in the JS code when I try to access them
Javascript Compression not working.
Hi All, I have put all my JS files in WEB-INF. To let Wicket find them I have created my own ResourceStreamLocator. The locator on getting class scope as Application simply locates the JS files from 'WEB-INF/js'. The problem is how do I enable Wicket's built-in Javascript compression? I tried the following code with a form:- add(JavascriptPackageResource.getHeaderContribution(ApplicationCore.class, js/form.js)); I can still see the white spaces in the JS code when I try to access them from my browser. Pls guide. Regards, Apple Grew my blog @ http://blog.applegrew.com/
Re: Javascript Compression not working.
To add on to the previous mail. I am in developement mode, but I have enabled default compression for javascript using the following code:- resourceSettings.setJavascriptCompressor(new DefaultJavascriptCompressor()); Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Wed, Apr 7, 2010 at 5:41 PM, Apple Grew appleg...@gmail.com wrote: Hi All, I have put all my JS files in WEB-INF. To let Wicket find them I have created my own ResourceStreamLocator. The locator on getting class scope as Application simply locates the JS files from 'WEB-INF/js'. The problem is how do I enable Wicket's built-in Javascript compression? I tried the following code with a form:- add(JavascriptPackageResource.getHeaderContribution(ApplicationCore.class, js/form.js)); I can still see the white spaces in the JS code when I try to access them from my browser. Pls guide. Regards, Apple Grew my blog @ http://blog.applegrew.com/
Re: Javascript Compression not working.
Checked it out. This is good, but I am not sure how to integrate this with Wicket. Currently it seems that WRO's url is being override by WicketFilter, so I am not being able to access WRO resources. BTW going back to original problem. I tired to debug the Wicket code and it seems for shared resources the SharedResourceRequestTraget simply invokes PackageResource, while for non globally shared resources JavascriptPackageResource is invoked. JavascriptPackageResource seems to be responsible for gzipping and minizing JS code. Not sure how do I 'ask' Wicket to do the same for globally resources. Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Wed, Apr 7, 2010 at 8:20 PM, Alex Objelean alex_objel...@yahoo.comwrote: You could take a look at wro4j: http://code.google.com/p/wro4j/ . It helps you keep you javascripts (and css) organized in a single location, merge and minimize them. It is also very easy configurable (http://code.google.com/p/wro4j/wiki/GettingStarted) and extensible (allow provide your own implementation of js or css minification algorithm). Also it provides a maven plugin ( http://code.google.com/p/wro4j/wiki/MavenPlugin) for build time merging and minification. You can see a complete list of features here: http://code.google.com/p/wro4j/wiki/Features Alex AppleGrew wrote: Hi All, I have put all my JS files in WEB-INF. To let Wicket find them I have created my own ResourceStreamLocator. The locator on getting class scope as Application simply locates the JS files from 'WEB-INF/js'. The problem is how do I enable Wicket's built-in Javascript compression? I tried the following code with a form:- add(JavascriptPackageResource.getHeaderContribution(ApplicationCore.class, js/form.js)); I can still see the white spaces in the JS code when I try to access them from my browser. Pls guide. Regards, Apple Grew my blog @ http://blog.applegrew.com/ -- View this message in context: http://old.nabble.com/Javascript-Compression-not-working.-tp28164115p28166133.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Javascript Compression not working.
Hi Alex n All, I managed to get this working. It was failing because of missing Apache Commons IO. Now I am stuck at another place. JS are fine, but the CSS files are chosen as per user's theme. When I was serving the CSS files via my stream locator, it picked up the correct file based on the theme name. Now since the WRO filter is before Wicket filter there seems to be no way to send this information to it. Note to achieve themability in my app, I have put the files in WEB-INF. Htmls, CSS and images are segregated into folders with theme's name. My stream locator fetches the correct Html and CSS based on theme name. Any suggestions how can I achieve this using WRO or can I integrate WRO-like minification of JS and CSS right into Wicket? Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Wed, Apr 7, 2010 at 10:21 PM, Alex Objelean alex_objel...@yahoo.comwrote: Actually you don't have to access the resources. The wro filter just handles the request for static resources, there no wicket specific integration. All you have to do, is to define the location of your resources in wro.xml (group descriptor). The location of resources can be virtually anything: external url, relative to servlet context, classpath or file resources (http://code.google.com/p/wro4j/wiki/ResourceTypes). I pretty sure there is no way to 'ask' wicket to gzip and minimize external resources, because wicket doesn't control them. Alex AppleGrew wrote: Checked it out. This is good, but I am not sure how to integrate this with Wicket. Currently it seems that WRO's url is being override by WicketFilter, so I am not being able to access WRO resources. BTW going back to original problem. I tired to debug the Wicket code and it seems for shared resources the SharedResourceRequestTraget simply invokes PackageResource, while for non globally shared resources JavascriptPackageResource is invoked. JavascriptPackageResource seems to be responsible for gzipping and minizing JS code. Not sure how do I 'ask' Wicket to do the same for globally resources. Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Wed, Apr 7, 2010 at 8:20 PM, Alex Objelean alex_objel...@yahoo.comwrote: You could take a look at wro4j: http://code.google.com/p/wro4j/ . It helps you keep you javascripts (and css) organized in a single location, merge and minimize them. It is also very easy configurable (http://code.google.com/p/wro4j/wiki/GettingStarted) and extensible (allow provide your own implementation of js or css minification algorithm). Also it provides a maven plugin ( http://code.google.com/p/wro4j/wiki/MavenPlugin) for build time merging and minification. You can see a complete list of features here: http://code.google.com/p/wro4j/wiki/Features Alex AppleGrew wrote: Hi All, I have put all my JS files in WEB-INF. To let Wicket find them I have created my own ResourceStreamLocator. The locator on getting class scope as Application simply locates the JS files from 'WEB-INF/js'. The problem is how do I enable Wicket's built-in Javascript compression? I tried the following code with a form:- add(JavascriptPackageResource.getHeaderContribution(ApplicationCore.class, js/form.js)); I can still see the white spaces in the JS code when I try to access them from my browser. Pls guide. Regards, Apple Grew my blog @ http://blog.applegrew.com/ -- View this message in context: http://old.nabble.com/Javascript-Compression-not-working.-tp28164115p28166133.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- View this message in context: http://old.nabble.com/Javascript-Compression-not-working.-tp28164115p28167755.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: What happens after browser's 'back' button?
It was done possibly to save performance hits (devs correct me if I am wrong). You can read here ( http://blogs.atlassian.com/developer/2007/12/cachecontrol_nostore_considere.html) for some possible insight. Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Thu, Apr 8, 2010 at 1:39 AM, Joseph Pachod josephpac...@thomas-daily.dewrote: Regarding the commented out no-store, any idea why the wicket core developers didn't used it directly ? Having a consistent behavior across browser + ajax and back button working seem rather good. I wonder why it isn't included currently. joseph _ From: Craig McIlwee [mailto:craig.mcil...@openroadsconsulting.com] protected void setHeaders(WebResponse response) { response.setHeader(Pragma, no-cache); response.setHeader(Cache-Control, no-cache, max-age=0, must-revalidate); // no-store } The // no-store is actually there. Overriding it with protected void setHeaders(WebResponse response) { response.setHeader(Pragma, no-cache); response.setHeader(Cache-Control, no-cache, max-age=0, must-revalidate, no-store); } Will cause firefox to make a trip to the server when back button is pressed. In my experience this is required for AJAX the back button, otherwise wicket won't know that the user hit back and will ignore AJAX requests because they are being executed against a page that (as far as wicket knows) is not the active page. Craig -Original Message- From: James Carman [mailto:jcar...@carmanconsulting.com] Sent: Tuesday, April 06, 2010 8:56 AM To: users@wicket.apache.org Subject: Re: What happens after browser's 'back' button? On Tue, Apr 6, 2010 at 8:07 AM, McIlwee, Craig craig.mcil...@openroadsconsulting.com wrote: As long as you prevent the browser from caching the page with the form (just the page itself, caching the resources is fine) then when the user hits back wicket will pull the old page instance from the pagemap and rerender it. That page instance is the same one that was used the first time, so its state will still be the same. Just set some flag when the user submits, and also check that flag when processing the form like this: Not exactly. How would Wicket know to pull the old page instance if the browser is re-requesting a bookmarkable URL? It wouldn't. It would just reconstruct the page from scratch. In fact, Firefox doesn't re-request anything from Wicket when you click the back button (at least it doesn't in my app when IE does, go figure). The way Wicket keeps everything in synch is that each URL in your rendered page (for forms, links, etc.) has information on it that points to a specific page in the page map (that's what all the ?wicket:interface stuff is). So, when a form is submitted or a link (non-bookmarkable) is clicked on your page, Wicket will load the specific page instance from the page map and invoke the request on that. - 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: resource (css) loading
Maybe u can try writing a stream locator as I did. I am attaching my stream locator with this mail. The necessary plumbing required with this is:- resourceSettings.addResourceFolder(WEB-INF/res); resourceSettings.setResourceStreamLocator(new AppStreamLocator()); getSharedResources().putClassAlias(ApplicationCore.class, global); The above needs to be put in your Application class. Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Wed, Apr 7, 2010 at 10:19 PM, Stefan Lindner lind...@visionet.de wrote: You could e.g. write your own page class class MyCustomersPage extens Page { @Override public void renderHead(HtmlHeaderContainer container) { super.renderHead(container); cssResourceReference = Session.get().getCssResourceReferenceForcustomer() container.getHeaderResponse().renderCSSReference(cssResourceReference); } } And then let each of your pages be a child of MyCustomersPage Stefan -Ursprüngliche Nachricht- Von: sahar rostami [mailto:sahar.rost...@gmail.com] Gesendet: Mittwoch, 7. April 2010 18:42 An: users@wicket.apache.org Betreff: Re: resource (css) loading thank you moèz but i want to set the location for whole application not a specific file. On Wed, Apr 7, 2010 at 8:53 PM, moèz ben rhouma benrhouma.m...@gmail.com wrote: In java add(new StyleSheetReference(stylesheet, BasePage.class, *style.css*)); style.css is the path of the file style.css (i.e you can write /stylesheets/style.css ...) 2010/4/7 sahar rostami sahar.rost...@gmail.com No , i want to know how wicket knows where is style.css? On Wed, Apr 7, 2010 at 8:24 PM, moèz ben rhouma benrhouma.m...@gmail.com wrote: If I understand , you can use in constructor of class java the following code: add(new StyleSheetReference(stylesheet, BasePage.class, style.css)); and in the html page you add: link wicket:id=stylesheet 2010/4/7 sahar rostami sahar.rost...@gmail.com Thanks MZemeck But my question in another form is Where wicket load css (which class)? how wicket knows where look up a css file? i'm trying to override default location of css file and read them from path(s) specified in application start up ,but i can't because i don't know how wicket loads them. any idea would help me! thanks On Wed, Apr 7, 2010 at 7:50 PM, mzem...@osc.state.ny.us wrote: One difference I am aware of (and community correct me if I am wrong), Wicket GZIPs resources. So if you directly link to the css using an href you will not have that feature. sahar rostami sahar.rost...@gmail.com 04/07/2010 11:16 AM Please respond to users@wicket.apache.org To Wicket User Mailing List users@wicket.apache.org cc Subject resource (css) loading Hi all, I want to know how wicket loads css files from location specified in HeaderContributer or using href in header? Thanks in advanced! Notice: This communication, including any attachments, is intended solely for the use of the individual or entity to which it is addressed. This communication may contain information that is protected from disclosure under State and/or Federal law. Please notify the sender immediately if you have received this communication in error and delete this email from your system. If you are not the intended recipient, you are requested not to disclose, copy, distribute or take any action in reliance on the contents of this information. - 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
Detecting end of request cycle
Hi Wicket users, I am using iBatis to handle my DB transactions. It recommends creating one SqlSession object per http request, which can be reused multiple times for that request. So I am exposing its reference from my custom RequestCycle, where it is instantiated for the first time it is accessed. But, this sql session needs to be closed at end of all the transactions. For that I need a reliable method to detect the end of the request cycle to close this sql session. Any suggestions? Regards, Apple Grew my blog @ http://blog.applegrew.com/
Re: Detecting end of request cycle
Wow. Thanks. I looked up the hierarchy but somehow missed that. Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Thu, Mar 11, 2010 at 8:35 AM, Igor Vaynberg igor.vaynb...@gmail.comwrote: requestcycle.onendrequest() or requestcycle.detach() -igor On Wed, Mar 10, 2010 at 6:54 PM, Apple Grew appleg...@gmail.com wrote: Hi Wicket users, I am using iBatis to handle my DB transactions. It recommends creating one SqlSession object per http request, which can be reused multiple times for that request. So I am exposing its reference from my custom RequestCycle, where it is instantiated for the first time it is accessed. But, this sql session needs to be closed at end of all the transactions. For that I need a reliable method to detect the end of the request cycle to close this sql session. Any suggestions? Regards, Apple Grew my blog @ http://blog.applegrew.com/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: [OT] Wicket App Hosting
I am using http://www.eapps.com . Very good service and hosting option. They are not cheap but not too exorbitant either. Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Thu, Feb 25, 2010 at 7:15 PM, Fatih Mehmet Ucar fmu...@gmail.com wrote: linode is the best for me up to now www.linode.com you may need to know a little bit linux/unix though On 25 February 2010 12:39, Josh Kamau joshnet2...@gmail.com wrote: When i wanted to do the same, i bought a server space at www.theserverexperts.com and installed my staff there . ie. Jetty, postgres and the like. I then bought a domain and liked it with my public ip address. Regards. On Thu, Feb 25, 2010 at 3:50 AM, Mauro Ciancio maurocian...@gmail.com wrote: Hello everyone, I need to deploy a couple of wicket apps (2 or 3 apps). I'm looking for advices in order to get a good hosting service. In fact, I think i'll get a vps service. Any advices? Which vps providers are good? Thanks in advance. Cheers! -- Mauro Ciancio maurociancio at gmail dot 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: Stateless AJAX links
Joachim. Thanks a lot got your contribution. Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Sat, Jan 30, 2010 at 3:43 AM, Joachim Kainz j...@jolira.com wrote: I have created a wiki page with my solution for stateless Ajax at http://cwiki.apache.org/confluence/display/WICKET/A+StatelessAjaxFallbackLink . jcompagner-2 wrote: we dont know that really if it is the respond step And normally that getPage() isnt called in wicket when not in a Response step what you do is currently not supported by wicket having an ajax behavior request to a stateless page (through a BookmarkableListenerInterfaceRequestTarget) so i guess the fix is in processEvents is not doing this: else if (page == null) { page = getPage(requestCycle); } but else if (page == null) { page = newPage(getPageClass(), requestCycle); } johan On Mon, Oct 27, 2008 at 7:51 PM, aditsu adi...@yahoo.com wrote: Hi, I thought about what you said, and debugged some more. Here's what I found out: Johan Compagner wrote: RequestCycle.isRedirect() is right, because that is a call that tells us must i redirect of i get a page redirect and with ajax this is always the case. Problem is that the BookmarkablePageRequestTarget.getPage(RC) should only create a page when it is not a redirect And that also correct. Actually, neither BehaviorRequestTarget nor AjaxRequestTarget ever check for redirect. As long as the target is not changed to something else, the redirect setting is ignored. AFAICT, the redirect-for-ajax thing is there so that *if* the *final* request target is something other than AjaxRequestTarget, it will cause a redirect. E.g. if in my handler method I set the response page to a bookmarkable page, then it should do a redirect indeed (that is, a javascript redirect, not an http 302). The problem is that my initial target is BookmarkableListenerInterfaceRequestTarget, before changing to AjaxRequestTarget, and wicket doesn't expect that. It sees a non-ajax target for an ajax request, so it just blindly says this is a redirect, when actually I'm not gonna do that. So I think isRedirect should NOT check for ajax unless it's at the RESPOND step. In the PROCESS_EVENTS step it should only check for the redirect flag. That would probably solve my problem and at the same time it would start to make sense. What do you think? Adrian -- View this message in context: http://www.nabble.com/Stateless-AJAX-links-tp20031309p20193967.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- View this message in context: http://old.nabble.com/Stateless-AJAX-links-tp20031309p27378984.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Getting control of Wicket Session.
Hi, I am a Wicket fresher. I am still getting the hang of this. I want to develop a web application where I would like to show the user a message informing him that his session is about to expire in x minutes. If he wants to save his session then can click on a button which appears along with this message. Also, using javascript I would like to 'sense' that the user is typing-in or moving his mouse over the webpage, which is evident enough that he is using the session. I will somehow figure out the js code needed but *how will I tell Wicket to keep the session alive? Also how can I be notified x minutes before Wicket expires the session?* Regards, Apple Grew my blog @ http://blog.applegrew.com/
Re: Getting control of Wicket Session.
@Pedro Thanks for the response. Now I have two questions. 1. How do I get reference of HttpSession? In Wicket I seem to get reference of WebSession. 2. How do I notify the servlet container (I guess Wicket is not in-charge of maintaining the HttpSession), that the user is active? If I make any Http request from client's end (AJAX), even if that request is simply ignored by my application, will that help to keep the session alive? @Steve Yup this will be AJAX. When my solution is ready, will share it, definitely. :) Regards, Apple Grew my blog @ http://blog.applegrew.com/ On Tue, Jan 19, 2010 at 8:57 AM, Steve Swinsburg steve.swinsb...@gmail.comwrote: Presumably, if the user is typing a long document and hasn't clicked on anything for a while, you'll need to indicate to Wicket/HttpSession (probably via AJAX), that the session is to be kept alive. I believe this is how the autosave functions of things like rich text editors work, keeping the session from timing out. Interested to see your solution. cheers, Steve On 19/01/2010, at 10:19 AM, Pedro Santos wrote: Use attributes from HttpSession like getLastAccessedTime() and getMaxInactiveInterval(). You can get access through WebRequest that holds an HttpServletRequest object. When HttpSession ends, the wicket session ends too. On Mon, Jan 18, 2010 at 5:33 PM, Apple Grew appleg...@gmail.com wrote: Hi, I am a Wicket fresher. I am still getting the hang of this. I want to develop a web application where I would like to show the user a message informing him that his session is about to expire in x minutes. If he wants to save his session then can click on a button which appears along with this message. Also, using javascript I would like to 'sense' that the user is typing-in or moving his mouse over the webpage, which is evident enough that he is using the session. I will somehow figure out the js code needed but *how will I tell Wicket to keep the session alive? Also how can I be notified x minutes before Wicket expires the session?* Regards, Apple Grew my blog @ http://blog.applegrew.com/ -- Pedro Henrique Oliveira dos Santos - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org