Re: Wicket meeting in Amsterdam?
Ahh.. No problemo, I would'nt be able todo that.. 2009/5/25 francisco treacy francisco.tre...@gmail.com: Well, would be great Nino if you came over :) But I was talking about a regular meetup... If not, there's Kings of Code in Amsterdam soon, seems interesting - not very Java-ish though. Anyone here going to that conference? Francisco 2009/5/20 nino martinez wael nino.martinez.w...@gmail.com: Although not an amsterdammer, I might be interested (if I get a budget approval from my boss).. 2009/5/20 francisco treacy francisco.tre...@gmail.com: Hi Linda, I am interested, whatever the nature of the event is (sessions, code reviews, social, etc). There's an existing wiki page but apparently this was lined up only for the meeting during the ApacheCon: http://cwiki.apache.org/WICKET/wicket-community-meetups-amsterdam.html Any other Amsterdamers interested in such a meetup? Francisco 2009/4/29 Linda van der Pal lvd...@heritageagenturen.nl: Who would be interested in a meeting in Amsterdam? We talked about it before in several discussions, but I thought it might attract more notice in it's own thread. And also what kind of meeting would you like it to be? (Social, unconference, sessions, code reviews, something else entirely?) Regards, Linda - 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
Re: closing a ModalWindow from a forms onSubmit?
Tried that :) and it always seems to be null. I switched to AjaxButtons, but the problem is that the are fired *after* the form submits, not before as a normal Button is. I'm essentially trying to set a value on the form's model depending on which button was pressed, and then close the ModalWindow on successful submit. There needs to be an easier way to do this... at the moment I'm starting to think I'm going to have to try and attache some javascript that will trigger pre-submit to set some sort of flag... but its getting very dirty. - Brill On 25-May-09, at 10:48 AM, Jeremy Thomerson wrote: If all you're saying is that you need to do it from your form's onsubmit, do this: AjaxRequestTarget art = AjaxRequestTarget.get(); if (art != null) { modal.close(art); } Jeremy Thomerson http://www.wickettraining.com -- sent from a wireless device -Original Message- From: Brill Pappin br...@pappin.ca Sent: Sunday, May 24, 2009 5:36 PM To: users@wicket.apache.org Subject: Re: closing a ModalWindow from a forms onSubmit? I likely could but am trying to avoid that, because then I have to call it for every button in the form (there are 4 now, all set a state and allow the event to propagate to the forms onSubmit(). Is there no way to know the current context from the component itself? - Brill On 24-May-09, at 5:55 PM, James Carman wrote: Can you submit the form via ajax? On May 24, 2009 2:08 PM, Brill Pappin br...@pappin.ca wrote: I have a form in a model window How do I close the ModalWindow in the form's onSubmit() method without the AjaxRequestTarget? - Brill - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org smime.p7s Description: S/MIME cryptographic signature
Re: closing a ModalWindow from a forms onSubmit?
Brill this is what I do for a window of mine, it has a few buttons and the parent page needs to know what one was clicked. Doing it in the button's onSubmit works. I pass an object into the ModalWindow's constructor, which was initialised in the parent page, then I set a property into an object in the AjaxButton onSubmit, then close it via window.close(target). The parent can then see the property in the WindowClosedCallback method which fires when it closed. cheers, Steve On 26/05/2009, at 7:37 AM, Brill Pappin wrote: Tried that :) and it always seems to be null. I switched to AjaxButtons, but the problem is that the are fired *after* the form submits, not before as a normal Button is. I'm essentially trying to set a value on the form's model depending on which button was pressed, and then close the ModalWindow on successful submit. There needs to be an easier way to do this... at the moment I'm starting to think I'm going to have to try and attache some javascript that will trigger pre-submit to set some sort of flag... but its getting very dirty. - Brill On 25-May-09, at 10:48 AM, Jeremy Thomerson wrote: If all you're saying is that you need to do it from your form's onsubmit, do this: AjaxRequestTarget art = AjaxRequestTarget.get(); if (art != null) { modal.close(art); } Jeremy Thomerson http://www.wickettraining.com -- sent from a wireless device -Original Message- From: Brill Pappin br...@pappin.ca Sent: Sunday, May 24, 2009 5:36 PM To: users@wicket.apache.org Subject: Re: closing a ModalWindow from a forms onSubmit? I likely could but am trying to avoid that, because then I have to call it for every button in the form (there are 4 now, all set a state and allow the event to propagate to the forms onSubmit(). Is there no way to know the current context from the component itself? - Brill On 24-May-09, at 5:55 PM, James Carman wrote: Can you submit the form via ajax? On May 24, 2009 2:08 PM, Brill Pappin br...@pappin.ca wrote: I have a form in a model window How do I close the ModalWindow in the form's onSubmit() method without the AjaxRequestTarget? - Brill - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org smime.p7s Description: S/MIME cryptographic signature
Re: Wicket meeting in Amsterdam?
I've heard of it, but I'm not planning to go there. So for now there's just two of us in Amsterdam. Guess we'll have to convert a few more people over here to Wicket. :) Linda francisco treacy wrote: Well, would be great Nino if you came over :) But I was talking about a regular meetup... If not, there's Kings of Code in Amsterdam soon, seems interesting - not very Java-ish though. Anyone here going to that conference? Francisco 2009/5/20 nino martinez wael nino.martinez.w...@gmail.com: Although not an amsterdammer, I might be interested (if I get a budget approval from my boss).. 2009/5/20 francisco treacy francisco.tre...@gmail.com: Hi Linda, I am interested, whatever the nature of the event is (sessions, code reviews, social, etc). There's an existing wiki page but apparently this was lined up only for the meeting during the ApacheCon: http://cwiki.apache.org/WICKET/wicket-community-meetups-amsterdam.html Any other Amsterdamers interested in such a meetup? Francisco 2009/4/29 Linda van der Pal lvd...@heritageagenturen.nl: Who would be interested in a meeting in Amsterdam? We talked about it before in several discussions, but I thought it might attract more notice in it's own thread. And also what kind of meeting would you like it to be? (Social, unconference, sessions, code reviews, something else entirely?) Regards, Linda - 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
Re: AutoComplete results disappear when using scrollbar in IE
Hi Igor, my specific use case does not allow to limit the number of results, but I found another solution that seems to work so far. I modified the wicket-autocomplete.js to the following behaviour: If the browser is IE and not running in Quirks mode, an event handler function is added to the document that registers each click, and checks which html element was clicked. The onblur handler of the autocomplete field is modified in a way that the result list is not hidden immediately on blur, but with a short delay of 200 ms. If the click listener observes a click outside of the document body (i.e. tag name of the clicked element is HTML) during that delay - which happens when the user clicks the scroll bar - the result list will not be hidden, but the input field be re-focused instead. This works for my case, but I don't know if it will be suitable as a general fix for others, and I have only tested it with IE 7 and Firefox. Should I still provide a patch or quickstart with the modification? Jan Am 20.05.2009 um 17:57 schrieb Igor Vaynberg: sounds like we either need to build paging into the list, or you need to limit the number of results you show. -igor On Tue, May 19, 2009 at 2:13 AM, Jan Grathwohl jan.grathw...@kontrast.de wrote: Hi list, I am using Wicket's AutoCompleteTextField in my application, and the result list that is shown to the user by the autocomplete can be quite long in some situations, so that it does not fit into the browser window anymore, and the complete result list is only visible by scrolling down in the browser window. The problem with IE is now, if users try to use the browser's scrollbar to get to the end of the result list, the list immediately disappears. It looks like the click on the scrollbar in IE fires an onblur event, which hides the autocomplete's result list. As a result of this, the autocomplete can only be used in IE by scrolling down the page with the mouse's scroll wheel, but IE users without a mouse are in trouble... Funny thing is that this only happens if I use a HTML doctype declaration in the HTML page. If I remove the declaration from the HTML, IE runs in Quirks mode and does not fire onblur any more when clicking the scroll bar, and everything works. But removing the doctype declaration from my HTML then again breaks all the existing CSS, so this is not really a solution. Is this a known issue (or an issue at all)? Did anyone on this list have the same problem, and found a way to fix it or work around it? I know I could make the result list itself scrollable, by setting a height for div.wicket-aa, so users would scroll the div instead of the whole browser window. But if there is a possibility to keep the current behaviour of the autocomplete, only fix the problem with the click on the scrollbar, I would prefer that. BTW, the objectautocomplete component from wicket-stuff shows the same problem. Just add !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; html to the example HTML page, and the autocomplete's result list disappears when you click on the scrollbar. Regards, Jan - 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: Whats wrong with my component?
Please all forgive my ignorance as this is my first component. My custom component is just a text area and a couple of client side JavaScript links. This component is supposed to be used inside a form and should be bound to text property of MessageVO What am I doing wrong? Per Lundholm wrote: So the TextArea gets a CompoundPropertyModel that has a MessageVO object. The MessageVO has a method getLanguage ? How should the TextArea display the contents of MessageVO? HTH /Per 2009/5/24 HHB hubaghd...@yahoo.ca: Ok, the TextArea has its own model so I passed the model parameter of the component constructor to the TextArea: final TextArea textArea = new TextArea(text, model); And in the panel: CompoundPropertyModel formModel = new CompoundPropertyModel(new MessageVO()); MessageTextArea textArea = new MessageTextArea(text, formModel); Now, the custom textarea is displaying the toString() method of MessageVO object and upon submitting the form, I got the exception: Attempted to set property value on a null object. Property expression: language Value: English org.apache.wicket.WicketRuntimeException: Attempted to set property value on a null object. Property expression: language Value: English James Carman-3 wrote: Just think to yourself what models are being used here. The TextArea inside the MessageTextArea is bound to what? And, the MessageTextArea's model is bound to what? On Sun, May 24, 2009 at 7:32 AM, HHB hubaghd...@yahoo.ca wrote: Would you please tell me in code (my code I posted earlier) what do you mean? I really appreciate your time and help. igor.vaynberg wrote: you do not bind the model of the textarea to the model of the messagetextarea, so why are you surprised the value never makes it into your model? -igor On Thu, May 21, 2009 at 4:45 AM, HHB hubaghd...@yahoo.ca wrote: Hey, I'm trying to create my first component in Wicket: + public class MessageTextArea extends FormComponentPanel { private String text; public MessageTextArea(String id) { this(id, null); } public MessageTextArea(String id, IModel model) { super(id, model); setType(String.class); setOutputMarkupId(true); final PropertyModel textModel = new PropertyModel(this, text); final TextArea textArea = new TextArea(text, textModel); textArea.setRequired(true); textArea.setOutputMarkupId(true); add(textArea); } } + And to use the component: + CompoundPropertyModel formModel = new CompoundPropertyModel(new MessageVO()); form.setModel(formModel); add(form); MessageTextArea textArea = new MessageTextArea(text); + The problem is when I pass formModel to textArea component, I got a value expression error, and a NPE if I don't pass the model. What I'm doing wrong? Thanks for help and time. - 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 -- View this message in context: http://www.nabble.com/Whats-wrong-with-my-component--tp23651847p23692734.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 - 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://www.nabble.com/Whats-wrong-with-my-component--tp23651847p23692862.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 -- FaceBush, min insamling i Mustaschkampen: http://www.cancerfonden.se//sv/Mustaschkampen/Kampa/Insamlingar/?collection=243 - 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://www.nabble.com/Whats-wrong-with-my-component--tp23651847p23719123.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For
Re: Whats wrong with my component?
doe NOT give the compound model to the FormComponents itself! only to the parent of the form component (so the panel) On Tue, May 26, 2009 at 10:53, HHB hubaghd...@yahoo.ca wrote: Please all forgive my ignorance as this is my first component. My custom component is just a text area and a couple of client side JavaScript links. This component is supposed to be used inside a form and should be bound to text property of MessageVO What am I doing wrong? Per Lundholm wrote: So the TextArea gets a CompoundPropertyModel that has a MessageVO object. The MessageVO has a method getLanguage ? How should the TextArea display the contents of MessageVO? HTH /Per 2009/5/24 HHB hubaghd...@yahoo.ca: Ok, the TextArea has its own model so I passed the model parameter of the component constructor to the TextArea: final TextArea textArea = new TextArea(text, model); And in the panel: CompoundPropertyModel formModel = new CompoundPropertyModel(new MessageVO()); MessageTextArea textArea = new MessageTextArea(text, formModel); Now, the custom textarea is displaying the toString() method of MessageVO object and upon submitting the form, I got the exception: Attempted to set property value on a null object. Property expression: language Value: English org.apache.wicket.WicketRuntimeException: Attempted to set property value on a null object. Property expression: language Value: English James Carman-3 wrote: Just think to yourself what models are being used here. The TextArea inside the MessageTextArea is bound to what? And, the MessageTextArea's model is bound to what? On Sun, May 24, 2009 at 7:32 AM, HHB hubaghd...@yahoo.ca wrote: Would you please tell me in code (my code I posted earlier) what do you mean? I really appreciate your time and help. igor.vaynberg wrote: you do not bind the model of the textarea to the model of the messagetextarea, so why are you surprised the value never makes it into your model? -igor On Thu, May 21, 2009 at 4:45 AM, HHB hubaghd...@yahoo.ca wrote: Hey, I'm trying to create my first component in Wicket: + public class MessageTextArea extends FormComponentPanel { private String text; public MessageTextArea(String id) { this(id, null); } public MessageTextArea(String id, IModel model) { super(id, model); setType(String.class); setOutputMarkupId(true); final PropertyModel textModel = new PropertyModel(this, text); final TextArea textArea = new TextArea(text, textModel); textArea.setRequired(true); textArea.setOutputMarkupId(true); add(textArea); } } + And to use the component: + CompoundPropertyModel formModel = new CompoundPropertyModel(new MessageVO()); form.setModel(formModel); add(form); MessageTextArea textArea = new MessageTextArea(text); + The problem is when I pass formModel to textArea component, I got a value expression error, and a NPE if I don't pass the model. What I'm doing wrong? Thanks for help and time. - 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 -- View this message in context: http://www.nabble.com/Whats-wrong-with-my-component--tp23651847p23692734.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 - 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://www.nabble.com/Whats-wrong-with-my-component--tp23651847p23692862.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 -- FaceBush, min insamling i Mustaschkampen: http://www.cancerfonden.se//sv/Mustaschkampen/Kampa/Insamlingar/?collection=243 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail:
Tips to start writing tests
Hey, I want to write tests for my Wicket pages and panels. The application is guarded via login functionality and all the pages and panels are depending on a User object in the session. I know who to write tests for Wicket, but I'm not sure what to do in my case due the authentication and authorization strategy. Any tips? Basically, the application is just one page and navigation is done via panels sweeping. Thanks. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Storing css and image files
Why wouldn't it be a viable solution? It gives you the opportunity to let the resources be served by your container, which should be speedier than letting wicket handle it (such requests are filtered through and go to your container). The relative paths are just that: relative, and they always map to the absolute same resource URI. In fact, they are more stable than serving things from your classpath, as those resources are served from the path /context/resources/, and if we decide to call that path /context/foobar/ all your reasoning about stability goes out the window. Martijn On Mon, May 25, 2009 at 6:38 PM, Luther Baker lutherba...@gmail.com wrote: **On Mon, May 25, 2009 at 2:34 AM, Martijn Dashorst martijn.dasho...@gmail.com wrote: or, if these images and css are for your application, and application wide (i.e. all pages include them), you could put them in src/main/webapp/.. and just link src=style.css ... / them in your markup. Martijn I'd like to pose a design/theoratical thought here I understand that wicket:link/ does the right thing for resources (like stylesheets) kept in the classpath. I love this behavior. But, as we know, depending on where my browser URL points, the following: link href=css/styles.css .../ resolves to different locations. For instance, said stylesheet referenced from: http://hostname/context/products/wires/24 physically resolves to (mavenized) webapps/*products/wires*/css/styles.css, whereas from http://hostname/context/people/hr/judy resolves to webapps/*people/hr/judy*/css/styles.css (In part, this is due to our effort NOT to hardcode the context into the link's href.) *Traditionally, I solved this one of three ways:* 1. Manually manage every application URL and every mapped file and make sure that in all cases the relative path is correct. Ugh! For obvious reasons - this technique is not maintainable. Large apps back in the early days of Struts with hundreds of actions and JSPs, this just wasn't fun. 2. JSTL came along and I started to leverage the c:url tag. For the most part, that was a workable solution - the resulting path was 'absolute' but it wasn't hardcoded. Essentially, it gives the framework a chance to work its magic (if it were to change somehow). 3. Today, I use the resource method (wicket:link/) which obviates all anxiety by simply letting the framework just manage it. So to your point Martijn, is using webapp/css and directly including link href=css/styles.css .../ really a good - viable, long-term solution in Wicket apps? Understandably maybe today, the default URL mapper in Wicket uses query strings and not deep or hierarchical urls - but the important term for me here is today. What if, in the future, wicket decides to change the default URL mapping scheme - maybe become more RESTful. The inertia built up around legacy apps using webapp/css may pose a problem. I don't think this is premature functionality ... I think links and urls are a here a now thing and that building and migrating apps to future versions of frameworks is hard and that a loose practice here may come back to bite a developer ... ? Also, I've not yet mounted urls but I assume if I were to mount URLs - I'd have to really manage this webapp/css approach - whereas, the resource approach with wicket:link/ would just keep humming along. Some may argue that it isn't really *better* to provide multiple ways to do the same thing ... take Tapestry for instance and the technical relevance as to where markup files can or cannot reside. This post is indeed a bit philosophical/theoretical - I've often thought about this topic and wanted to clarify in my mind that maybe, these are either moot points, ignored concerns, overthinking on my part ... or just not important somehow. As I mentioned, this little detail has always been a pain point in my previous work and I've just been happy as a lark to use the wicket:link/ which protects me from whatever the future provides. I'm just surprised it isn't the suggested best practice or that dropping files into webapp/* is *ill*-advised since it assumes something about how Wicket works. Thanks, -Luther -- Become a Wicket expert, learn from the best: http://wicketinaction.com Apache Wicket 1.3.5 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Tips to start writing tests
Hi How about inserting the User object into the session before each test? private WicketTester tester; @Before public void beforeEachTest() { User fakeUser = new User(); tester.setupRequestAndResponse(); MySession wicketSession = (MySession) tester.getWicketSession(); wicketSession.setUser(fakeUser); } /Per 2009/5/26 HHB hubaghd...@yahoo.ca: Hey, I want to write tests for my Wicket pages and panels. The application is guarded via login functionality and all the pages and panels are depending on a User object in the session. I know who to write tests for Wicket, but I'm not sure what to do in my case due the authentication and authorization strategy. Any tips? Basically, the application is just one page and navigation is done via panels sweeping. Thanks. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- FaceBush, min insamling i Mustaschkampen: http://www.cancerfonden.se//sv/Mustaschkampen/Kampa/Insamlingar/?collection=243 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Generate markup for hidden framework form field?
How is that going the fix the problem? I'd end up with markup, but no behaviour on top of it. Jörn On Mon, May 25, 2009 at 5:52 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: right, so remove that code since you have replaced that component with pure markup. -igor On Mon, May 25, 2009 at 8:48 AM, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: That was the idea. But Wicket still can't find the component markup when looking for it. The form adds this elsewhere: add(new HiddenFieldString(csrf-protection, new ModelString(csrfProtection())).setRequired(true).add(new IValidatorString() { public void validate(IValidatableString validatable) { log.warn(potential csrf attack, submitted value: + validatable.getValue() + , expected: + csrfProtection()); validatable.error(new ValidationError().setMessage(wrong csrf protection cookie)); } })); Jörn On Mon, May 25, 2009 at 5:44 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: if you write it out in oncomponenttagbody then you dont need it in the markupo anymore. -igor On Mon, May 25, 2009 at 6:32 AM, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Hi, my application uses a form subclass everywhere for CSRF protection. Each form needs a hidden field like this: input type=hidden wicket:id=csrf-protection / The wicket component for that is added by the form subclass (SecureForm) which all other forms in the application extend. Currently each form has to include that markup somewhere, producing a lot of duplication. I'm looking for a way to get rid of that duplication. An approach I'm currently investigating is to generate the markup, similar to how Form genrates a hidden input it its onComponentTagBody: @Override protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) { String nameAndId = get(csrf-protection).getId(); AppendingStringBuffer buffer = new AppendingStringBuffer( input type=\hidden\ name=\).append(nameAndId).append(\ /); getResponse().write(buffer); super.onComponentTagBody(markupStream, openTag); } That doesn't work, Wicket throws an exception of a missing reference in markup anyway. Likely because this just writes to the response, not extending the markup. I also don't see any way to achieve this via MarkupStream or ComponentTag. Any ideas? Regards Jörn Zaefferer - 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
Problem with Maven archetype, Eclipse Classpath and jetty:run
Hi, when creating a fresh Wicket project with the following line as generated by the quickstart page on wicket.apache.org: mvn archetype:create -DarchetypeGroupId=org.apache.wicket -DarchetypeArtifactId=wicket-archetype-quickstart -DarchetypeVersion=1.4-rc4 -DgroupId=com.mycompany -DartifactId=myproject ...I run into a number of (easily fixable, but somewhat annoying and non-obvious) problems. - The classpath file generated by 'mvn eclipse:eclipse' has an include-pattern of '**/*.java' for both src/test/java and src/main/java. This means that by default none of the HTML files or other resources will be copied to the classpath when for example using the 'Start' class. This can of course be fixed by manually removing these restrictions from the classpath, but on regenerating with eclipse:eclipse they will be added again. Also, this is probably non-obvious to new users. I think this is more of a Maven problem than one with Wicket, but it shows up as more of a problem here because not many other projects have their resources directly in the packages. I have not found an option in eclipse:eclipse to set these include patterns. Does anybody know whether any such options exist? If yes, I propose adding an appropriate setting to the Wicket archetype. If not, I think there should be a notice about this quirk on the quickstart page. I realize this is probably due to the fact that Maven wants to copy the resources itself, so it can do its filtering. However, I don't really see that as an issue for a typical Wicket project, or am I missing something? The second problem is due to the way I set up my project -- it may be odd (is it?), but I think this is rather sensible for standalone component development. - I am developing a standalone component for use in other projects, so under src/main/ I'd like to have only the classes and resources that belong to the component. On the other hand, for testing and debugging purposes, a simple Wicket application and page are very handy, so I moved those from src/main to src/test, since these shouldn't show up in the generated jar file. This works in Eclipse when I remove the restrictions mentioned above from both src/main and src/test. When I try to use 'mvn jetty:run', it breaks down, complaining that it can't find the Application class (and by extension also the other classes in src/test). This is fixable by adding configuration useTestClasspathtrue/useTestClasspath /configuration to the jetty-plugin part of the generated pom.xml. I don't see any negative side-effects of this, so I'd like to propose adding this to the archetype. As an aside: Is this practice of keeping a debug Application under src/test considered good or bad practice? If bad, why? Best regards, and thanks for a great framework! Carl-Eric - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
MultiFileUploadField: How to filter file types
Hello there. Im using the MultiFileUploadField but i would like that the user could just see/choose some type of files. for instance, he could only select jpeg or/and png files. I notice that is possible to specify the max size of a file. Is possible to specify the type files that the user can select? Thanks a lot -- Marco Santos
Refresh page after downloading file
Hi! I have a page with several links to download files. After one file is downloaded I would like the corresponding link to dissapear from the page. In principle this would be as simple as refreshing the page once a link has been clicked. However, I am not sure how to do this, since using setResponsePage() in the link's onClick() method does not give the desired result (instead of the file being downloaded it is the html file of the page set as response that is downloaded). I would really appreciate if you could help me with this. Thanks a lot. Cheers, Humberto
AW: Refresh page after downloading file
How about setting the visibility to false (yourComponentOrLink.setVisibility(false);) on click or something. Dunno if it works with links as well, but should if it is bound to a wicket-id ... -Ursprüngliche Nachricht- Von: humberto.castejon.marti...@gmail.com [mailto:humberto.castejon.marti...@gmail.com] Im Auftrag von Humberto N. Castejon Martinez Gesendet: Dienstag, 26. Mai 2009 12:08 An: users@wicket.apache.org Betreff: Refresh page after downloading file Hi! I have a page with several links to download files. After one file is downloaded I would like the corresponding link to dissapear from the page. In principle this would be as simple as refreshing the page once a link has been clicked. However, I am not sure how to do this, since using setResponsePage() in the link's onClick() method does not give the desired result (instead of the file being downloaded it is the html file of the page set as response that is downloaded). I would really appreciate if you could help me with this. Thanks a lot. Cheers, Humberto - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Generate markup for hidden framework form field?
When you write it out with oncomponenttagbody it's not part of the component hierarchy, it's just rendered markup. Once the form is submitted, you can retrieve the value using the servlet API. What behavior would you want to add on top ? Maarten On Tue, May 26, 2009 at 12:17 PM, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: How is that going the fix the problem? I'd end up with markup, but no behaviour on top of it. Jörn On Mon, May 25, 2009 at 5:52 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: right, so remove that code since you have replaced that component with pure markup. -igor On Mon, May 25, 2009 at 8:48 AM, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: That was the idea. But Wicket still can't find the component markup when looking for it. The form adds this elsewhere: add(new HiddenFieldString(csrf-protection, new ModelString(csrfProtection())).setRequired(true).add(new IValidatorString() { public void validate(IValidatableString validatable) { log.warn(potential csrf attack, submitted value: + validatable.getValue() + , expected: + csrfProtection()); validatable.error(new ValidationError().setMessage(wrong csrf protection cookie)); } })); Jörn On Mon, May 25, 2009 at 5:44 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: if you write it out in oncomponenttagbody then you dont need it in the markupo anymore. -igor On Mon, May 25, 2009 at 6:32 AM, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Hi, my application uses a form subclass everywhere for CSRF protection. Each form needs a hidden field like this: input type=hidden wicket:id=csrf-protection / The wicket component for that is added by the form subclass (SecureForm) which all other forms in the application extend. Currently each form has to include that markup somewhere, producing a lot of duplication. I'm looking for a way to get rid of that duplication. An approach I'm currently investigating is to generate the markup, similar to how Form genrates a hidden input it its onComponentTagBody: @Override protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) { String nameAndId = get(csrf-protection).getId(); AppendingStringBuffer buffer = new AppendingStringBuffer( input type=\hidden\ name=\).append(nameAndId).append(\ /); getResponse().write(buffer); super.onComponentTagBody(markupStream, openTag); } That doesn't work, Wicket throws an exception of a missing reference in markup anyway. Likely because this just writes to the response, not extending the markup. I also don't see any way to achieve this via MarkupStream or ComponentTag. Any ideas? Regards Jörn Zaefferer - 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
Re: Storing css and image files
On Tue, May 26, 2009 at 4:41 AM, Martijn Dashorst martijn.dasho...@gmail.com wrote: Why wouldn't it be a viable solution? It gives you the opportunity to let the resources be served by your container, which should be speedier than letting wicket handle it (such requests are filtered through and go to your container). Yep. The relative paths are just that: relative, and they always map to the absolute same resource URI. I think I'm missing something here. If one uses the regular webapp location to storee css, as I mentioned, http://localhost/a/b requesting css/styles.css will request a different file than http://localhost/a/NOTbrequesting the same css/styles.css. Relative paths will NOT map to the same absolute resource URI. IN the first example, the file webapps/a/b/css/styles.css is retrieved. In the second example, webapp/a/NOTb/css/styles.css is retrieved. In both files, I've used the link href=css/styles.css ... In fact, they are more stable than serving things from your classpath, as those resources are served from the path /context/resources/, and if we decide to call that path /context/foobar/ all your reasoning about stability goes out the window. Ahh I thought quite the opposite. If I have files src/main/java/a/b/Page.java src/main/resources/a/b/Page.html src/main/resources/a/b/css/styles.css and Page.html includes this: wicket:link link rel=stylesheet type=text/css href=css/standard/common.css / link rel=stylesheet type=text/css href=css/standard/header.css / /wicket:link it turns into this: link rel=stylesheet type=text/css href=resources/org.effectiveprogramming.effprog.web.markup.layout.BasicLayout/css/standard/common.css/ which always works. In my eyes, I am giving Wicket just enought information to find my css files. How Wicket decides to encode the wicket:link/ code is none of my business. As long as the contract is adhered to. I give it a very small relative link path in my resources hierarchy and Wicket encodes that and will ALWAYS find it. If Wicket decides to change how wicket:link/ encodes a resource (changes /context/resources to /context/foobar/) that is fine with me - as long as Wicket keeps reading in the resources correctly. You imply that, given my aforemetioned files, wicket:link link rel=stylesheet type=text/css href=css/standard/common.css / link rel=stylesheet type=text/css href=css/standard/header.css / /wicket:link would break if Wicket changed /context/resources to /context/foobar ... and thats not what I expected. I complete agree with the 'performance' point ... and maybe I just misundertstand your perspective but directly using the link rel=stylesheet type=text/css href=css/standard/common.css / and fetching pages from webapp/ seems much more volatile to me than using wicket:link link rel=stylesheet type=text/css href=css/standard/common.css / /wicket:link which will be encoded however wicket pleases and always served up from a path relative to the resource including it. -Luther I don't code /context/resources Martijn On Mon, May 25, 2009 at 6:38 PM, Luther Baker lutherba...@gmail.com wrote: **On Mon, May 25, 2009 at 2:34 AM, Martijn Dashorst martijn.dasho...@gmail.com wrote: or, if these images and css are for your application, and application wide (i.e. all pages include them), you could put them in src/main/webapp/.. and just link src=style.css ... / them in your markup. Martijn I'd like to pose a design/theoratical thought here I understand that wicket:link/ does the right thing for resources (like stylesheets) kept in the classpath. I love this behavior. But, as we know, depending on where my browser URL points, the following: link href=css/styles.css .../ resolves to different locations. For instance, said stylesheet referenced from: http://hostname/context/products/wires/24 physically resolves to (mavenized) webapps/*products/wires*/css/styles.css, whereas from http://hostname/context/people/hr/judy resolves to webapps/*people/hr/judy*/css/styles.css (In part, this is due to our effort NOT to hardcode the context into the link's href.) *Traditionally, I solved this one of three ways:* 1. Manually manage every application URL and every mapped file and make sure that in all cases the relative path is correct. Ugh! For obvious reasons - this technique is not maintainable. Large apps back in the early days of Struts with hundreds of actions and JSPs, this just wasn't fun. 2. JSTL came along and I started to leverage the c:url tag. For the most part, that was a workable solution - the resulting path was 'absolute' but it wasn't hardcoded. Essentially, it gives the framework a chance to work its magic (if it were to change somehow). 3. Today, I use the resource
ResourceLink and ResponsePage
Hi! I have a web page that shows a list of items, each of them with an associated link (a ResourceLink) to download a file. I would like the web page to be refreshed once a file has been downloaded (I want the associted item to be removed from the list). I tried overriding the onClick() method of my ResourceLink and setting the response page to the current page, but then the html file of the web page is downloaded and not the original file. Is there a way to achieve what I want? Thanks! Cheers, Humberto
Problems using wicket with web.xml security
Hi We have a wicket application which should be completely secured by FORM authentication by the webserver. For that, we have the following in web.xml: security-constraint display-nameSecured pages/display-name web-resource-collection web-resource-nameAll Pages/web-resource-name url-pattern/*/url-pattern http-methodGET/http-method http-methodPOST/http-method /web-resource-collection auth-constraint role-namesomeRole/role-name /auth-constraint /security-constraint login-config auth-methodFORM/auth-method realm-nameSecure Everything/realm-name form-login-config form-login-page/login/form-login-page form-error-page/login/login-error.jsp/form-error-page /form-login-config /login-config security-role descriptionUser security role/description role-namesomeRole/role-name /security-role security-role descriptionUser security role/description role-namesomeOtherRole/role-name /security-role Unfortunately, it seems that every user having ANY role gets access to the wicket pages. For example a user with role someOtherRole will get access to the main page, as its url is for example: http://localhost:7001/app/?wicket:interface=:2 When he tries to access a mounted page though, he gets the Error 403--Forbidden as expected. But he should also get this error when trying to access the home page of the wicket app. I suspect it has something to do with the /* url-pattern not catching the /?wicket:interface=:2 ??? Thanks for your help!! Matt -- matthias.kel...@ergon.ch +41 44 268 83 98 Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich http://www.ergon.ch __ e r g o nsmart people - smart software smime.p7s Description: S/MIME Cryptographic Signature
Re: Any forum (bb) components / applications written using Wicket?
Please, release it when you finish On Mon, May 25, 2009 at 8:25 AM, Cristi Manole cristiman...@gmail.comwrote: Hi, Thanks to both of you. I've checked JForum in the past, and while I like it a lot (I think we have it implemented on one of the sites we did for a client), I thought back then it would be hard to really integrate it with Wicket. I decided to write what I need from scratch, since I don't need a full blown forum anyways. Once I finish it, if it seems worth anything to somebody else, I will release the code to the crowd. Again, thanks, Cristi On Mon, May 25, 2009 at 4:51 AM, nino martinez wael nino.martinez.w...@gmail.com wrote: Hi I did the BBcode integration, it's very basic. But a starting point.. If you need something more, you could use Jforum it's since it's possible todo a single sign on from your application to theirs.. http://www.jforum.net/ 2009/5/24 Cristi Manole cristiman...@gmail.com: Hello, I'm in the need of a forum (bulletin board) component / application written in Wicket to integrate in a larger Wicket application. Does anybody have one / know of one? Please promote it. :) I don't mind if it's still in alpha or something as I prefer building on top of that rather than starting from scratch :) I'm on a _very_ tight schedule. Thanks, -- Cristi Manole Nova Creator Software www.novacreator.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Cristi Manole Nova Creator Software www.novacreator.com -- Fernando Wermus. www.linkedin.com/in/fernandowermus
Expandable row in datatable
Hi, I need som help with how to create an expandable row in a datatable. The idea would be to have functionality like an accordion where you click the table row and it expands to show more details of the object in the current row. I've seen different examples of solutions and they all seem to use a ListView. Is it possible to achieve this using a datatable or am I better off switching to a dataview? Thanks. Håkan
Re: Generate markup for hidden framework form field?
The current component (the HiddenField) checks that the same value that it started with, is submitted. I'll try to replace that using a form validator that reads the parameter directly. Thanks Jörn On Tue, May 26, 2009 at 1:32 PM, Maarten Bosteels mbosteels@gmail.com wrote: When you write it out with oncomponenttagbody it's not part of the component hierarchy, it's just rendered markup. Once the form is submitted, you can retrieve the value using the servlet API. What behavior would you want to add on top ? Maarten On Tue, May 26, 2009 at 12:17 PM, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: How is that going the fix the problem? I'd end up with markup, but no behaviour on top of it. Jörn On Mon, May 25, 2009 at 5:52 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: right, so remove that code since you have replaced that component with pure markup. -igor On Mon, May 25, 2009 at 8:48 AM, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: That was the idea. But Wicket still can't find the component markup when looking for it. The form adds this elsewhere: add(new HiddenFieldString(csrf-protection, new ModelString(csrfProtection())).setRequired(true).add(new IValidatorString() { public void validate(IValidatableString validatable) { log.warn(potential csrf attack, submitted value: + validatable.getValue() + , expected: + csrfProtection()); validatable.error(new ValidationError().setMessage(wrong csrf protection cookie)); } })); Jörn On Mon, May 25, 2009 at 5:44 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: if you write it out in oncomponenttagbody then you dont need it in the markupo anymore. -igor On Mon, May 25, 2009 at 6:32 AM, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Hi, my application uses a form subclass everywhere for CSRF protection. Each form needs a hidden field like this: input type=hidden wicket:id=csrf-protection / The wicket component for that is added by the form subclass (SecureForm) which all other forms in the application extend. Currently each form has to include that markup somewhere, producing a lot of duplication. I'm looking for a way to get rid of that duplication. An approach I'm currently investigating is to generate the markup, similar to how Form genrates a hidden input it its onComponentTagBody: @Override protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) { String nameAndId = get(csrf-protection).getId(); AppendingStringBuffer buffer = new AppendingStringBuffer( input type=\hidden\ name=\).append(nameAndId).append(\ /); getResponse().write(buffer); super.onComponentTagBody(markupStream, openTag); } That doesn't work, Wicket throws an exception of a missing reference in markup anyway. Likely because this just writes to the response, not extending the markup. I also don't see any way to achieve this via MarkupStream or ComponentTag. Any ideas? Regards Jörn Zaefferer - 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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Generate markup for hidden framework form field?
Thanks guys! The end result looks like this, works fine, and removed a lot of html boilderplate from our templates: public SecureForm(String id, IModelT model) { super(id, model); setMarkupId(id); add(new IFormValidator() { @Override public void validate(Form? form) { String submitted = getRequest().getParameter(csrf-protection); if (Application.get().getConfigurationType().equals(Application.DEPLOYMENT) !csrfProtection().equals(submitted)) { log.warn(potential csrf attack, submitted value: + submitted + , expected: + csrfProtection()); form.error(wrong csrf protection cookie); } } @Override public FormComponent?[] getDependentFormComponents() { return null; } }); } @Override protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) { getResponse().write(new AppendingStringBuffer(input type=\hidden\ name=\csrf-protection\ value=\).append(csrfProtection()).append(\ /)); super.onComponentTagBody(markupStream, openTag); } Jörn On Tue, May 26, 2009 at 2:23 PM, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: The current component (the HiddenField) checks that the same value that it started with, is submitted. I'll try to replace that using a form validator that reads the parameter directly. Thanks Jörn On Tue, May 26, 2009 at 1:32 PM, Maarten Bosteels mbosteels@gmail.com wrote: When you write it out with oncomponenttagbody it's not part of the component hierarchy, it's just rendered markup. Once the form is submitted, you can retrieve the value using the servlet API. What behavior would you want to add on top ? Maarten On Tue, May 26, 2009 at 12:17 PM, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: How is that going the fix the problem? I'd end up with markup, but no behaviour on top of it. Jörn On Mon, May 25, 2009 at 5:52 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: right, so remove that code since you have replaced that component with pure markup. -igor On Mon, May 25, 2009 at 8:48 AM, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: That was the idea. But Wicket still can't find the component markup when looking for it. The form adds this elsewhere: add(new HiddenFieldString(csrf-protection, new ModelString(csrfProtection())).setRequired(true).add(new IValidatorString() { public void validate(IValidatableString validatable) { log.warn(potential csrf attack, submitted value: + validatable.getValue() + , expected: + csrfProtection()); validatable.error(new ValidationError().setMessage(wrong csrf protection cookie)); } })); Jörn On Mon, May 25, 2009 at 5:44 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: if you write it out in oncomponenttagbody then you dont need it in the markupo anymore. -igor On Mon, May 25, 2009 at 6:32 AM, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Hi, my application uses a form subclass everywhere for CSRF protection. Each form needs a hidden field like this: input type=hidden wicket:id=csrf-protection / The wicket component for that is added by the form subclass (SecureForm) which all other forms in the application extend. Currently each form has to include that markup somewhere, producing a lot of duplication. I'm looking for a way to get rid of that duplication. An approach I'm currently investigating is to generate the markup, similar to how Form genrates a hidden input it its onComponentTagBody: @Override protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) { String nameAndId = get(csrf-protection).getId(); AppendingStringBuffer buffer = new AppendingStringBuffer( input type=\hidden\ name=\).append(nameAndId).append(\ /); getResponse().write(buffer); super.onComponentTagBody(markupStream, openTag); } That doesn't work, Wicket throws an exception of a missing reference in markup anyway. Likely because this just writes to the response, not extending the markup. I also don't see any way to achieve this via MarkupStream or ComponentTag. Any ideas? Regards Jörn Zaefferer - 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: closing a ModalWindow from a forms onSubmit?
Thanks Steve, I did attempt something like that, but my real issue is that the form is submitted from the modalwindow, and the onSubmit of the AJaxButton is actually called after the form is successfully submitted, so by the time I know something happened, its already made the round trip to the server. In my case, even passing back to the parent on close would be too late :) I'm actually starting to think I'm going to need to do something drastic like customize my own button, so I can do both... that or ModalWindow, which should know enough about it self to close itself without having a target. - Brill On 26-May-09, at 3:12 AM, Steve Swinsburg wrote: Brill this is what I do for a window of mine, it has a few buttons and the parent page needs to know what one was clicked. Doing it in the button's onSubmit works. I pass an object into the ModalWindow's constructor, which was initialised in the parent page, then I set a property into an object in the AjaxButton onSubmit, then close it via window.close(target). The parent can then see the property in the WindowClosedCallback method which fires when it closed. cheers, Steve On 26/05/2009, at 7:37 AM, Brill Pappin wrote: Tried that :) and it always seems to be null. I switched to AjaxButtons, but the problem is that the are fired *after* the form submits, not before as a normal Button is. I'm essentially trying to set a value on the form's model depending on which button was pressed, and then close the ModalWindow on successful submit. There needs to be an easier way to do this... at the moment I'm starting to think I'm going to have to try and attache some javascript that will trigger pre-submit to set some sort of flag... but its getting very dirty. - Brill On 25-May-09, at 10:48 AM, Jeremy Thomerson wrote: If all you're saying is that you need to do it from your form's onsubmit, do this: AjaxRequestTarget art = AjaxRequestTarget.get(); if (art != null) { modal.close(art); } Jeremy Thomerson http://www.wickettraining.com -- sent from a wireless device -Original Message- From: Brill Pappin br...@pappin.ca Sent: Sunday, May 24, 2009 5:36 PM To: users@wicket.apache.org Subject: Re: closing a ModalWindow from a forms onSubmit? I likely could but am trying to avoid that, because then I have to call it for every button in the form (there are 4 now, all set a state and allow the event to propagate to the forms onSubmit(). Is there no way to know the current context from the component itself? - Brill On 24-May-09, at 5:55 PM, James Carman wrote: Can you submit the form via ajax? On May 24, 2009 2:08 PM, Brill Pappin br...@pappin.ca wrote: I have a form in a model window How do I close the ModalWindow in the form's onSubmit() method without the AjaxRequestTarget? - Brill - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org smime.p7s Description: S/MIME cryptographic signature
Re: Misfunctionality in WIA source code
Hello, did you ever resolve the issue with the book code?. I am on chapter 5.x in the WIA and I have posted a couple of issues but no response here either. David. - Original Message - From: HHB hubaghd...@yahoo.ca To: users@wicket.apache.org Sent: Sunday, May 17, 2009 7:09:57 AM GMT -06:00 US/Canada Central Subject: Misfunctionality in WIA source code Hey, I think the code of chapter 11 of Wicket In Action book isn't functioning properly. After logging in, try to logout, you should notice that you are still in the same page and you have to click on Logout link again in order to be taken to the sign in page. Any ideas? I'm using the same logout logic in our application and I'm facing the same problem. Thanks. - 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: Tips to start writing tests
Thanks a lot !! Per Lundholm wrote: Hi How about inserting the User object into the session before each test? private WicketTester tester; @Before public void beforeEachTest() { User fakeUser = new User(); tester.setupRequestAndResponse(); MySession wicketSession = (MySession) tester.getWicketSession(); wicketSession.setUser(fakeUser); } /Per 2009/5/26 HHB hubaghd...@yahoo.ca: Hey, I want to write tests for my Wicket pages and panels. The application is guarded via login functionality and all the pages and panels are depending on a User object in the session. I know who to write tests for Wicket, but I'm not sure what to do in my case due the authentication and authorization strategy. Any tips? Basically, the application is just one page and navigation is done via panels sweeping. Thanks. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- FaceBush, min insamling i Mustaschkampen: http://www.cancerfonden.se//sv/Mustaschkampen/Kampa/Insamlingar/?collection=243 - 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://www.nabble.com/Tips-to-start-writing-tests-tp23719712p23723163.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: How to test for a redirect after form submit, eg. setting RedirectRequestTarget?
Hello, if you don't get a Wicket solution you might want to try real-time testing for re-direction using something like the Apache JMeter: http://jakarta.apache.org/jmeter/ - Original Message - From: Jörn Zaefferer joern.zaeffe...@googlemail.com To: Wicket Users users@wicket.apache.org Sent: Monday, May 25, 2009 10:32:40 AM GMT -06:00 US/Canada Central Subject: How to test for a redirect after form submit, eg. setting RedirectRequestTarget? Hi, in one of my Wicket unit tests I'd like to assert that after a successful submit, a RedirectRequestTarget was set. Its not even necessary to check the exact URL of that redirect, just that it happens. I can't find any support for that via WicketTester, and RequestCycle.get().getRequestTarget() (or accessed via tester.getLastRenderedPage().getRequestCycle().getRequestTarget()) returns null. Any ideas? Regards Jörn Zaefferer - 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: adjusting form model on submit with AjaxButton -- Was: closing a ModalWindow from a forms onSubmit?
Ok, so have resolved my issue by reorganizing and refactoring a complex form so as not to use submit buttons to determine final state. However I do have one idea I didn't try (and won't at this point because I need to get on with things). I remember in the bad old days of JSP, one project i was one used multiple buttons extensively. When the buttons all had the same name, the one that was actually clicked would have its value set for the name of the input (just like a checkbox would). I was thinking that you could use a Check Group (or something like it) to create a group of buttons, similar to what is described here: http://wicketstuff.org/wicket13/compref/?wicket:bookmarkablePage=:org.apache.wicket.examples.compref.CheckGroupPage A quick look at the code suggests that it would work. You would capture the value of the buttons in your form model like any other input. If i ever have time I'll write up a SubmitButtonGroup component (unless someone else needs it first and writes one). - Brill On 25-May-09, at 9:30 AM, Brill Pappin wrote: There has got to be a solution for this. The problem with using an AjaxButton is that the onSubmit is called *after* the form is submitted, but since there are multiple submit buttons that change the model object just before submit, I need to adjust the model before the form is submitted. If I use a normal Button, I can adjust the form model but can't close the ModalWindow since I have no ajax target. - Brill On 24-May-09, at 6:36 PM, Brill Pappin wrote: I likely could but am trying to avoid that, because then I have to call it for every button in the form (there are 4 now, all set a state and allow the event to propagate to the forms onSubmit(). Is there no way to know the current context from the component itself? - Brill On 24-May-09, at 5:55 PM, James Carman wrote: Can you submit the form via ajax? On May 24, 2009 2:08 PM, Brill Pappin br...@pappin.ca wrote: I have a form in a model window How do I close the ModalWindow in the form's onSubmit() method without the AjaxRequestTarget? - Brill smime.p7s Description: S/MIME cryptographic signature
Re: DownloadLink (Javadoc)
Hello Steve, thanks, this worked. I imported the entire wicket 1.3.6 into Eclipse and a whole bunch of other things started working a whole lot better in the WIA Eclipse project. Since you got unlucky and I have you on the hook is there anyway of getting the mvn jetty:run to import into Eclipse such that I don't have to switch to a terminal or command window to redeploy to see the results of my changes. Maybe, somebody out there has a suggestion? Thanks and please advise, David. There are 10 kinds of people in this world: those who understand binary and those who don’t (Valid only for 2's complement). - Original Message - From: Steve Swinsburg s.swinsb...@lancaster.ac.uk To: users@wicket.apache.org Sent: Monday, May 25, 2009 5:10:57 PM GMT -06:00 US/Canada Central Subject: Re: DownloadLink (Javadoc) Hi David, You can get the Javadoc either by building it yourself from source via 'mvn javadoc:javadoc' or by issuing 'mvn eclipse:eclipse - DdownloadJavadocs=true' which will get the Javadoc and adjust your Eclipse classpath to link it up. cheers, Steve On 25/05/2009, at 10:54 PM, David Brown wrote: Hello, it just so happens I have been looking for Wicket Javadoc. the Wicket jar I have contains no javadoc. Please reply with the source of the Wicket javadoc you are referencing. Please advise, David. There are 10 kinds of people in this world: those who understand binary and those who don’t (Valid only for 2's complement). - Original Message - From: Douglas Ferguson doug...@douglasferguson.us To: users@wicket.apache.org Sent: Monday, May 25, 2009 12:11:06 PM GMT -06:00 US/Canada Central Subject: DownloadLink I was just reading the javadoc for DownloadLink and it says that it locks the PageMap, does this mean that the page becomes unresponsive during the download? It mentions using a shared resource as an alternative. Is there example of this online somewhere? Douglas - 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: Problem with Maven archetype, Eclipse Classpath and jetty:run
The first problem you mention is due to a change in how the maven eclipse plugins works, documented as a bug in: http://www.mail-archive.com/d...@maven.apache.org/msg80176.html http://www.mail-archive.com/d...@maven.apache.org/msg80176.html Known Issues: * [MECLIPSE-443] - Only include **/*.java in Java source directories may affect you if you use ajdt or have non-java sources in your directories that you expect to be compiled Release 2.6.1 (which may get renamed to 2.7) has fixed this issue and will be released shortly. However in order to get it works and better don't need to worry about fixing this in eclipse every time you generate the Eclipse project through mvn eclipse:eclipse, you can specify to use version 2.5 of maven-eclipse-plugin in your POM.xml build plugins plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-eclipse-plugin/artifactId version2.5/version /plugin /plugins /build Hope this help. igor.vaynberg wrote: On Tue, May 26, 2009 at 3:25 AM, Carl-Eric Menzel cm.wic...@users.bitforce.com wrote: - The classpath file generated by 'mvn eclipse:eclipse' has an include-pattern of '**/*.java' for both src/test/java and src/main/java. This means that by default none of the HTML files or other resources will be copied to the classpath when for example using the 'Start' class. go to preferences/compiler/building/output folder and remove *.html from Filtered Resources list. The second problem is due to the way I set up my project -- it may be odd (is it?), but I think this is rather sensible for standalone component development. - I am developing a standalone component for use in other projects, so under src/main/ I'd like to have only the classes and resources that belong to the component. On the other hand, for testing and debugging purposes, a simple Wicket application and page are very handy, so I moved those from src/main to src/test, since these shouldn't show up in the generated jar file. test is for tests :) the proper way to do this is to create a multimodule project - one module containing the component and another containing a demo which you can also use for testing. -igor - 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://www.nabble.com/Problem-with-Maven-archetype%2C-Eclipse-Classpath-and-jetty%3Arun-tp23720481p23725755.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: How to test for a redirect after form submit, eg. setting RedirectRequestTarget?
subclass requestcycle, override onrequesttargetset (may only be in 1.4) and set some flag when you see the redirect, or add it to some list you have visibility into. -igor On Mon, May 25, 2009 at 8:32 AM, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Hi, in one of my Wicket unit tests I'd like to assert that after a successful submit, a RedirectRequestTarget was set. Its not even necessary to check the exact URL of that redirect, just that it happens. I can't find any support for that via WicketTester, and RequestCycle.get().getRequestTarget() (or accessed via tester.getLastRenderedPage().getRequestCycle().getRequestTarget()) returns null. Any ideas? Regards Jörn Zaefferer - 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: MultiFileUploadField: How to filter file types
even max size is checked serverside, you may be able to do the same for file types. alternatively you can hook in with a javascript by adding an onchange event and possibly rejecting a file. -igor On Tue, May 26, 2009 at 3:46 AM, Marco Santos mpssan...@gmail.com wrote: Hello there. Im using the MultiFileUploadField but i would like that the user could just see/choose some type of files. for instance, he could only select jpeg or/and png files. I notice that is possible to specify the max size of a file. Is possible to specify the type files that the user can select? Thanks a lot -- Marco Santos - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Problems using wicket with web.xml security
try in a different servlet container -igor On Tue, May 26, 2009 at 4:56 AM, Matthias Keller matthias.kel...@ergon.ch wrote: Hi We have a wicket application which should be completely secured by FORM authentication by the webserver. For that, we have the following in web.xml: security-constraint display-nameSecured pages/display-name web-resource-collection web-resource-nameAll Pages/web-resource-name url-pattern/*/url-pattern http-methodGET/http-method http-methodPOST/http-method /web-resource-collection auth-constraint role-namesomeRole/role-name /auth-constraint /security-constraint login-config auth-methodFORM/auth-method realm-nameSecure Everything/realm-name form-login-config form-login-page/login/form-login-page form-error-page/login/login-error.jsp/form-error-page /form-login-config /login-config security-role descriptionUser security role/description role-namesomeRole/role-name /security-role security-role descriptionUser security role/description role-namesomeOtherRole/role-name /security-role Unfortunately, it seems that every user having ANY role gets access to the wicket pages. For example a user with role someOtherRole will get access to the main page, as its url is for example: http://localhost:7001/app/?wicket:interface=:2 When he tries to access a mounted page though, he gets the Error 403--Forbidden as expected. But he should also get this error when trying to access the home page of the wicket app. I suspect it has something to do with the /* url-pattern not catching the /?wicket:interface=:2 ??? Thanks for your help!! Matt -- matthias.kel...@ergon.ch +41 44 268 83 98 Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich http://www.ergon.ch __ e r g o n smart people - smart software - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ResourceLink and ResponsePage
you should use a different link - when the user clicks a file you should remove the item first, and then use a redirect to send the user to the url that will start downloading the file. -igor On Mon, May 25, 2009 at 7:54 AM, Humberto N. Castejon Martinez humca...@gmail.com wrote: Hi! I have a web page that shows a list of items, each of them with an associated link (a ResourceLink) to download a file. I would like the web page to be refreshed once a file has been downloaded (I want the associted item to be removed from the list). I tried overriding the onClick() method of my ResourceLink and setting the response page to the current page, but then the html file of the web page is downloaded and not the original file. Is there a way to achieve what I want? Thanks! Cheers, Humberto - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Expandable row in datatable
datatable is meant to work with columns, if you need to manipulate rows you are probably better off not using it. -igor On Tue, May 26, 2009 at 5:17 AM, hakan.stei...@foxt.com wrote: Hi, I need som help with how to create an expandable row in a datatable. The idea would be to have functionality like an accordion where you click the table row and it expands to show more details of the object in the current row. I've seen different examples of solutions and they all seem to use a ListView. Is it possible to achieve this using a datatable or am I better off switching to a dataview? Thanks. Håkan - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: AjaxEditableLabel ... but how to get the changed value?
On Tue, 26 May 2009 16:27:18 +0200 Dorothée Giernoth dorothee.giern...@kds-kg.de wrote: Now I want to write the changed information from these labels back into the database after the content has changed. Wouldn't be too much of a problem if I knew how to retrieve the changed value from the label. I really have no clue how to do that! Override the onSubmit() method, like this (untested, but you get the gist): cell.add(new AjaxEditableLabel(cell.newChildId(), new Model(...)) { protected void onSubmit(AjaxRequestTarget target) { super.onSubmit(target); String value = getDefaultModelObject(); // persist value here... } }); Alternatively, if you keep a reference to the model you pass to the AjaxEditableLabel, you can read its contents at some other point. Grüße Carl-Eric - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Problem with Maven archetype, Eclipse Classpath and jetty:run
On Tue, May 26, 2009 at 3:25 AM, Carl-Eric Menzel cm.wic...@users.bitforce.com wrote: - The classpath file generated by 'mvn eclipse:eclipse' has an include-pattern of '**/*.java' for both src/test/java and src/main/java. This means that by default none of the HTML files or other resources will be copied to the classpath when for example using the 'Start' class. go to preferences/compiler/building/output folder and remove *.html from Filtered Resources list. The second problem is due to the way I set up my project -- it may be odd (is it?), but I think this is rather sensible for standalone component development. - I am developing a standalone component for use in other projects, so under src/main/ I'd like to have only the classes and resources that belong to the component. On the other hand, for testing and debugging purposes, a simple Wicket application and page are very handy, so I moved those from src/main to src/test, since these shouldn't show up in the generated jar file. test is for tests :) the proper way to do this is to create a multimodule project - one module containing the component and another containing a demo which you can also use for testing. -igor - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: DownloadLink (Javadoc)
Read the free downloadable bonus chapter 15 to WIA, downloadable from http://wicketinaction.com/downloads This explains all this stuff, including setting up your Eclipse workspace from maven, and running the embedded Jetty server. Martijn On Tue, May 26, 2009 at 4:52 PM, David Brown dbr...@sexingtechnologies.com wrote: Hello Steve, thanks, this worked. I imported the entire wicket 1.3.6 into Eclipse and a whole bunch of other things started working a whole lot better in the WIA Eclipse project. Since you got unlucky and I have you on the hook is there anyway of getting the mvn jetty:run to import into Eclipse such that I don't have to switch to a terminal or command window to redeploy to see the results of my changes. Maybe, somebody out there has a suggestion? Thanks and please advise, David. There are 10 kinds of people in this world: those who understand binary and those who don’t (Valid only for 2's complement). - Original Message - From: Steve Swinsburg s.swinsb...@lancaster.ac.uk To: users@wicket.apache.org Sent: Monday, May 25, 2009 5:10:57 PM GMT -06:00 US/Canada Central Subject: Re: DownloadLink (Javadoc) Hi David, You can get the Javadoc either by building it yourself from source via 'mvn javadoc:javadoc' or by issuing 'mvn eclipse:eclipse - DdownloadJavadocs=true' which will get the Javadoc and adjust your Eclipse classpath to link it up. cheers, Steve On 25/05/2009, at 10:54 PM, David Brown wrote: Hello, it just so happens I have been looking for Wicket Javadoc. the Wicket jar I have contains no javadoc. Please reply with the source of the Wicket javadoc you are referencing. Please advise, David. There are 10 kinds of people in this world: those who understand binary and those who don’t (Valid only for 2's complement). - Original Message - From: Douglas Ferguson doug...@douglasferguson.us To: users@wicket.apache.org Sent: Monday, May 25, 2009 12:11:06 PM GMT -06:00 US/Canada Central Subject: DownloadLink I was just reading the javadoc for DownloadLink and it says that it locks the PageMap, does this mean that the page becomes unresponsive during the download? It mentions using a shared resource as an alternative. Is there example of this online somewhere? Douglas - 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 -- Become a Wicket expert, learn from the best: http://wicketinaction.com Apache Wicket 1.3.5 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Storing css and image files
it may be helpful to create wicket:context analog of wicket:link, we already have the framework for getting the path prefix to get to context path. this is of course only useful for application-specific resources as those will not be reused across projects. in our case our SA extracts the war and copies everything but WEB-INF to apache so all those static application resources can be served there. -igor On Tue, May 26, 2009 at 2:41 AM, Martijn Dashorst martijn.dasho...@gmail.com wrote: Why wouldn't it be a viable solution? It gives you the opportunity to let the resources be served by your container, which should be speedier than letting wicket handle it (such requests are filtered through and go to your container). The relative paths are just that: relative, and they always map to the absolute same resource URI. In fact, they are more stable than serving things from your classpath, as those resources are served from the path /context/resources/, and if we decide to call that path /context/foobar/ all your reasoning about stability goes out the window. Martijn On Mon, May 25, 2009 at 6:38 PM, Luther Baker lutherba...@gmail.com wrote: **On Mon, May 25, 2009 at 2:34 AM, Martijn Dashorst martijn.dasho...@gmail.com wrote: or, if these images and css are for your application, and application wide (i.e. all pages include them), you could put them in src/main/webapp/.. and just link src=style.css ... / them in your markup. Martijn I'd like to pose a design/theoratical thought here I understand that wicket:link/ does the right thing for resources (like stylesheets) kept in the classpath. I love this behavior. But, as we know, depending on where my browser URL points, the following: link href=css/styles.css .../ resolves to different locations. For instance, said stylesheet referenced from: http://hostname/context/products/wires/24 physically resolves to (mavenized) webapps/*products/wires*/css/styles.css, whereas from http://hostname/context/people/hr/judy resolves to webapps/*people/hr/judy*/css/styles.css (In part, this is due to our effort NOT to hardcode the context into the link's href.) *Traditionally, I solved this one of three ways:* 1. Manually manage every application URL and every mapped file and make sure that in all cases the relative path is correct. Ugh! For obvious reasons - this technique is not maintainable. Large apps back in the early days of Struts with hundreds of actions and JSPs, this just wasn't fun. 2. JSTL came along and I started to leverage the c:url tag. For the most part, that was a workable solution - the resulting path was 'absolute' but it wasn't hardcoded. Essentially, it gives the framework a chance to work its magic (if it were to change somehow). 3. Today, I use the resource method (wicket:link/) which obviates all anxiety by simply letting the framework just manage it. So to your point Martijn, is using webapp/css and directly including link href=css/styles.css .../ really a good - viable, long-term solution in Wicket apps? Understandably maybe today, the default URL mapper in Wicket uses query strings and not deep or hierarchical urls - but the important term for me here is today. What if, in the future, wicket decides to change the default URL mapping scheme - maybe become more RESTful. The inertia built up around legacy apps using webapp/css may pose a problem. I don't think this is premature functionality ... I think links and urls are a here a now thing and that building and migrating apps to future versions of frameworks is hard and that a loose practice here may come back to bite a developer ... ? Also, I've not yet mounted urls but I assume if I were to mount URLs - I'd have to really manage this webapp/css approach - whereas, the resource approach with wicket:link/ would just keep humming along. Some may argue that it isn't really *better* to provide multiple ways to do the same thing ... take Tapestry for instance and the technical relevance as to where markup files can or cannot reside. This post is indeed a bit philosophical/theoretical - I've often thought about this topic and wanted to clarify in my mind that maybe, these are either moot points, ignored concerns, overthinking on my part ... or just not important somehow. As I mentioned, this little detail has always been a pain point in my previous work and I've just been happy as a lark to use the wicket:link/ which protects me from whatever the future provides. I'm just surprised it isn't the suggested best practice or that dropping files into webapp/* is *ill*-advised since it assumes something about how Wicket works. Thanks, -Luther -- Become a Wicket expert, learn from the best: http://wicketinaction.com Apache Wicket 1.3.5 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
Refreshing a list while using ListDataProvider
Hello: I have a simple search form , where some criteria refreshes the table based on the db. I got it working with ListView, but im trying to use ListDataProvider, I feel missing something: class MyForm { List myList; MyDataView myDataView; MyDataProvider myDataProvider; public MyForm() { @Override public void onSubmit() { myList = refreshData(criteria); //Question: How do I set this list into the myDataView or myDataProvider ? I thought myDataView or the provider will auto pick it up, because its a member variable and is a RefreshingView } //First time myList = refreshData(defaultCriteria); myDataView = new MyDataView(myDataView , new MyDataProvider(myList)); add(myListView); } } class MyDataView extends DataView { public MyDataView(String id, IDataProvider provider) { super(id, provider); } @Override public void populateItem(Item item) { } } class MyDataProvider extends ListDataProvider { public MyDataProvider(List list) { super(list); } } I looked at the example that uses ListView http://cwiki.apache.org/WICKET/reading-from-a-database.html http://cwiki.apache.org/WICKET/reading-from-a-database.html With ListView it works fine if I do this in the method onSubmit() myList = refreshData(criteria); myListView.setList(myList); But with DataView, I do not have a set method to reset the new list obtained based on the criteria. The db returns correct data, but the page displays the old data (no change). Neither do I see a method to set the new list in the ListDataProvider. I even tried adding a new view inside the onSubmit, but that doesnt work either: myDataView = new MyDataView(myDataView, new MyDataProvider(newList)); -- Thanks! Vasu Srinivasan
how to control/locate which html to load
Hi! I’m writing a mobile web interface using wicket. Since there are mobile devices with various screen resolutions, I need to maintain separate set of htmls (per component class) based on category/resolution. I’m able to define custom place for htmls (thanks to http://cwiki.apache.org/WICKET/control-where-html-files-are-loaded-from.html ), but having problem with locating correct file at runtime. Wicket is invoking locate(Class clazz, String path) of my custom ResourceStreamLocator for the 1st time only. Then, I assume, its remembering the file path or stream and always showing htmls for the 1st requesting device category! Is there any way (a hack may be!) to instruct/force wicket to invoke locate(…) everytime a request comes? Below a snippet of my current implementation: public class MyWebApplication extends WebApplication { … protected void init() { IResourceSettings resourceSettings = getResourceSettings(); resourceSettings.setResourceStreamLocator(new MyResourceLocator()); } } public class MyResourceLocator extends ResourceStreamLocator { … public IResourceStream locate(final Class clazz, final String path) { MySession session = MySession.get(); IResourceStream located = locateByClassLoader(clazz, getHtmlPath(path, session.getDevice())); return located; } private String getHtmlPath(String path, PlainDevice d) { if (category-1) { return category-1-folder-path + path.substring(path.lastIndexOf(/) + 1); } else { return category-2-folder-path + path.substring(path.lastIndexOf(/) + 1); } } protected IResourceStream locateByClassLoader(final Class clazz, final String path) { ClassLoader classLoader = null; if (classLoader == null) { // use context classloader when no specific classloader is set // (package resources for instance) classLoader = Thread.currentThread().getContextClassLoader(); } if (clazz != null) { classLoader = clazz.getClassLoader(); } if (classLoader == null) { // use Wicket classloader when no specific classloader is set classLoader = getClass().getClassLoader(); } logger.debug(path : + path); // Try loading path using classloader final URL url = classLoader.getResource(path); if (url != null) { return new UrlResourceStream(url); } return null; } } /Anirban
Re: Framework sales pitch
That would make sense, but personally I have not seen much of the articles etc written on wicket by the framework developers themselves, So am I missing something? The word has to get out somehow at some point ... how does that happen? is it random? Regards Vyas, Anirudh On Sun, May 24, 2009 at 3:31 PM, Scott Swank scott.sw...@gmail.com wrote: I suspect that articles on broadly read sites, such as theserverside dzone are significant vectors. Scott On Sun, May 24, 2009 at 11:37 AM, Ricky ricky...@gmail.com wrote: Hi, I am interested in knowing as to how does a framework reach its potential developers in open source, for example Wicket, it started out and so how do people know about it? 1.) Is it that person A tells person B tells person C sort of chain? 2.) Or is it well planned out? if so how? Just curious... Regards Vyas, Anirudh || ॐ || - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Refreshing a list while using ListDataProvider
you can build your own analog of listdataprovider that pulls the list directly from whatever property contains the latest. -igor On Tue, May 26, 2009 at 9:38 AM, Vasu Srinivasan vasy...@gmail.com wrote: Hello: I have a simple search form , where some criteria refreshes the table based on the db. I got it working with ListView, but im trying to use ListDataProvider, I feel missing something: class MyForm { List myList; MyDataView myDataView; MyDataProvider myDataProvider; public MyForm() { �...@override public void onSubmit() { myList = refreshData(criteria); //Question: How do I set this list into the myDataView or myDataProvider ? I thought myDataView or the provider will auto pick it up, because its a member variable and is a RefreshingView } //First time myList = refreshData(defaultCriteria); myDataView = new MyDataView(myDataView , new MyDataProvider(myList)); add(myListView); } } class MyDataView extends DataView { public MyDataView(String id, IDataProvider provider) { super(id, provider); } @Override public void populateItem(Item item) { } } class MyDataProvider extends ListDataProvider { public MyDataProvider(List list) { super(list); } } I looked at the example that uses ListView http://cwiki.apache.org/WICKET/reading-from-a-database.html http://cwiki.apache.org/WICKET/reading-from-a-database.html With ListView it works fine if I do this in the method onSubmit() myList = refreshData(criteria); myListView.setList(myList); But with DataView, I do not have a set method to reset the new list obtained based on the criteria. The db returns correct data, but the page displays the old data (no change). Neither do I see a method to set the new list in the ListDataProvider. I even tried adding a new view inside the onSubmit, but that doesnt work either: myDataView = new MyDataView(myDataView, new MyDataProvider(newList)); -- Thanks! Vasu Srinivasan - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: how to control/locate which html to load
you should use session.setstyle() and have a seperate style per screen resolution variant -igor 2009/5/26 Anirban Basak anirban.ba...@rebaca.com: Hi! I’m writing a mobile web interface using wicket. Since there are mobile devices with various screen resolutions, I need to maintain separate set of htmls (per component class) based on category/resolution. I’m able to define custom place for htmls (thanks to http://cwiki.apache.org/WICKET/control-where-html-files-are-loaded-from.html ), but having problem with locating correct file at runtime. Wicket is invoking locate(Class clazz, String path) of my custom ResourceStreamLocator for the 1st time only. Then, I assume, its remembering the file path or stream and always showing htmls for the 1st requesting device category! Is there any way (a hack may be!) to instruct/force wicket to invoke locate(…) everytime a request comes? Below a snippet of my current implementation: public class MyWebApplication extends WebApplication { … protected void init() { IResourceSettings resourceSettings = getResourceSettings(); resourceSettings.setResourceStreamLocator(new MyResourceLocator()); } } public class MyResourceLocator extends ResourceStreamLocator { … public IResourceStream locate(final Class clazz, final String path) { MySession session = MySession.get(); IResourceStream located = locateByClassLoader(clazz, getHtmlPath(path, session.getDevice())); return located; } private String getHtmlPath(String path, PlainDevice d) { if (category-1) { return category-1-folder-path + path.substring(path.lastIndexOf(/) + 1); } else { return category-2-folder-path + path.substring(path.lastIndexOf(/) + 1); } } protected IResourceStream locateByClassLoader(final Class clazz, final String path) { ClassLoader classLoader = null; if (classLoader == null) { // use context classloader when no specific classloader is set // (package resources for instance) classLoader = Thread.currentThread().getContextClassLoader(); } if (clazz != null) { classLoader = clazz.getClassLoader(); } if (classLoader == null) { // use Wicket classloader when no specific classloader is set classLoader = getClass().getClassLoader(); } logger.debug(path : + path); // Try loading path using classloader final URL url = classLoader.getResource(path); if (url != null) { return new UrlResourceStream(url); } return null; } } /Anirban - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Storing css and image files
I like that idea! On Tue, May 26, 2009 at 10:33 AM, Igor Vaynberg igor.vaynb...@gmail.comwrote: it may be helpful to create wicket:context analog of wicket:link, we already have the framework for getting the path prefix to get to context path. this is of course only useful for application-specific resources as those will not be reused across projects. in our case our SA extracts the war and copies everything but WEB-INF to apache so all those static application resources can be served there. -igor On Tue, May 26, 2009 at 2:41 AM, Martijn Dashorst martijn.dasho...@gmail.com wrote: Why wouldn't it be a viable solution? It gives you the opportunity to let the resources be served by your container, which should be speedier than letting wicket handle it (such requests are filtered through and go to your container). The relative paths are just that: relative, and they always map to the absolute same resource URI. In fact, they are more stable than serving things from your classpath, as those resources are served from the path /context/resources/, and if we decide to call that path /context/foobar/ all your reasoning about stability goes out the window. Martijn On Mon, May 25, 2009 at 6:38 PM, Luther Baker lutherba...@gmail.com wrote: **On Mon, May 25, 2009 at 2:34 AM, Martijn Dashorst martijn.dasho...@gmail.com wrote: or, if these images and css are for your application, and application wide (i.e. all pages include them), you could put them in src/main/webapp/.. and just link src=style.css ... / them in your markup. Martijn I'd like to pose a design/theoratical thought here I understand that wicket:link/ does the right thing for resources (like stylesheets) kept in the classpath. I love this behavior. But, as we know, depending on where my browser URL points, the following: link href=css/styles.css .../ resolves to different locations. For instance, said stylesheet referenced from: http://hostname/context/products/wires/24 physically resolves to (mavenized) webapps/*products/wires*/css/styles.css, whereas from http://hostname/context/people/hr/judy resolves to webapps/*people/hr/judy*/css/styles.css (In part, this is due to our effort NOT to hardcode the context into the link's href.) *Traditionally, I solved this one of three ways:* 1. Manually manage every application URL and every mapped file and make sure that in all cases the relative path is correct. Ugh! For obvious reasons - this technique is not maintainable. Large apps back in the early days of Struts with hundreds of actions and JSPs, this just wasn't fun. 2. JSTL came along and I started to leverage the c:url tag. For the most part, that was a workable solution - the resulting path was 'absolute' but it wasn't hardcoded. Essentially, it gives the framework a chance to work its magic (if it were to change somehow). 3. Today, I use the resource method (wicket:link/) which obviates all anxiety by simply letting the framework just manage it. So to your point Martijn, is using webapp/css and directly including link href=css/styles.css .../ really a good - viable, long-term solution in Wicket apps? Understandably maybe today, the default URL mapper in Wicket uses query strings and not deep or hierarchical urls - but the important term for me here is today. What if, in the future, wicket decides to change the default URL mapping scheme - maybe become more RESTful. The inertia built up around legacy apps using webapp/css may pose a problem. I don't think this is premature functionality ... I think links and urls are a here a now thing and that building and migrating apps to future versions of frameworks is hard and that a loose practice here may come back to bite a developer ... ? Also, I've not yet mounted urls but I assume if I were to mount URLs - I'd have to really manage this webapp/css approach - whereas, the resource approach with wicket:link/ would just keep humming along. Some may argue that it isn't really *better* to provide multiple ways to do the same thing ... take Tapestry for instance and the technical relevance as to where markup files can or cannot reside. This post is indeed a bit philosophical/theoretical - I've often thought about this topic and wanted to clarify in my mind that maybe, these are either moot points, ignored concerns, overthinking on my part ... or just not important somehow. As I mentioned, this little detail has always been a pain point in my previous work and I've just been happy as a lark to use the wicket:link/ which protects me from whatever the future provides. I'm just surprised it isn't the suggested best practice or that dropping files into webapp/* is *ill*-advised since it assumes something about how Wicket works. Thanks,
[announce] WicketStuff Artwork new release
Hi Guys Just wanted to tell that theres a new release of wicketstuff artwork out. This time including niftycornerscube. Artwork, will pimp the graphics of your web site by adding some small javascript behaviors to your components that for example can make round corners.. See here for more info screenshots: http://ninomartinez.wordpress.com/2009/05/26/wicketstuff-artwork-new-release/' regards Nino - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: [announce] WicketStuff Artwork new release
nino martinez wael nino.martinez.wael at gmail.com writes: Hi Guys Just wanted to tell that theres a new release of wicketstuff artwork out. This time including niftycornerscube. Artwork, will pimp the graphics of your web site by adding some small javascript behaviors to your components that for example can make round corners.. See here for more info screenshots: http://ninomartinez.wordpress.com/2009/05/26/wicketstuff-artwork-new-release/' regards Nino Your link has an extra character, here it goes: http://ninomartinez.wordpress.com/2009/05/26/wicketstuff-artwork-new-release/ Nice stuff, thanks for sharing !!! Daniel - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: [announce] WicketStuff Artwork new release
Thanks for correcting:) 2009/5/26 Daniel Toffetti dto...@yahoo.com.ar: nino martinez wael nino.martinez.wael at gmail.com writes: Hi Guys Just wanted to tell that theres a new release of wicketstuff artwork out. This time including niftycornerscube. Artwork, will pimp the graphics of your web site by adding some small javascript behaviors to your components that for example can make round corners.. See here for more info screenshots: http://ninomartinez.wordpress.com/2009/05/26/wicketstuff-artwork-new-release/' regards Nino Your link has an extra character, here it goes: http://ninomartinez.wordpress.com/2009/05/26/wicketstuff-artwork-new-release/ Nice stuff, thanks for sharing !!! Daniel - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Exception message somewhat unhelpful
Hi all, I'm getting The model must provide a non-null object exception, from PackagedResourceReference, line 177. I guess the message would be a lot more useful if for componentId + id, was added to the message. I've noticed this happens in a lot of other similar exception messages as well. Is this a reasonable request, should I add a JIRA issue for this ? Cheers, Daniel - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Refreshing a list while using ListDataProvider
Thanks for the reply ... I tried doing this : class MyDataProvider extends ListDataProvider { DataDao dataDao; Criteria criteria; public MyDataProvider(List list, Criteria criteria) { super(list); ... } //providing my own iterator which goes to the dataDao and gets the data //But now I cannot set the list, because private... So I have to use my own list member...If I do that, then what is the point of calling the constructor with List? } Looks like ListDataProvider is not useful for reusable Lists. Not sure why this should be so ? If I am able to set a new List into the provider, I would not be breaking anything because the data is anyway retrieved only via an Iterator. The problem is even if I create a new ListDataProvider for every new list, I am not able to set that again in my data view. DataView does not have any thing similar to setList (a la ListView.setList). I dont think I should be creating a new DataView for every search, because all i'm doing is only changing contents of the underlying list. Am I missing something ? On Tue, May 26, 2009 at 12:29 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote: you can build your own analog of listdataprovider that pulls the list directly from whatever property contains the latest. -igor On Tue, May 26, 2009 at 9:38 AM, Vasu Srinivasan vasy...@gmail.com wrote: Hello: I have a simple search form , where some criteria refreshes the table based on the db. I got it working with ListView, but im trying to use ListDataProvider, I feel missing something: class MyForm { List myList; MyDataView myDataView; MyDataProvider myDataProvider; public MyForm() { @Override public void onSubmit() { myList = refreshData(criteria); //Question: How do I set this list into the myDataView or myDataProvider ? I thought myDataView or the provider will auto pick it up, because its a member variable and is a RefreshingView } //First time myList = refreshData(defaultCriteria); myDataView = new MyDataView(myDataView , new MyDataProvider(myList)); add(myListView); } } class MyDataView extends DataView { public MyDataView(String id, IDataProvider provider) { super(id, provider); } @Override public void populateItem(Item item) { } } class MyDataProvider extends ListDataProvider { public MyDataProvider(List list) { super(list); } } I looked at the example that uses ListView http://cwiki.apache.org/WICKET/reading-from-a-database.html http://cwiki.apache.org/WICKET/reading-from-a-database.html With ListView it works fine if I do this in the method onSubmit() myList = refreshData(criteria); myListView.setList(myList); But with DataView, I do not have a set method to reset the new list obtained based on the criteria. The db returns correct data, but the page displays the old data (no change). Neither do I see a method to set the new list in the ListDataProvider. I even tried adding a new view inside the onSubmit, but that doesnt work either: myDataView = new MyDataView(myDataView, new MyDataProvider(newList)); -- Thanks! Vasu Srinivasan - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Regards, Vasu Srinivasan
Re: Refreshing a list while using ListDataProvider
i meant implement IDataProvider directly if ListDataProvider doesnt work for you. most of the time you modify an existing instance of List, not create a new one, so ListDataProvider is useful there. -igor On Tue, May 26, 2009 at 1:15 PM, Vasu Srinivasan vasy...@gmail.com wrote: Thanks for the reply ... I tried doing this : class MyDataProvider extends ListDataProvider { DataDao dataDao; Criteria criteria; public MyDataProvider(List list, Criteria criteria) { super(list); ... } //providing my own iterator which goes to the dataDao and gets the data //But now I cannot set the list, because private... So I have to use my own list member...If I do that, then what is the point of calling the constructor with List? } Looks like ListDataProvider is not useful for reusable Lists. Not sure why this should be so ? If I am able to set a new List into the provider, I would not be breaking anything because the data is anyway retrieved only via an Iterator. The problem is even if I create a new ListDataProvider for every new list, I am not able to set that again in my data view. DataView does not have any thing similar to setList (a la ListView.setList). I dont think I should be creating a new DataView for every search, because all i'm doing is only changing contents of the underlying list. Am I missing something ? On Tue, May 26, 2009 at 12:29 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote: you can build your own analog of listdataprovider that pulls the list directly from whatever property contains the latest. -igor On Tue, May 26, 2009 at 9:38 AM, Vasu Srinivasan vasy...@gmail.com wrote: Hello: I have a simple search form , where some criteria refreshes the table based on the db. I got it working with ListView, but im trying to use ListDataProvider, I feel missing something: class MyForm { List myList; MyDataView myDataView; MyDataProvider myDataProvider; public MyForm() { �...@override public void onSubmit() { myList = refreshData(criteria); //Question: How do I set this list into the myDataView or myDataProvider ? I thought myDataView or the provider will auto pick it up, because its a member variable and is a RefreshingView } //First time myList = refreshData(defaultCriteria); myDataView = new MyDataView(myDataView , new MyDataProvider(myList)); add(myListView); } } class MyDataView extends DataView { public MyDataView(String id, IDataProvider provider) { super(id, provider); } @Override public void populateItem(Item item) { } } class MyDataProvider extends ListDataProvider { public MyDataProvider(List list) { super(list); } } I looked at the example that uses ListView http://cwiki.apache.org/WICKET/reading-from-a-database.html http://cwiki.apache.org/WICKET/reading-from-a-database.html With ListView it works fine if I do this in the method onSubmit() myList = refreshData(criteria); myListView.setList(myList); But with DataView, I do not have a set method to reset the new list obtained based on the criteria. The db returns correct data, but the page displays the old data (no change). Neither do I see a method to set the new list in the ListDataProvider. I even tried adding a new view inside the onSubmit, but that doesnt work either: myDataView = new MyDataView(myDataView, new MyDataProvider(newList)); -- Thanks! Vasu Srinivasan - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Regards, Vasu Srinivasan - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Exception message somewhat unhelpful
a jira with a patch is very welcome. -igor On Tue, May 26, 2009 at 1:10 PM, Daniel Toffetti dto...@yahoo.com.ar wrote: Hi all, I'm getting The model must provide a non-null object exception, from PackagedResourceReference, line 177. I guess the message would be a lot more useful if for componentId + id, was added to the message. I've noticed this happens in a lot of other similar exception messages as well. Is this a reasonable request, should I add a JIRA issue for this ? Cheers, Daniel - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Refreshing a list while using ListDataProvider
Ok I think I am understanding it a little better now. For now Im still extending myDataProvider from ListDataProvider, but no longer using a new ArrayList() for every search. Im clearing it out and adding new data, which is okay. One question though -- What is the responsibility scope of the ListDataProvider / IDataProvider? Am I correct in assuming the following -- 1) only operate on the given List/Data (already manipulated) 2) *should not* contain a Dao, and refresh its own list/data. Because if (2), then I am seeing an issue -- where do I call the dao.query() ? In the constructor or in the iterator() ? If I do in the constructor, its not refreshed for further queries. If I do in the iterator(), then the size() is queried before the DataView calls the iterator(), so it always returns 0 records for the first time. And also calling dao.query() in the iterator() will make it query the whole list for every pagination, which is probably not a good idea. I liked the idea of dataprovider encapsulating dao, but not clear where would I refresh it. Thanks ! Vasya On Tue, May 26, 2009 at 3:25 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote: i meant implement IDataProvider directly if ListDataProvider doesnt work for you. most of the time you modify an existing instance of List, not create a new one, so ListDataProvider is useful there. -igor On Tue, May 26, 2009 at 1:15 PM, Vasu Srinivasan vasy...@gmail.com wrote: Thanks for the reply ... I tried doing this : class MyDataProvider extends ListDataProvider { DataDao dataDao; Criteria criteria; public MyDataProvider(List list, Criteria criteria) { super(list); ... } //providing my own iterator which goes to the dataDao and gets the data //But now I cannot set the list, because private... So I have to use my own list member...If I do that, then what is the point of calling the constructor with List? } Looks like ListDataProvider is not useful for reusable Lists. Not sure why this should be so ? If I am able to set a new List into the provider, I would not be breaking anything because the data is anyway retrieved only via an Iterator. The problem is even if I create a new ListDataProvider for every new list, I am not able to set that again in my data view. DataView does not have any thing similar to setList (a la ListView.setList). I dont think I should be creating a new DataView for every search, because all i'm doing is only changing contents of the underlying list. Am I missing something ? On Tue, May 26, 2009 at 12:29 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: you can build your own analog of listdataprovider that pulls the list directly from whatever property contains the latest. -igor On Tue, May 26, 2009 at 9:38 AM, Vasu Srinivasan vasy...@gmail.com wrote: Hello: I have a simple search form , where some criteria refreshes the table based on the db. I got it working with ListView, but im trying to use ListDataProvider, I feel missing something: class MyForm { List myList; MyDataView myDataView; MyDataProvider myDataProvider; public MyForm() { @Override public void onSubmit() { myList = refreshData(criteria); //Question: How do I set this list into the myDataView or myDataProvider ? I thought myDataView or the provider will auto pick it up, because its a member variable and is a RefreshingView } //First time myList = refreshData(defaultCriteria); myDataView = new MyDataView(myDataView , new MyDataProvider(myList)); add(myListView); } } class MyDataView extends DataView { public MyDataView(String id, IDataProvider provider) { super(id, provider); } @Override public void populateItem(Item item) { } } class MyDataProvider extends ListDataProvider { public MyDataProvider(List list) { super(list); } } I looked at the example that uses ListView http://cwiki.apache.org/WICKET/reading-from-a-database.html http://cwiki.apache.org/WICKET/reading-from-a-database.html With ListView it works fine if I do this in the method onSubmit() myList = refreshData(criteria); myListView.setList(myList); But with DataView, I do not have a set method to reset the new list obtained based on the criteria. The db returns correct data, but the page displays the old data (no change). Neither do I see a method to set the new list in the ListDataProvider. I even tried adding a new view inside the onSubmit, but that doesnt work either: myDataView = new MyDataView(myDataView, new MyDataProvider(newList)); -- Thanks! Vasu Srinivasan - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail:
Re: Problem with Maven archetype, Eclipse Classpath and jetty:run
On Tue, 26 May 2009 08:31:04 -0700 Igor Vaynberg igor.vaynb...@gmail.com wrote: go to preferences/compiler/building/output folder and remove *.html from Filtered Resources list. I know that :-) I was proposing making this the default in the archetype. test is for tests :) the proper way to do this is to create a multimodule project - one module containing the component and another containing a demo which you can also use for testing. Interesting idea, I'll try that. But I need a page if I want to test a form (and thus testing how my component acts within the form), don't I? WicketTester.newFormTester seems to want to have a page started first. That's why I wanted to have the page in the test directory, because I only need it as a test fixture. Thanks for the reply Carl-Eric - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Expired sign in link after signing out
Hi, This seems like a FAQ but I couldn't find it. All of my pages have a common header with sign in / sign out links. When the user clicks the sign in link, I want to display the sign in page and then return to the previous page after the user signs in. My sign in link looks like this: add(new Link(signin) { @Override public void onClick() { throw new RestartResponseAtInterceptPageException(SignInPage.class); } ... } This works fine unless the user has just signed out, at which point the link leads to an expired page error. My sign out page constructor does the following: getSession().invalidate(); setResponsePage(pageClass); I think I get what's wrong with this, but none of the variations I've tried work. So how can I get the sign in link to work after signing out? Thanks, Tim - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Fw: Problem with Maven archetype, Eclipse Classpath and jetty:run
On Tue, 26 May 2009 08:39:36 -0700 (PDT) Juan Carlos Garcia M. jcgarc...@gmail.com wrote: [MECLIPSE ticket and workaround] Hope this help. Yes it does, thank you. Carl-Eric - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Expired sign in link after signing out
add(new BookmarkablePageLink(signin, SigninPage.class)); Ryan Gravener http://isithotinhereorisitjust.me | http://twitter.com/ryangravener On Tue, May 26, 2009 at 6:32 PM, Tim Moose hungl...@gmail.com wrote: Hi, This seems like a FAQ but I couldn't find it. All of my pages have a common header with sign in / sign out links. When the user clicks the sign in link, I want to display the sign in page and then return to the previous page after the user signs in. My sign in link looks like this: add(new Link(signin) { @Override public void onClick() { throw new RestartResponseAtInterceptPageException(SignInPage.class); } ... } This works fine unless the user has just signed out, at which point the link leads to an expired page error. My sign out page constructor does the following: getSession().invalidate(); setResponsePage(pageClass); I think I get what's wrong with this, but none of the variations I've tried work. So how can I get the sign in link to work after signing out? Thanks, Tim - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Storing css and image files
I too have been trying to find the right way about where to put the resources (image, css, js). I work in an environment where the images/css/js are maintained by a separate team and is in apache server as they are reused across several apps/projects in different app servers. So putting it as part of the application is a no-no (src/main/resources or src/main/webapp etc.) . It doesn't work that way though -- I tried using a ImageButton without passing the new ResourceReference() in the constructor. My html is like: input type=image wicket:id=imageId src=/images/button.gif / Wicket replaces the html with input type=image src=resources/.//images/button.gif / and obviously does not find it. Is there a clean way out of this? (ie not prepend resources/... etc) Thanks! Vasya On Tue, May 26, 2009 at 12:40 PM, Luther Baker lutherba...@gmail.comwrote: I like that idea! On Tue, May 26, 2009 at 10:33 AM, Igor Vaynberg igor.vaynb...@gmail.com wrote: it may be helpful to create wicket:context analog of wicket:link, we already have the framework for getting the path prefix to get to context path. this is of course only useful for application-specific resources as those will not be reused across projects. in our case our SA extracts the war and copies everything but WEB-INF to apache so all those static application resources can be served there. -igor On Tue, May 26, 2009 at 2:41 AM, Martijn Dashorst martijn.dasho...@gmail.com wrote: Why wouldn't it be a viable solution? It gives you the opportunity to let the resources be served by your container, which should be speedier than letting wicket handle it (such requests are filtered through and go to your container). The relative paths are just that: relative, and they always map to the absolute same resource URI. In fact, they are more stable than serving things from your classpath, as those resources are served from the path /context/resources/, and if we decide to call that path /context/foobar/ all your reasoning about stability goes out the window. Martijn On Mon, May 25, 2009 at 6:38 PM, Luther Baker lutherba...@gmail.com wrote: **On Mon, May 25, 2009 at 2:34 AM, Martijn Dashorst martijn.dasho...@gmail.com wrote: or, if these images and css are for your application, and application wide (i.e. all pages include them), you could put them in src/main/webapp/.. and just link src=style.css ... / them in your markup. Martijn I'd like to pose a design/theoratical thought here I understand that wicket:link/ does the right thing for resources (like stylesheets) kept in the classpath. I love this behavior. But, as we know, depending on where my browser URL points, the following: link href=css/styles.css .../ resolves to different locations. For instance, said stylesheet referenced from: http://hostname/context/products/wires/24 physically resolves to (mavenized) webapps/*products/wires*/css/styles.css, whereas from http://hostname/context/people/hr/judy resolves to webapps/*people/hr/judy*/css/styles.css (In part, this is due to our effort NOT to hardcode the context into the link's href.) *Traditionally, I solved this one of three ways:* 1. Manually manage every application URL and every mapped file and make sure that in all cases the relative path is correct. Ugh! For obvious reasons - this technique is not maintainable. Large apps back in the early days of Struts with hundreds of actions and JSPs, this just wasn't fun. 2. JSTL came along and I started to leverage the c:url tag. For the most part, that was a workable solution - the resulting path was 'absolute' but it wasn't hardcoded. Essentially, it gives the framework a chance to work its magic (if it were to change somehow). 3. Today, I use the resource method (wicket:link/) which obviates all anxiety by simply letting the framework just manage it. So to your point Martijn, is using webapp/css and directly including link href=css/styles.css .../ really a good - viable, long-term solution in Wicket apps? Understandably maybe today, the default URL mapper in Wicket uses query strings and not deep or hierarchical urls - but the important term for me here is today. What if, in the future, wicket decides to change the default URL mapping scheme - maybe become more RESTful. The inertia built up around legacy apps using webapp/css may pose a problem. I don't think this is premature functionality ... I think links and urls are a here a now thing and that building and migrating apps to future versions of frameworks is hard and that a loose practice here may come back to bite a developer ... ? Also, I've not yet mounted urls but I assume if I were to mount URLs
Re: MultiFileUploadField: How to filter file types
I already thought about that, but like it implicates to change the original javascript file, i was trying not to do it, but i already changed it a little bit, i guess it would not make worse to change more a little bit. I changed it to short the name of the selected file from the path to just the name of the file. Thanx a lot igor.vaynberg wrote: even max size is checked serverside, you may be able to do the same for file types. alternatively you can hook in with a javascript by adding an onchange event and possibly rejecting a file. -igor On Tue, May 26, 2009 at 3:46 AM, Marco Santos mpssan...@gmail.com wrote: Hello there. Im using the MultiFileUploadField but i would like that the user could just see/choose some type of files. for instance, he could only select jpeg or/and png files. I notice that is possible to specify the max size of a file. Is possible to specify the type files that the user can select? Thanks a lot -- Marco Santos - 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://www.nabble.com/MultiFileUploadField%3A-How-to-filter-file-types-tp23720718p23733477.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
CompoundPropertyModel and Combobox
Hello there. Im trying to submit a form, a simple one, that have some textfields, checkboxes and some comboboxes (DropDownChoice class). The model of the form is the CompoundPropertyModel which is setted like this: setModel(new CompoundPropertyModel(userInput)); The userInput is an instance of a class that have getters and setters which the names are the id's of the fields. When i submit the form, every field is filled with the user input information except the fields to the comboboxes which are empty. The dropdownchoices are instanciated like this: = JAVA CODE = selectedDistrito = new SelectedChoice(); distritos = new DropDownChoice(distritos, new PropertyModel(selectedDistrito, selectedChoice), distritosModel); = THE SELECTED CHOICE CLASS = public class SelectedChoice implements Serializable{ private String selectedChoice = null; /** Creates a new instance of SelectedChoice */ public SelectedChoice() { } public String getSelectedChoice() { return selectedChoice; } public void setSelectedChoice(String selectedChoice) { this.selectedChoice = selectedChoice; } } = END OF JAVA CODE = How can i in the CompoundPropertyModel fill the instance variables concerned to the dropdownchoices? Thank you very much -- Marco Santos
What's the simplest way to do Context-sensitive Authorization in Wicket?
Hi all, I am tech leading our first Wicket project, and I and my co-workers are new to Wicket, but we have been having a good experience in the first few weeks. We have come across an challenge relating to security authorization that I would appreciate some advice regarding. Here are the simple business rules: - Site Users can create Listings - Users can View someone else's Listing - Users can Edit their own listing. So the authorization decision needs to examine some context (ie the Listing), as well as the current user, to determine whether they have an Edit or View role. A look at wicket-auth-roles suggested that it did not cater for context-sensitive roles of this kind? Ie IRoleCheckingStrategy.hasAnyRole(Roles roles) doesn't allow for any context parameters on which the strategy might make the decision. What is the simplest way to address my challenge? -Ben -- *Ben Hutchison Senior Developer * Level 2 476 St Kilda Road Melbourne VIC 3004 T 613 8807 5252 | F 613 8807 5203 | M 0423 879 534 | www.ibsglobalweb.com http://www.ibsglobalweb.com/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: What's the simplest way to do Context-sensitive Authorization in Wicket?
On the book Wicket in Action there is a chapter (12) that cover the Authentication and the Authorization. It will be very useful to you, and is very easy to understand and implement. This book is very good and i advise you to have, so you can consult as you need. Marco Santos Ben Hutchison-2 wrote: Hi all, I am tech leading our first Wicket project, and I and my co-workers are new to Wicket, but we have been having a good experience in the first few weeks. We have come across an challenge relating to security authorization that I would appreciate some advice regarding. Here are the simple business rules: - Site Users can create Listings - Users can View someone else's Listing - Users can Edit their own listing. So the authorization decision needs to examine some context (ie the Listing), as well as the current user, to determine whether they have an Edit or View role. A look at wicket-auth-roles suggested that it did not cater for context-sensitive roles of this kind? Ie IRoleCheckingStrategy.hasAnyRole(Roles roles) doesn't allow for any context parameters on which the strategy might make the decision. What is the simplest way to address my challenge? -Ben -- *Ben Hutchison Senior Developer * Level 2 476 St Kilda Road Melbourne VIC 3004 T 613 8807 5252 | F 613 8807 5203 | M 0423 879 534 | www.ibsglobalweb.com http://www.ibsglobalweb.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://www.nabble.com/What%27s-the-simplest-way-to-do-Context-sensitive-Authorization-in-Wicket--tp23733965p23734099.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's the simplest way to do Context-sensitive Authorization in Wicket?
Marco Santos wrote: On the book Wicket in Action there is a chapter (12) that cover the Authentication and the Authorization. It will be very useful to you, and is very easy to understand and implement. Well no.. actually. As I made clear in my question, I need to do _context-sensitive_ authorization. The example (chapter 11, by the way), is a classic non-contextual authorization example - there are User and Admin roles that are unaffected by context. -Ben -- *Ben Hutchison Senior Developer * Level 2 476 St Kilda Road Melbourne VIC 3004 T 613 8807 5252 | F 613 8807 5203 | M 0423 879 534 | www.ibsglobalweb.com http://www.ibsglobalweb.com/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: What's the simplest way to do Context-sensitive Authorization in Wicket?
class EditListingLink extends LinkListing { protected void isEnabled() { Listing listing=getModelObject(); return MySession.get().getUser().equals(listing.getAuthor()); } } -igor On Tue, May 26, 2009 at 6:12 PM, Ben Hutchison b...@ibsglobalweb.com wrote: Marco Santos wrote: On the book Wicket in Action there is a chapter (12) that cover the Authentication and the Authorization. It will be very useful to you, and is very easy to understand and implement. Well no.. actually. As I made clear in my question, I need to do _context-sensitive_ authorization. The example (chapter 11, by the way), is a classic non-contextual authorization example - there are User and Admin roles that are unaffected by context. -Ben -- *Ben Hutchison Senior Developer * Level 2 476 St Kilda Road Melbourne VIC 3004 T 613 8807 5252 | F 613 8807 5203 | M 0423 879 534 | www.ibsglobalweb.com http://www.ibsglobalweb.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: Storing css and image files
You may have to look at this case by case ... In this example, what are you doing with the input field? Submitting a form? Were that the case, how about using a raw input tag and moving any wicket logic to the submit handler? -Luther On Tue, May 26, 2009 at 6:02 PM, Vasu Srinivasan vasy...@gmail.com wrote: I too have been trying to find the right way about where to put the resources (image, css, js). I work in an environment where the images/css/js are maintained by a separate team and is in apache server as they are reused across several apps/projects in different app servers. So putting it as part of the application is a no-no (src/main/resources or src/main/webapp etc.) . It doesn't work that way though -- I tried using a ImageButton without passing the new ResourceReference() in the constructor. My html is like: input type=image wicket:id=imageId src=/images/button.gif / Wicket replaces the html with input type=image src=resources/.//images/button.gif / and obviously does not find it. Is there a clean way out of this? (ie not prepend resources/... etc) Thanks! Vasya On Tue, May 26, 2009 at 12:40 PM, Luther Baker lutherba...@gmail.com wrote: I like that idea! On Tue, May 26, 2009 at 10:33 AM, Igor Vaynberg igor.vaynb...@gmail.com wrote: it may be helpful to create wicket:context analog of wicket:link, we already have the framework for getting the path prefix to get to context path. this is of course only useful for application-specific resources as those will not be reused across projects. in our case our SA extracts the war and copies everything but WEB-INF to apache so all those static application resources can be served there. -igor On Tue, May 26, 2009 at 2:41 AM, Martijn Dashorst martijn.dasho...@gmail.com wrote: Why wouldn't it be a viable solution? It gives you the opportunity to let the resources be served by your container, which should be speedier than letting wicket handle it (such requests are filtered through and go to your container). The relative paths are just that: relative, and they always map to the absolute same resource URI. In fact, they are more stable than serving things from your classpath, as those resources are served from the path /context/resources/, and if we decide to call that path /context/foobar/ all your reasoning about stability goes out the window. Martijn On Mon, May 25, 2009 at 6:38 PM, Luther Baker lutherba...@gmail.com wrote: **On Mon, May 25, 2009 at 2:34 AM, Martijn Dashorst martijn.dasho...@gmail.com wrote: or, if these images and css are for your application, and application wide (i.e. all pages include them), you could put them in src/main/webapp/.. and just link src=style.css ... / them in your markup. Martijn I'd like to pose a design/theoratical thought here I understand that wicket:link/ does the right thing for resources (like stylesheets) kept in the classpath. I love this behavior. But, as we know, depending on where my browser URL points, the following: link href=css/styles.css .../ resolves to different locations. For instance, said stylesheet referenced from: http://hostname/context/products/wires/24 physically resolves to (mavenized) webapps/*products/wires*/css/styles.css, whereas from http://hostname/context/people/hr/judy resolves to webapps/*people/hr/judy*/css/styles.css (In part, this is due to our effort NOT to hardcode the context into the link's href.) *Traditionally, I solved this one of three ways:* 1. Manually manage every application URL and every mapped file and make sure that in all cases the relative path is correct. Ugh! For obvious reasons - this technique is not maintainable. Large apps back in the early days of Struts with hundreds of actions and JSPs, this just wasn't fun. 2. JSTL came along and I started to leverage the c:url tag. For the most part, that was a workable solution - the resulting path was 'absolute' but it wasn't hardcoded. Essentially, it gives the framework a chance to work its magic (if it were to change somehow). 3. Today, I use the resource method (wicket:link/) which obviates all anxiety by simply letting the framework just manage it. So to your point Martijn, is using webapp/css and directly including link href=css/styles.css .../ really a good - viable, long-term solution in Wicket apps? Understandably maybe today, the default URL mapper in Wicket uses query strings and not deep or hierarchical urls - but the important term for me here is today. What if, in the future, wicket decides to change the default URL
Re: Storing css and image files
@Vasu Try overriding the *src* attribute with a SimpleAttributeModifier :-) You'll need to manage your static paths in Java (Constants.IMG_PATH ... etc) ... but it works as expected: final ImageButton submit = new ImageButton(i-thunder); submit.add(new SimpleAttributeModifier(src, img/thunder_medium.jpg)); *results in* input type=image wicket:id=i-thunder *src=**img/thunder_medium.jpg* name=i-thunder id=i_thunder2f/ *instead of* input type=image wicket:id=i-thunder src=resources/org.effectiveprogramming.effprog.web.markup.page.Contact/img/thunder_medium_en_US.jpg name=i-thunder id=i_thunder31/ -Luther On Tue, May 26, 2009 at 9:13 PM, Luther Baker lutherba...@gmail.com wrote: You may have to look at this case by case ... In this example, what are you doing with the input field? Submitting a form? Were that the case, how about using a raw input tag and moving any wicket logic to the submit handler? -Luther On Tue, May 26, 2009 at 6:02 PM, Vasu Srinivasan vasy...@gmail.comwrote: I too have been trying to find the right way about where to put the resources (image, css, js). I work in an environment where the images/css/js are maintained by a separate team and is in apache server as they are reused across several apps/projects in different app servers. So putting it as part of the application is a no-no (src/main/resources or src/main/webapp etc.) . It doesn't work that way though -- I tried using a ImageButton without passing the new ResourceReference() in the constructor. My html is like: input type=image wicket:id=imageId src=/images/button.gif / Wicket replaces the html with input type=image src=resources/.//images/button.gif / and obviously does not find it. Is there a clean way out of this? (ie not prepend resources/... etc) Thanks! Vasya On Tue, May 26, 2009 at 12:40 PM, Luther Baker lutherba...@gmail.com wrote: I like that idea! On Tue, May 26, 2009 at 10:33 AM, Igor Vaynberg igor.vaynb...@gmail.com wrote: it may be helpful to create wicket:context analog of wicket:link, we already have the framework for getting the path prefix to get to context path. this is of course only useful for application-specific resources as those will not be reused across projects. in our case our SA extracts the war and copies everything but WEB-INF to apache so all those static application resources can be served there. -igor On Tue, May 26, 2009 at 2:41 AM, Martijn Dashorst martijn.dasho...@gmail.com wrote: Why wouldn't it be a viable solution? It gives you the opportunity to let the resources be served by your container, which should be speedier than letting wicket handle it (such requests are filtered through and go to your container). The relative paths are just that: relative, and they always map to the absolute same resource URI. In fact, they are more stable than serving things from your classpath, as those resources are served from the path /context/resources/, and if we decide to call that path /context/foobar/ all your reasoning about stability goes out the window. Martijn On Mon, May 25, 2009 at 6:38 PM, Luther Baker lutherba...@gmail.com wrote: **On Mon, May 25, 2009 at 2:34 AM, Martijn Dashorst martijn.dasho...@gmail.com wrote: or, if these images and css are for your application, and application wide (i.e. all pages include them), you could put them in src/main/webapp/.. and just link src=style.css ... / them in your markup. Martijn I'd like to pose a design/theoratical thought here I understand that wicket:link/ does the right thing for resources (like stylesheets) kept in the classpath. I love this behavior. But, as we know, depending on where my browser URL points, the following: link href=css/styles.css .../ resolves to different locations. For instance, said stylesheet referenced from: http://hostname/context/products/wires/24 physically resolves to (mavenized) webapps/*products/wires*/css/styles.css, whereas from http://hostname/context/people/hr/judy resolves to webapps/*people/hr/judy*/css/styles.css (In part, this is due to our effort NOT to hardcode the context into the link's href.) *Traditionally, I solved this one of three ways:* 1. Manually manage every application URL and every mapped file and make sure that in all cases the relative path is correct. Ugh! For obvious reasons - this technique is not maintainable. Large apps back in the early days of Struts with hundreds of actions and JSPs, this just wasn't fun. 2. JSTL came along and I started to leverage the c:url tag. For the most part, that was a workable solution - the resulting path was
Re: What's the simplest way to do Context-sensitive Authorization in Wicket?
Igor, Your suggestion seems to be based on security through obscurity, ie hiding the Edit link rather than securing the Edit page? Thus, if an unauthorized user knows or discovers the URL of the edit page (eg from browser history), what stops them from editing another user's listing? -Ben Igor Vaynberg wrote: class EditListingLink extends LinkListing { protected void isEnabled() { Listing listing=getModelObject(); return MySession.get().getUser().equals(listing.getAuthor()); } } -igor On Tue, May 26, 2009 at 6:12 PM, Ben Hutchison b...@ibsglobalweb.com wrote: Marco Santos wrote: On the book Wicket in Action there is a chapter (12) that cover the Authentication and the Authorization. It will be very useful to you, and is very easy to understand and implement. Well no.. actually. As I made clear in my question, I need to do _context-sensitive_ authorization. The example (chapter 11, by the way), is a classic non-contextual authorization example - there are User and Admin roles that are unaffected by context. -Ben -- *Ben Hutchison Senior Developer * Level 2 476 St Kilda Road Melbourne VIC 3004 T 613 8807 5252 | F 613 8807 5203 | M 0423 879 534 | www.ibsglobalweb.com http://www.ibsglobalweb.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 -- *Ben Hutchison Senior Developer * Level 2 476 St Kilda Road Melbourne VIC 3004 T 613 8807 5252 | F 613 8807 5203 | M 0423 879 534 | www.ibsglobalweb.com http://www.ibsglobalweb.com/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: What's the simplest way to do Context-sensitive Authorization in Wicket?
if the edit page is not bookmarkable - and edit pages are not unless you make them so for whatever reason - then there is no way for the user to build the url unless wicket builds it. so this is hardly security by obscurity. security pages is trivial class mystrategy implements iauthorizationstrategy { public boolean isActionAuthorized(Component c, Action action) { if (action==Component.RENDER) { if (c instanceof editpage) { return (((editpage)c).getlisting().getauthor().equals(mysession.get().getuser()); } } return true; } } you can see how it would be easy to extend this to a generic IListingPage { Listing getListing(); } -igor On Tue, May 26, 2009 at 8:43 PM, Ben Hutchison b...@ibsglobalweb.com wrote: Igor, Your suggestion seems to be based on security through obscurity, ie hiding the Edit link rather than securing the Edit page? Thus, if an unauthorized user knows or discovers the URL of the edit page (eg from browser history), what stops them from editing another user's listing? -Ben Igor Vaynberg wrote: class EditListingLink extends LinkListing { protected void isEnabled() { Listing listing=getModelObject(); return MySession.get().getUser().equals(listing.getAuthor()); } } -igor On Tue, May 26, 2009 at 6:12 PM, Ben Hutchison b...@ibsglobalweb.com wrote: Marco Santos wrote: On the book Wicket in Action there is a chapter (12) that cover the Authentication and the Authorization. It will be very useful to you, and is very easy to understand and implement. Well no.. actually. As I made clear in my question, I need to do _context-sensitive_ authorization. The example (chapter 11, by the way), is a classic non-contextual authorization example - there are User and Admin roles that are unaffected by context. -Ben -- *Ben Hutchison Senior Developer * Level 2 476 St Kilda Road Melbourne VIC 3004 T 613 8807 5252 | F 613 8807 5203 | M 0423 879 534 | www.ibsglobalweb.com http://www.ibsglobalweb.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 -- *Ben Hutchison Senior Developer * Level 2 476 St Kilda Road Melbourne VIC 3004 T 613 8807 5252 | F 613 8807 5203 | M 0423 879 534 | www.ibsglobalweb.com http://www.ibsglobalweb.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: Storing css and image files
@Luther: Yes - I'm using the ImageButton it to submit a form. Thanks for the suggestion to use the modifier. I will try that. On a side note, I thought that having the images/css/js etc served from webserver is pretty common and would be supported by wicket without having to add the names within java code. I understand the reasoning behind using new ResourceReference as it makes loading locale specific images very simple. But why should wicket prepend classpath etc. -- i'm not clear on that. Can't wicket simply ignore the src attribute if ResourceReference is not present and use whatever was already in the html template? That way I do not have to specify the image name within the java code and the separation between java and html is clean. On 5/26/09, Luther Baker lutherba...@gmail.com wrote: @Vasu Try overriding the *src* attribute with a SimpleAttributeModifier :-) You'll need to manage your static paths in Java (Constants.IMG_PATH ... etc) ... but it works as expected: final ImageButton submit = new ImageButton(i-thunder); submit.add(new SimpleAttributeModifier(src, img/thunder_medium.jpg)); *results in* input type=image wicket:id=i-thunder *src=**img/thunder_medium.jpg* name=i-thunder id=i_thunder2f/ *instead of* input type=image wicket:id=i-thunder src=resources/org.effectiveprogramming.effprog.web.markup.page.Contact/img/thunder_medium_en_US.jpg name=i-thunder id=i_thunder31/ -Luther On Tue, May 26, 2009 at 9:13 PM, Luther Baker lutherba...@gmail.com wrote: You may have to look at this case by case ... In this example, what are you doing with the input field? Submitting a form? Were that the case, how about using a raw input tag and moving any wicket logic to the submit handler? -Luther On Tue, May 26, 2009 at 6:02 PM, Vasu Srinivasan vasy...@gmail.com wrote: I too have been trying to find the right way about where to put the resources (image, css, js). I work in an environment where the images/css/js are maintained by a separate team and is in apache server as they are reused across several apps/projects in different app servers. So putting it as part of the application is a no-no (src/main/resources or src/main/webapp etc.) . It doesn't work that way though -- I tried using a ImageButton without passing the new ResourceReference() in the constructor. My html is like: input type=image wicket:id=imageId src=/images/button.gif / Wicket replaces the html with input type=image src=resources/.//images/button.gif / and obviously does not find it. Is there a clean way out of this? (ie not prepend resources/... etc) Thanks! Vasya On Tue, May 26, 2009 at 12:40 PM, Luther Baker lutherba...@gmail.com wrote: I like that idea! On Tue, May 26, 2009 at 10:33 AM, Igor Vaynberg igor.vaynb...@gmail.com wrote: it may be helpful to create wicket:context analog of wicket:link, we already have the framework for getting the path prefix to get to context path. this is of course only useful for application-specific resources as those will not be reused across projects. in our case our SA extracts the war and copies everything but WEB-INF to apache so all those static application resources can be served there. -igor On Tue, May 26, 2009 at 2:41 AM, Martijn Dashorst martijn.dasho...@gmail.com wrote: Why wouldn't it be a viable solution? It gives you the opportunity to let the resources be served by your container, which should be speedier than letting wicket handle it (such requests are filtered through and go to your container). The relative paths are just that: relative, and they always map to the absolute same resource URI. In fact, they are more stable than serving things from your classpath, as those resources are served from the path /context/resources/, and if we decide to call that path /context/foobar/ all your reasoning about stability goes out the window. Martijn On Mon, May 25, 2009 at 6:38 PM, Luther Baker lutherba...@gmail.com wrote: **On Mon, May 25, 2009 at 2:34 AM, Martijn Dashorst martijn.dasho...@gmail.com wrote: or, if these images and css are for your application, and application wide (i.e. all pages include them), you could put them in src/main/webapp/.. and just link src=style.css ... / them in your markup. Martijn I'd like to pose a design/theoratical thought here I understand that wicket:link/ does the right thing for resources (like stylesheets) kept in the classpath. I love this behavior. But, as we know, depending on where my browser URL points, the following: link href=css/styles.css .../ resolves to different locations. For instance, said
Re: What's the simplest way to do Context-sensitive Authorization in Wicket?
I have built an auth strategy similar to the one below, but more generic that could be applied through my whole application. i.e.: I have an interface IUserOwnedEntity I have an interface IEntity Then, it is basically as follows (mine is actually much more complex and dynamic than yours, but this is the basic idea that you could apply to yours and build with your domain): class mystrategy implements iauthorizationstrategy { public boolean isActionAuthorized(Component c, Action action) { if (action==Component.RENDER) { IModel mod = c.getDefaultModel(); if (mod.getObject() instanceof IUserOwnedEntity) { User user = Session.getUser(); // or similar - not exactly right return user.owns((IUserOwnedEntity) c.getObject()) || user.isAdmin(); } } return true; } } -- Jeremy Thomerson http://www.wickettraining.com On Tue, May 26, 2009 at 10:55 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: if the edit page is not bookmarkable - and edit pages are not unless you make them so for whatever reason - then there is no way for the user to build the url unless wicket builds it. so this is hardly security by obscurity. security pages is trivial class mystrategy implements iauthorizationstrategy { public boolean isActionAuthorized(Component c, Action action) { if (action==Component.RENDER) { if (c instanceof editpage) { return (((editpage)c).getlisting().getauthor().equals(mysession.get().getuser()); } } return true; } } you can see how it would be easy to extend this to a generic IListingPage { Listing getListing(); } -igor On Tue, May 26, 2009 at 8:43 PM, Ben Hutchison b...@ibsglobalweb.com wrote: Igor, Your suggestion seems to be based on security through obscurity, ie hiding the Edit link rather than securing the Edit page? Thus, if an unauthorized user knows or discovers the URL of the edit page (eg from browser history), what stops them from editing another user's listing? -Ben Igor Vaynberg wrote: class EditListingLink extends LinkListing { protected void isEnabled() { Listing listing=getModelObject(); return MySession.get().getUser().equals(listing.getAuthor()); } } -igor On Tue, May 26, 2009 at 6:12 PM, Ben Hutchison b...@ibsglobalweb.com wrote: Marco Santos wrote: On the book Wicket in Action there is a chapter (12) that cover the Authentication and the Authorization. It will be very useful to you, and is very easy to understand and implement. Well no.. actually. As I made clear in my question, I need to do _context-sensitive_ authorization. The example (chapter 11, by the way), is a classic non-contextual authorization example - there are User and Admin roles that are unaffected by context. -Ben -- *Ben Hutchison Senior Developer * Level 2 476 St Kilda Road Melbourne VIC 3004 T 613 8807 5252 | F 613 8807 5203 | M 0423 879 534 | www.ibsglobalweb.com http://www.ibsglobalweb.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 -- *Ben Hutchison Senior Developer * Level 2 476 St Kilda Road Melbourne VIC 3004 T 613 8807 5252 | F 613 8807 5203 | M 0423 879 534 | www.ibsglobalweb.com http://www.ibsglobalweb.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
RE: how to control/locate which html to load
Thanks Igor! But in my case, this is not about changing the css properties only. I need few html changes as well. For example, in higher resolution screen form input fields needs to be displayed besides label to make it look professional. Is there any other way (or hack!) to determine markup file location at runtime (on every request - so that I can load/locate html based on device category)! Warm Regards, Anirban Basak Ph : 91 33 2357 7177 Extn: 277 -Original Message- From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Sent: Tuesday, May 26, 2009 11:06 PM To: users@wicket.apache.org Subject: Re: how to control/locate which html to load you should use session.setstyle() and have a seperate style per screen resolution variant -igor 2009/5/26 Anirban Basak anirban.ba...@rebaca.com: Hi! Im writing a mobile web interface using wicket. Since there are mobile devices with various screen resolutions, I need to maintain separate set of htmls (per component class) based on category/resolution. Im able to define custom place for htmls (thanks to http://cwiki.apache.org/WICKET/control-where-html-files-are-loaded-from.html ), but having problem with locating correct file at runtime. Wicket is invoking locate(Class clazz, String path) of my custom ResourceStreamLocator for the 1st time only. Then, I assume, its remembering the file path or stream and always showing htmls for the 1st requesting device category! Is there any way (a hack may be!) to instruct/force wicket to invoke locate( ) everytime a request comes? Below a snippet of my current implementation: public class MyWebApplication extends WebApplication { protected void init() { IResourceSettings resourceSettings = getResourceSettings(); resourceSettings.setResourceStreamLocator(new MyResourceLocator()); } } public class MyResourceLocator extends ResourceStreamLocator { public IResourceStream locate(final Class clazz, final String path) { MySession session = MySession.get(); IResourceStream located = locateByClassLoader(clazz, getHtmlPath(path, session.getDevice())); return located; } private String getHtmlPath(String path, PlainDevice d) { if (category-1) { return category-1-folder-path + path.substring(path.lastIndexOf(/) + 1); } else { return category-2-folder-path + path.substring(path.lastIndexOf(/) + 1); } } protected IResourceStream locateByClassLoader(final Class clazz, final String path) { ClassLoader classLoader = null; if (classLoader == null) { // use context classloader when no specific classloader is set // (package resources for instance) classLoader = Thread.currentThread().getContextClassLoader(); } if (clazz != null) { classLoader = clazz.getClassLoader(); } if (classLoader == null) { // use Wicket classloader when no specific classloader is set classLoader = getClass().getClassLoader(); } logger.debug(path : + path); // Try loading path using classloader final URL url = classLoader.getResource(path); if (url != null) { return new UrlResourceStream(url); } return null; } } /Anirban - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.339 / Virus Database: 270.12.41/2136 - Release Date: 05/26/09 20:20:00 No virus found in this outgoing message. Checked by AVG - www.avg.com Version: 8.5.339 / Virus Database: 270.12.41/2136 - Release Date: 05/26/09 20:20:00 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: What's the simplest way to do Context-sensitive Authorization in Wicket?
On Tue, May 26, 2009 at 9:57 PM, Jeremy Thomerson jer...@wickettraining.com wrote: (mine is actually much more complex and dynamic than yours, but this is the basic idea that you could apply to yours and build with your domain) i hope so - seeing how mine was written in about ten seconds :) -igor - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Storing css and image files
On Tue, May 26, 2009 at 11:43 PM, Vasu Srinivasan vasy...@gmail.com wrote: @Luther: Yes - I'm using the ImageButton it to submit a form. Thanks for the suggestion to use the modifier. I will try that. Great. I think it should work for you. On a side note, I thought that having the images/css/js etc served from webserver is pretty common and would be supported by wicket without having to add the names within java code. If I had to guess ... it is probably just a matter of time. There are probably a lot of design and Wicket Way considerations the team iterates through and prioritizes. I think cases like yours bring some of these usage points into clearer focus after-which, maybe they'll get some traction. My guess is that these folks are pretty busy and that there are probably 10s of 100s of similar requests in the queue - so just need some time ... or bodies :) I understand the reasoning behind using new ResourceReference as it makes loading locale specific images very simple. But why should wicket prepend classpath etc. -- i'm not clear on that. Can't wicket simply ignore the src attribute if ResourceReference is not present and use whatever was already in the html template? That way I do not have to specify the image name within the java code and the separation between java and html is clean. It sounds reasonable to me - but I'm not knee deep in the code either/yet. -Luther