Security handled at the proxy level
Hi, I have developed an application with Wicket that has its own built-in security and now a user needs to use it in a way that security is managed by a proxy instead. The way they can impose security is by url, and in theory I could get away by using only bookmarkable pages that contain a certain package name. The issue is, when the page contents change (validation, showing/hiding panels, ...) the url changes and becomes something generic like: http://host/app/?wicket:interface=:3:1::: Is there any way to force it to encode the url so that it looks at least like: http://host/app/secured?wicket:interface:3:1::: when the page is recognized as a secure one? (in my case those pages extend a certain base class that provides security control... when that is enabled, that is, otherwise it does nothing). Cheers Andrea - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket based open source projects
Gatos ha scritto: Hello, Is there any wicket based Open Source projects? See GeoServer 2.0 at http://geoserver.org Cheers Andrea -- Andrea Aime OpenGeo - http://opengeo.org Expert service straight from the developers. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Using XHTML validator in unit tests
Andrea Aime ha scritto: Hi, I've been using the wicketstuff XHTML validator to clean up all our app pages from validty issues. Great stuff, easy to use, good reporting. Now, I would feel more comfortable to have the XHTML validation embedded in unit tests as well, so that if a validation error pops in the tests will simply start to fail. However, it seems the filters are not executed in wicket tester. I looked a bit into the sources and it seems to be possible to rewrite the main class to turn it into a validation utility, but I'm not very comfortable doing that given it's Apache license and our source code base is GPL instead (would like to avoid mixing the Apache license in the sources, that is). Hmm... was wrong here, the validator is GPL'd. Still, would be nice to avoid code duplication, so still looking for nicer solutions Cheers Andrea - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Using XHTML validator in unit tests
Hi, I've been using the wicketstuff XHTML validator to clean up all our app pages from validty issues. Great stuff, easy to use, good reporting. Now, I would feel more comfortable to have the XHTML validation embedded in unit tests as well, so that if a validation error pops in the tests will simply start to fail. However, it seems the filters are not executed in wicket tester. I looked a bit into the sources and it seems to be possible to rewrite the main class to turn it into a validation utility, but I'm not very comfortable doing that given it's Apache license and our source code base is GPL instead (would like to avoid mixing the Apache license in the sources, that is). Is there a better way? Cheers Andrea - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Ajax-y interactions inside a form
Linda van der Pal ha scritto: Well I'm not too familiar with this area of Wicket, but there's also AjaxLink "which is similar to Link, but sends a request using Ajax"*. Which means it doesn't submit like AjaxSubmitLink does. That's why I'm using an AjaxSubmitLink in my example (attached to the first mail). Still, I'm looking for a less clunky (and more general) solution, having to disable form processing in the link and then do manually some parts of the processing seems quite involved (and each time I have to guess what's the right incantation, so at least having a set of steps, even if long would be an improvement). *quote from Wicket in Action (Which I heartily recommend if you haven't read it yet.) Yep, read it. Cheers Andrea - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Ajax-y interactions inside a form
Linda van der Pal ha scritto: Have you tried adding an AjaxFormComponentUpdatingBehavior? Something like this: dropdown.add(new AjaxFormComponentUpdatingBehavior("onchange") { private static final long serialVersionUID = 1L; @Override protected void onUpdate(final AjaxRequestTarget target) { target.addComponent(textfield); } }); I did not actually, I also need to ask the user if he really wants to overwrite the contents of the textarea before going, something which I attached to the link. My problem is also more general, I have plenty of forms in which I'd like a more desktop-ish behaviour and this general problem tends to pop up in many variations depending on the form, so I'm looking either for a better understanding or for a more elegant solution (e.g. in other forms I have lists to be filled with whatever the user types in a text field, or palette components to be modified based on the contents of another component in the form, and so on). Cheers Andrea -- Andrea Aime OpenGeo - http://opengeo.org Expert service straight from the developers. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: TextField and setConvertInputToNull
Andrea Aime ha scritto: ... Also, the setConvertEmptyInputStringToNull does not mention the interaction between that and the converters, so arguably there should be none (or I'm just missing the documentation bits on this topic) Should I open a issue on Jira and attach a reproducable test case? Cheers Andrea - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
TextField and setConvertInputToNull
Hi, I'm having troubles with null conversion in an application where we have setup some custom converter locators. If I understand it properly, a TextField setup like this: TextField tf = new TextField("id", ...); tf.setType(String.class); tf.setConvertEmptyInputStringToNull(true); that is, without setting an explicit converter, should always turn the emtpy string to a null, right? Unfortunately it does not if you have a custom converter locator that does not let the default CharacterConverter have its way. However more tests seem to suggest even when one does not setup a custom converter locator, the default behavior works by accident: even in the case you don't have a custom converter locator, the following, in which the conversion to null is disabled, should break: TextField tf = new TextField("id", ...); tf.setType(String.class); tf.setConvertEmptyInputStringToNull(false); because the default converter is used and that turns an empty string into nulls even if the setup asks for the opposite (see CharacterConverter). Imho it would be better if AbstractTextComponent would override the convertInput method and honored the convertEmptyInputStringToNull property before trying to use converters. Am I missing something? Also, the setConvertEmptyInputStringToNull does not mention the interaction between that and the converters, so arguably there should be none (or I'm just missing the documentation bits on this topic) Cheers Andrea - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Getting form component raw value on ajax action
Andrea Aime ha scritto: Hi, I have a form in which one of the fields represents a server side path. The field has a validator to make sure the path is valid and contains certain kind of files inside of it. I also have a link on the side of it that opens in a modal window a server side file system browser to be used as a directory chooser. The issue is, I would like to know what the user typed in the field, use it in the chooser, and when I'm done with the chooser, update the value in the field accordingly. I've tried out three solutions, none of them seems to work: - plain ajaxsubmitlink: validation triggers and onSubmit does not get called all the time. Not good - ajajxsubmitlink + disable default form processing + grab the field input value -> the chooser starts with whatever the user typed in, but when the chooser closes it would seem the field is not updated even if it's part of the ajax request target and its model has been updated Answering myself, the second option works provided that the code calls field.clearInput() (besides setting the new model value). Cheers Andrea - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Getting form component raw value on ajax action
Hi, I have a form in which one of the fields represents a server side path. The field has a validator to make sure the path is valid and contains certain kind of files inside of it. I also have a link on the side of it that opens in a modal window a server side file system browser to be used as a directory chooser. The issue is, I would like to know what the user typed in the field, use it in the chooser, and when I'm done with the chooser, update the value in the field accordingly. I've tried out three solutions, none of them seems to work: - plain ajaxsubmitlink: validation triggers and onSubmit does not get called all the time. Not good - ajajxsubmitlink + disable default form processing + grab the field input value -> the chooser starts with whatever the user typed in, but when the chooser closes it would seem the field is not updated even if it's part of the ajax request target and its model has been updated - ajaxlink: the opposite, that is the form field value cannot be read (it's not posted back to the server) but when the chooser closes the field value is updated with whatever the user chose (the code that does the field update is exactly the same) Sigh... any way to have this thing work both ways? I can provide sample code, but first I'd like to check if there is any general reason why this would not work. Cheers Andrea - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: 60% waste
Martin Makundi ha scritto: I don't know if this is of any help, but I've written the attached utility class that, given a component, can print its containment structure, along with the eventual component classes and model values (toString-ed). Well... printDoc and wicket getDebugSettings().setOutputComponentPath(true); does pretty much the same thing. Interesting. I googled for "printDoc Wicket" but did not find anything. Where is that utility? Cheers Andrea - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: 60% waste
Martin Makundi ha scritto: Hi! I use TDD: I spend 60% of my time type-checking and path-checking my wicketTests and components. I always have the wrong path and I must prinDocument and iterate to get it right I don't know if this is of any help, but I've written the attached utility class that, given a component, can print its containment structure, along with the eventual component classes and model values (toString-ed). I find it useful to quickly visualize the current component hierarchy while writing tests and debugging. Hope this helps Cheers Andrea import java.io.PrintStream; import java.util.Arrays; import java.util.Iterator; import java.util.regex.Pattern; import org.apache.wicket.Component; import org.apache.wicket.MarkupContainer; import org.apache.wicket.Page; /** * Dumps a wicket component/page hierarchy to text, eventually writing down the class and the model * value as a string. * * Each line in the dump follow the componentId(class) 'value' format. * * * The class can be reused for multiple prints, but it's not thread safe * */ public class WicketHierarchyPrinter { static final Pattern NEWLINE = Pattern.compile("\\n", Pattern.MULTILINE); PrintStream out; boolean valueDumpEnabled; boolean classDumpEnabled; /** * Utility method to dump a single component/page to standard output * @param c * @param dumpClass * @param dumpValue */ public static void print(Component c, boolean dumpClass, boolean dumpValue) { WicketHierarchyPrinter printer = new WicketHierarchyPrinter(); printer.setClassDumpEnabled(dumpClass); printer.setValueDumpEnabled(dumpValue); if(c instanceof Page) { printer.print((Page) c); } else { printer.print(c); } } /** * Creates a printer that will dump to standard output */ public WicketHierarchyPrinter() { out = System.out; } /** * Creates a printer that will dump to the specified print stream */ public WicketHierarchyPrinter(PrintStream out) { this.out = out; } /** * Set to true if you want to see the model values in the dump * * @param valueDumpEnabled */ public void setValueDumpEnabled(boolean valueDumpEnabled) { this.valueDumpEnabled = valueDumpEnabled; } /** * Set to true if you want to see the component classes in the dump * * @param classDumpEnabled */ public void setClassDumpEnabled(boolean classDumpEnabled) { this.classDumpEnabled = classDumpEnabled; } /** * Prints the component containment hierarchy * * @param c */ public void print(Component c) { walkHierarchy(c, 0); } /** * Walks down the containment hierarchy depth first and prints each component found */ private void walkHierarchy(Component c, int level) { printComponent(c, level); if (c instanceof MarkupContainer) { MarkupContainer mc = (MarkupContainer) c; for (Iterator it = mc.iterator(); it.hasNext();) { walkHierarchy((Component) it.next(), level + 1); } } } /** * Prints a single component */ private void printComponent(Component c, int level) { if(c instanceof Page) out.print(tab(level) + "PAGE_ROOT"); else out.print(tab(level) + c.getId()); if (classDumpEnabled) { String className; if(c.getClass().isAnonymousClass()) { className = c.getClass().getSuperclass().getName(); } else { className = c.getClass().getName(); } out.print("(" + className + ")"); } if (valueDumpEnabled) { try { String value = NEWLINE.matcher(c.getModelObjectAsString()).replaceAll("n"); out.print(" '" + value + "'"); } catch(Exception e) { out.print(" 'ERROR_RETRIEVING_MODEL " + e.getMessage() + "'"); } } out.println(); } /** * Generates three spaces per level */ String tab(int level) { char[] spaces = new char[level * 3]; Arrays.fill(spaces, ' '); return new String(spaces); } } - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
wicket:path and Ajax
Hi, I've set my Wicket application to generate wicket:path attributes. Yet, it seems what whatever new element added following an ajax link does not have the wicket:path attribute set. I'm seeing this in ajax tabbed panels and in other ajaxy behavious, like adding a row in a ListView by following an Ajax button. Any known workaround? Cheers Andrea -- Andrea Aime OpenGeo - http://opengeo.org Expert service straight from the developers. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Bingind a bean that has getters, but no setters
Johan Compagner ha scritto: hmm normally i think we try to create the object by calling the default constructor And i see it does have a default constructor But is that Envelope object really your model object? Well, it's actually a property of a larger object, which I provide to my panel using another PropertyModel Do you have a simple test case that i can add to the PropertyResolverTest ? Not at the moment, I'm facing a number of errors that I cannot sort out and which are probably related to my improper usage of Wicket. I'll try to figure out what's going on and will let you know Cheers Andrea -- Andrea Aime OpenGeo - http://opengeo.org Expert service straight from the developers. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Bingind a bean that has getters, but no setters
nino martinez wael ha scritto: Hi Andrea Did you use the openlayers integration project? just curious... Nope, so far I did not. GeoServer has its own way to generate a OL client preview page which uses FreeMarker templates. Cheers Andrea -- Andrea Aime OpenGeo - http://opengeo.org Expert service straight from the developers. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Bingind a bean that has getters, but no setters
James Carman ha scritto: Or, you could provide a "wrapper" A wrapper... how? In particular, how is the wrapper notified that it's time to set all the properties back in the envelope? (sorry, model rookie here). Btw, Johan suggestion works, but bombs out in the case the envelope is null which is another case I have to handle, if the user did not enter any values in the text fields, it should stay null. How is this handled? Cheers Andrea -- Andrea Aime OpenGeo - http://opengeo.org Expert service straight from the developers. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Bingind a bean that has getters, but no setters
Hi, I'm trying to make a component that edits the corners of a rectangle. The model of this component should be a JTS Envelope class: http://www.jump-project.org/docs/jts/1.7/api/com/vividsolutions/jts/geom/Envelope.html?is-external=true This class has getters for minX,minY,maxX,maxY, but has no setters for them, you're supposed to call init(x1,x2,y1,y2) instead. Has anyone an idea of how to bind four text fields so that the model of my Panel is the JTS Envelope, the fields use the Envelope corners, but the update takes place as a single shot instead of a field by field basis (that I cannot do given the lack of setters?) Cheers Andrea - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org