[CONF] Apache Wicket: Wicket 1.5 Wish List (page edited)
Page Edited : WICKET : Wicket 1.5 Wish List Wicket 1.5 Wish List has been edited by Stefan Fussenegger (Dec 01, 2008). Change summary: added JIRA link to "Rewrite repeaters to make it easier to work with" (View changes) Content: create abstraction for content types currently, wicket has a concept of "markup type" that is actually the markup extension. in doing work on wml support for "mobile wicket", i'm discovering a need for full mime type support. if it doesn't break too many people, it would ideally be best to introduce a formal MarkupType class with a getExtension() and getContentType(), where ContentType includes mime type information. there quite a bit to think through here in terms of request/response markup type mappings, but i'd be up for working on this. this problem is definitely generic to problems outside mobile wicket. – jonathan multiply child/extend inheritance https://issues.apache.org/jira/browse/WICKET-1134 improve ajax support of _javascript_ i still think we should be doing something more object oriented in terms of composing _javascript_ for ajax purposes. i'd like to see us adopt something like that _javascript_ class i was promoting a while back. one thing that occurs to me today is that not only could you easily compose _javascript_ this way, but there might be a whole host of reusable _javascript_ behaviors we could all leverage. for example, instead of having bits of _javascript_ code hacked into strings all over projects to accomplish deletion confirmation on link/button clicks, we could have ConfirmJavaScript extends _javascript_ and take care of the gory details in there (string resources for localization, whatever). as hunks of _javascript_ get more complex and prevalent, creating this abstraction could really serve us nicely as a community. i personally would have loved to reuse things like FadeComponentJavaScript or DisableComponentJavaScript. the subclasses will all take a lot of work to create, but let's make an abstraction for JS code so we can do this work at all. – jonathan A few advantages to making our _javascript_ more OO: conform to Yahoo recommendations on page rendering performance by putting _javascript_ just before more component oriented development through object literals (JSON) separate _javascript_ from markup ListView users = new ListView("users", usersModel); users.setOutputMarkupId(true); Event e = new ClickEvent("a[class=deleteLink]"); // DomQuery-esque selector (http://extjs.com/learn/Tutorial:DomQuery_v1.1_Basics)... selector could be turned into a Builder object instead of string e.addHandler(new ConfirmDialog("Are you sure you want to delete?")); users.addEvent(e); // can be shortened to new ClickEvent("...", new ConfirmDialog("...")) serializes to: { element: "{usersMarkupId}:", // generated by Component events: [ { event: "click", [ // generated by ClickEvent { selector: "a[class=deleteLink]", handlers: [ function() { // generated by ConfirmDialog if(confirm("Are you sure you want to delete?") { // Wicket.ajax... } } ] } ] } ] } Wrap the above in an 'ondomready' event and we have unobtrusive _javascript_ that should be easier to abstract going forward. – brian New Inspectors Add inspector to look for empty src="" attrs which cause extra requests to the server Remove Change and possibly VersionManager no longer needed since we serialize the entire page. Downside - makes HttpSessionStore not as space efficient (possibly move these implementation details down into the session store package? - jonathan) (this is already pushed to the store package i guess, version manager and pagemap are created by the httpsession store already, the problem with removing this is that it will break all stuff that cant depend on the file based store are really need to be in mem, the disk based store already doesn't do anything with Change and also the version manager, it only uses the version number from the vm, johan) Cleanup component visibility Currently we have Component.set/isVisible, Component.isRenderAllowed, Component.set/isVisibilityAllowed The reason for Component.set/isVisible is simply - allow users to control visibility of their component The reason for Component.isRenderAllowed is for security strategy to be able to force component to be invisible Now if i am a user and want to test if the component will be rendered or not I need to do boolean visible=component.isVisible()&&component.isRenderAllowed() This is ugly as I have to remember both checks all the time. Because of this I have introduced Component.determineVisibility() in 1.3.3 which encapsulates all necessary checks. Now, what i
[jira] Commented: (WICKET-1689) style resources not looked up correctly in markup inheritance
[ https://issues.apache.org/jira/browse/WICKET-1689?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12652190#action_12652190 ] Jeremy Thomerson commented on WICKET-1689: -- this was fixed in 1.3.4 and 1.4 - see https://issues.apache.org/jira/browse/WICKET-1507 > style resources not looked up correctly in markup inheritance > - > > Key: WICKET-1689 > URL: https://issues.apache.org/jira/browse/WICKET-1689 > Project: Wicket > Issue Type: Bug > Components: wicket >Affects Versions: 1.3.3 >Reporter: Michael Grinner > Attachments: styletest.zip > > > example: > ContactPage extends TemplatePage > TemplatePage_style.html > TemplatePage.html > ContactPage.html > works for no style, so TemplatePage.html and ContactPage.html are used. > if style is set to 'style' in the session, TemplagePage_style.html is not > looked up - components on ContactPage are looked up correctly. > It does work ok if there is a ContacPage_style.html as well, then > TemplatePage_style.html is looked up and used! this though is neither > expected behaviour nor practical. > probably loadMarkupAndWatchForChanges sees identical ResourceStreams and does > not resolve the containing markup > properties, xmls etc. are looked up for all components and style independant > whether higher hierarchy components properties are styled or not -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (WICKET-1933) Issue appears to not be fixed
[ https://issues.apache.org/jira/browse/WICKET-1933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12652152#action_12652152 ] Steve Lowery commented on WICKET-1933: -- Has anyone been able to replicate this issue on your end? We find ourselves having to "hack" the 1.4rc1 build to get this to work. > Issue appears to not be fixed > - > > Key: WICKET-1933 > URL: https://issues.apache.org/jira/browse/WICKET-1933 > Project: Wicket > Issue Type: Sub-task > Components: wicket-extensions >Affects Versions: 1.4-M3 >Reporter: Steve Lowery >Assignee: Matej Knopp > > The fix describes changing the iframe src attribute to '://0'. The code was > changed to '//:'. This does not fix the issue in IE6, at least for us. In > version 1.4M3, it is now line 1124 in modal.js. I changed it to ://0 and the > issue went away. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Closed: (WICKET-1965) Remove final from MarkupCache#clear()
[ https://issues.apache.org/jira/browse/WICKET-1965?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jan Kriesten closed WICKET-1965. Resolution: Invalid > Remove final from MarkupCache#clear() > - > > Key: WICKET-1965 > URL: https://issues.apache.org/jira/browse/WICKET-1965 > Project: Wicket > Issue Type: Improvement > Components: wicket >Affects Versions: 1.4-RC1 >Reporter: Jan Kriesten >Priority: Minor > Fix For: 1.3.6 > > > When extending MarkupCache to hook inother MarkupLoader for certain > components, I'd like to be able to delegate a call to clearing the cache to > this other markup loader. > To be able to do so, I need to have the final removed from MarkupCache. > Use case: http://www.footprint.de/fcc/2008/11/some-wicket-scala/ (To delegate > the clear to FreeMarker/Velocity e.g.) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (WICKET-1965) Remove final from MarkupCache#clear()
[ https://issues.apache.org/jira/browse/WICKET-1965?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12652146#action_12652146 ] Jan Kriesten commented on WICKET-1965: -- Timo, ouch - you're right! I think I was just blind on that eye. :-) Best regards, --- Jan. > Remove final from MarkupCache#clear() > - > > Key: WICKET-1965 > URL: https://issues.apache.org/jira/browse/WICKET-1965 > Project: Wicket > Issue Type: Improvement > Components: wicket >Affects Versions: 1.4-RC1 >Reporter: Jan Kriesten >Priority: Minor > Fix For: 1.3.6 > > > When extending MarkupCache to hook inother MarkupLoader for certain > components, I'd like to be able to delegate a call to clearing the cache to > this other markup loader. > To be able to do so, I need to have the final removed from MarkupCache. > Use case: http://www.footprint.de/fcc/2008/11/some-wicket-scala/ (To delegate > the clear to FreeMarker/Velocity e.g.) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (WICKET-1965) Remove final from MarkupCache#clear()
[ https://issues.apache.org/jira/browse/WICKET-1965?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12652134#action_12652134 ] Timo Rantalaiho commented on WICKET-1965: - Are you sure that it's best to reuse MarkupCache by extending it rather than delegating to it? I mean that you could have public class FooMarkupCache implements IMarkupCache { private MarkupCache delegateCache = new MarkupCache(... ... Thanks for the interesting-looking blog post too! > Remove final from MarkupCache#clear() > - > > Key: WICKET-1965 > URL: https://issues.apache.org/jira/browse/WICKET-1965 > Project: Wicket > Issue Type: Improvement > Components: wicket >Affects Versions: 1.4-RC1 >Reporter: Jan Kriesten >Priority: Minor > Fix For: 1.3.6 > > > When extending MarkupCache to hook inother MarkupLoader for certain > components, I'd like to be able to delegate a call to clearing the cache to > this other markup loader. > To be able to do so, I need to have the final removed from MarkupCache. > Use case: http://www.footprint.de/fcc/2008/11/some-wicket-scala/ (To delegate > the clear to FreeMarker/Velocity e.g.) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
svn commit: r722154 - in /wicket/trunk: wicket-examples/src/main/java/org/apache/wicket/examples/captcha/Captcha.java wicket-extensions/src/main/java/org/apache/wicket/extensions/util/encoding/CharSet
Author: thrantal Date: Mon Dec 1 10:11:00 2008 New Revision: 722154 URL: http://svn.apache.org/viewvc?rev=722154&view=rev Log: Added missing generics parameter types, and fixed other Java 5 stuff. Changed CharSetMap to use List instead of array because it was easier to add the type parameters like that (now that Collections can have type parameters it doesn't make a lot of difference). - no functional changes Modified: wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/captcha/Captcha.java wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/util/encoding/CharSetMap.java Modified: wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/captcha/Captcha.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/captcha/Captcha.java?rev=722154&r1=722153&r2=722154&view=diff == --- wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/captcha/Captcha.java (original) +++ wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/captcha/Captcha.java Mon Dec 1 10:11:00 2008 @@ -35,7 +35,7 @@ */ public class Captcha extends WicketExamplePage { - private final class CaptchaForm extends Form + private final class CaptchaForm extends Form { private static final long serialVersionUID = 1L; @@ -52,7 +52,7 @@ captchaImageResource = new CaptchaImageResource(imagePass); add(new Image("captchaImage", captchaImageResource)); - add(new RequiredTextField("password", new PropertyModel(properties, "password")) + add(new RequiredTextField("password", new PropertyModel(properties, "password")) { @Override protected final void onComponentTag(final ComponentTag tag) @@ -115,7 +115,7 @@ { final FeedbackPanel feedback = new FeedbackPanel("feedback"); add(feedback); - add(new CaptchaForm("captchaForm")); + add(new CaptchaForm("captchaForm")); } private String getPassword() Modified: wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/util/encoding/CharSetMap.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/util/encoding/CharSetMap.java?rev=722154&r1=722153&r2=722154&view=diff == --- wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/util/encoding/CharSetMap.java (original) +++ wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/util/encoding/CharSetMap.java Mon Dec 1 10:11:00 2008 @@ -20,8 +20,10 @@ import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; +import java.util.ArrayList; import java.util.HashMap; import java.util.Hashtable; +import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Properties; @@ -62,7 +64,7 @@ /** * A common charset mapper for languages. */ - private static final Map commonMapper = new HashMap(); + private static final Map commonMapper = new HashMap(); static { @@ -108,9 +110,9 @@ } /** -* An array of available charset mappers. +* A collection of available charset mappers. */ - private final Map mappers[] = new Map[6]; + private final List> mappers = new ArrayList>(); /** * Loads mappings from a stream. @@ -121,11 +123,28 @@ * @throws IOException * for an incorrect stream. */ - protected final static Map loadStream(final InputStream input) throws IOException + protected final static Map loadStream(final InputStream input) throws IOException + { + return createMap(input); + } + + private static Map createMap(InputStream input) + throws IOException { final Properties props = new Properties(); props.load(input); - return new HashMap(props); + return createMap(props); + } + + private static Map createMap(Properties props) + { + HashMap map = new HashMap(); + for (Object key : props.keySet()) + { + String keyString = (String) key; + map.put(keyString, props.getProperty(keyString)); + } + return map; } /** @@ -137,7 +156,7 @@ * @throws IOException * for an incorrect file. */ - protected final static Map lo
[jira] Created: (WICKET-1965) Remove final from MarkupCache#clear()
Remove final from MarkupCache#clear() - Key: WICKET-1965 URL: https://issues.apache.org/jira/browse/WICKET-1965 Project: Wicket Issue Type: Improvement Components: wicket Affects Versions: 1.4-RC1 Reporter: Jan Kriesten Priority: Minor Fix For: 1.3.6 When extending MarkupCache to hook inother MarkupLoader for certain components, I'd like to be able to delegate a call to clearing the cache to this other markup loader. To be able to do so, I need to have the final removed from MarkupCache. Use case: http://www.footprint.de/fcc/2008/11/some-wicket-scala/ (To delegate the clear to FreeMarker/Velocity e.g.) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
svn commit: r722114 - /wicket/trunk/wicket/src/main/java/org/apache/wicket/util/tester/FormTester.java
Author: thrantal Date: Mon Dec 1 08:17:18 2008 New Revision: 722114 URL: http://svn.apache.org/viewvc?rev=722114&view=rev Log: Added missing generics parameter types, and fixed other Java 5 stuff - no functional changes Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/util/tester/FormTester.java Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/util/tester/FormTester.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/util/tester/FormTester.java?rev=722114&r1=722113&r2=722114&view=diff == --- wicket/trunk/wicket/src/main/java/org/apache/wicket/util/tester/FormTester.java (original) +++ wicket/trunk/wicket/src/main/java/org/apache/wicket/util/tester/FormTester.java Mon Dec 1 08:17:18 2008 @@ -173,18 +173,18 @@ * @return the id value at the selected index */ @SuppressWarnings("unchecked") - private String selectAbstractChoice(FormComponent formComponent, final int index) + private String selectAbstractChoice(FormComponent formComponent, final int index) { try { Method getChoicesMethod = formComponent.getClass().getMethod("getChoices", - (Class[])null); + (Class[])null); getChoicesMethod.setAccessible(true); List choices = (List)getChoicesMethod.invoke(formComponent, (Object[])null); Method getChoiceRendererMethod = formComponent.getClass().getMethod( - "getChoiceRenderer", (Class[])null); + "getChoiceRenderer", (Class[])null); getChoiceRendererMethod.setAccessible(true); IChoiceRenderer choiceRenderer = (IChoiceRenderer)getChoiceRendererMethod.invoke( formComponent, (Object[])null); @@ -380,7 +380,7 @@ { @SuppressWarnings("unchecked") @Override - public void onFormComponent(final FormComponent formComponent) + public void onFormComponent(final FormComponent formComponent) { // do nothing for invisible component if (!formComponent.isVisibleInHierarchy()) @@ -413,9 +413,9 @@ { final String[] modelValues = formComponent.getValue().split( FormComponent.VALUE_SEPARATOR); - for (int i = 0; i < modelValues.length; i++) + for (String modelValue : modelValues) { - addFormComponentValue(formComponent, modelValues[i]); + addFormComponentValue(formComponent, modelValue); } } else if (formComponent instanceof CheckGroup) @@ -515,10 +515,10 @@ try { Method wantOnSelectionChangedNotificationsMethod = DropDownChoice.class.getDeclaredMethod( - "wantOnSelectionChangedNotifications", new Class[0]); + "wantOnSelectionChangedNotifications"); wantOnSelectionChangedNotificationsMethod.setAccessible(true); - boolean wantOnSelectionChangedNotifications = ((Boolean)wantOnSelectionChangedNotificationsMethod.invoke( - component, new Object[0])).booleanValue(); + boolean wantOnSelectionChangedNotifications = (Boolean) wantOnSelectionChangedNotificationsMethod.invoke( + component); if (wantOnSelectionChangedNotifications) { ((DropDownChoice)component).onSelectionChanged(); @@ -549,9 +549,9 @@ ChoiceSelector choiceSelector = choiceSelectorFactory.createForMultiple((FormComponent)workingForm.get(formComponentId)); - for (int i = 0; i < indexes.length; i++) + for (int index : indexes) { - choiceSelector.doSelect(indexes[i]); + choiceSelector.doSelect(index);
[jira] Resolved: (WICKET-1893) Extend FormTester to easily handle CheckBox components.
[ https://issues.apache.org/jira/browse/WICKET-1893?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Timo Rantalaiho resolved WICKET-1893. - Resolution: Fixed Fix Version/s: 1.4-RC2 Committed a fix for this in 1.4, the workaround is enough for 1.3. > Extend FormTester to easily handle CheckBox components. > --- > > Key: WICKET-1893 > URL: https://issues.apache.org/jira/browse/WICKET-1893 > Project: Wicket > Issue Type: Improvement > Components: wicket >Affects Versions: 1.3.5, 1.4-M3 >Reporter: Minto van der Sluis >Assignee: Timo Rantalaiho >Priority: Minor > Fix For: 1.4-RC2 > > > Add methods to the FormTester to support unittesting CheckBox. > The following methods could be added: > public boolean getCheckBoxComponentValue(java.lang.String id); > public void setValue(java.lang.String formComponentId, boolean value); > When the given component ID is not a CheckBox (or one of its subclasses) then > these methods could/should throw an exception. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
svn commit: r722112 - in /wicket/trunk/wicket/src: main/java/org/apache/wicket/util/tester/FormTester.java test/java/org/apache/wicket/util/tester/FormTesterTest.java
Author: thrantal Date: Mon Dec 1 08:12:38 2008 New Revision: 722112 URL: http://svn.apache.org/viewvc?rev=722112&view=rev Log: WICKET-1893 : added an overloaded version of setValue() that takes a boolean, because this makes discovering how to use FormTester with CheckBoxes easier. Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/util/tester/FormTester.java wicket/trunk/wicket/src/test/java/org/apache/wicket/util/tester/FormTesterTest.java Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/util/tester/FormTester.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/util/tester/FormTester.java?rev=722112&r1=722111&r2=722112&view=diff == --- wicket/trunk/wicket/src/main/java/org/apache/wicket/util/tester/FormTester.java (original) +++ wicket/trunk/wicket/src/main/java/org/apache/wicket/util/tester/FormTester.java Mon Dec 1 08:12:38 2008 @@ -27,8 +27,8 @@ import java.util.Map; import org.apache.wicket.Component; -import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.Component.IVisitor; +import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.markup.html.form.AbstractTextComponent; import org.apache.wicket.markup.html.form.Check; import org.apache.wicket.markup.html.form.CheckBox; @@ -579,6 +579,11 @@ } } + public void setValue(String checkBoxId, boolean value) + { + setValue(checkBoxId, Boolean.toString(value)); + } + /** * Sets the File on a [EMAIL PROTECTED] FileUploadField}. * Modified: wicket/trunk/wicket/src/test/java/org/apache/wicket/util/tester/FormTesterTest.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/util/tester/FormTesterTest.java?rev=722112&r1=722111&r2=722112&view=diff == --- wicket/trunk/wicket/src/test/java/org/apache/wicket/util/tester/FormTesterTest.java (original) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/util/tester/FormTesterTest.java Mon Dec 1 08:12:38 2008 @@ -68,6 +68,25 @@ assertTrue(domainObject.isCheckbox()); } + public void testCheckboxValuesCanBeSelectedWithBoolean() + { + tester.startPage(MockFormPage.class); + MockFormPage page = (MockFormPage)tester.getLastRenderedPage(); + MockDomainObject domainObject = page.getDomainObject(); + assertFalse(domainObject.isCheckbox()); + + FormTester formTester = tester.newFormTester("form"); + formTester.setValue("checkbox", true); + formTester.submit(); + assertTrue(domainObject.isCheckbox()); + + formTester = tester.newFormTester("form"); + formTester.setValue("checkbox", false); + formTester.submit(); + assertFalse(domainObject.isCheckbox()); + } + + /** * Test that the user can use * [EMAIL PROTECTED] FormTester#setFile(String, org.apache.wicket.util.file.File, String)} to test that
svn commit: r722109 - /wicket/trunk/wicket/src/test/java/org/apache/wicket/util/tester/MockFormPage.java
Author: thrantal Date: Mon Dec 1 08:05:45 2008 New Revision: 722109 URL: http://svn.apache.org/viewvc?rev=722109&view=rev Log: Added missing generics type parameters - no functional changes Modified: wicket/trunk/wicket/src/test/java/org/apache/wicket/util/tester/MockFormPage.java Modified: wicket/trunk/wicket/src/test/java/org/apache/wicket/util/tester/MockFormPage.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/util/tester/MockFormPage.java?rev=722109&r1=722108&r2=722109&view=diff == --- wicket/trunk/wicket/src/test/java/org/apache/wicket/util/tester/MockFormPage.java (original) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/util/tester/MockFormPage.java Mon Dec 1 08:05:45 2008 @@ -103,12 +103,12 @@ public MockFormPage() { domainObject = new MockDomainObject(); - Form form = new Form("form", new CompoundPropertyModel(domainObject)); + Form form = new Form("form", new CompoundPropertyModel(domainObject)); add(form); - form.add(new TextField("text")); + form.add(new TextField("text")); form.add(new CheckBox("checkbox")); - form.add(new TextArea("textarea")); + form.add(new TextArea("textarea")); form.add(new Button("submit")); }
svn commit: r722106 - /wicket/trunk/wicket/src/main/java/org/apache/wicket/MarkupContainer.java
Author: jcompagner Date: Mon Dec 1 07:58:18 2008 New Revision: 722106 URL: http://svn.apache.org/viewvc?rev=722106&view=rev Log: class cast fix Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/MarkupContainer.java Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/MarkupContainer.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/MarkupContainer.java?rev=722106&r1=722105&r2=722106&view=diff == --- wicket/trunk/wicket/src/main/java/org/apache/wicket/MarkupContainer.java (original) +++ wicket/trunk/wicket/src/main/java/org/apache/wicket/MarkupContainer.java Mon Dec 1 07:58:18 2008 @@ -18,7 +18,6 @@ import java.util.AbstractList; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.Iterator; @@ -466,7 +465,6 @@ *The comparator * @return Iterator that iterates over children in the order specified by comparator */ - @SuppressWarnings("unchecked") public final Iterator iterator(Comparator comparator) { final List sorted; @@ -481,13 +479,15 @@ sorted = new ArrayList(1); sorted.add((Component)children); } - else if (children instanceof ChildList) - { - sorted = new ArrayList((ChildList)children); - } else { - sorted = Arrays.asList((Component[])children); + int size = children_size(); + sorted = new ArrayList(size); + for (int i = 0; i < size; i++) + { + sorted.add(children_get(i)); + } + } } Collections.sort(sorted, comparator); @@ -647,7 +647,7 @@ associatedMarkupStream.next(); String className = null; - + if (getApplication().getDebugSettings().isOutputMarkupContainerClassName()) { Class klass = getClass();
svn commit: r722105 - /wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/MarkupContainer.java
Author: jcompagner Date: Mon Dec 1 07:57:41 2008 New Revision: 722105 URL: http://svn.apache.org/viewvc?rev=722105&view=rev Log: generics of 1.4 showed that the fix was not really correct because the children list doesnt have to be a component array but still can be ComponentSourceEntry So now it really goes through children_get(index) Modified: wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/MarkupContainer.java Modified: wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/MarkupContainer.java URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/MarkupContainer.java?rev=722105&r1=722104&r2=722105&view=diff == --- wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/MarkupContainer.java (original) +++ wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/MarkupContainer.java Mon Dec 1 07:57:41 2008 @@ -18,7 +18,6 @@ import java.util.AbstractList; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.Iterator; @@ -469,13 +468,15 @@ sorted = new ArrayList(1); sorted.add(children); } - else if (children instanceof ChildList) - { - sorted = new ArrayList((ChildList)children); - } else { - sorted = Arrays.asList((Object[])children); + int size = children_size(); + sorted = new ArrayList(size); + for (int i = 0; i < size; i++) + { + sorted.add(children_get(i)); + } + } } Collections.sort(sorted, comparator);
[jira] Updated: (WICKET-1964) Add IBehavior.isVisibilityAllowed(Component) or so
[ https://issues.apache.org/jira/browse/WICKET-1964?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Igor Vaynberg updated WICKET-1964: -- Fix Version/s: (was: 1.4-RC2) Assignee: Igor Vaynberg removing 1.4 fix version, we cannot break api that badly in that branch > Add IBehavior.isVisibilityAllowed(Component) or so > -- > > Key: WICKET-1964 > URL: https://issues.apache.org/jira/browse/WICKET-1964 > Project: Wicket > Issue Type: New Feature > Components: wicket >Reporter: Anatoly Kupriyanov >Assignee: Igor Vaynberg > Fix For: 1.5-M1 > > > A behavior should able to control component's visibility. > Discussion > http://www.nabble.com/make-invisible-if-model-object-is-null-tt20769823.html > explains useful usecase -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
svn commit: r722103 - /wicket/trunk/wicket/src/test/java/org/apache/wicket/util/tester/MockPageWithFormAndAjaxFormSubmitBehavior.java
Author: thrantal Date: Mon Dec 1 07:52:11 2008 New Revision: 722103 URL: http://svn.apache.org/viewvc?rev=722103&view=rev Log: Added missing generics parameter types and @Override annotations - no functional changes Modified: wicket/trunk/wicket/src/test/java/org/apache/wicket/util/tester/MockPageWithFormAndAjaxFormSubmitBehavior.java Modified: wicket/trunk/wicket/src/test/java/org/apache/wicket/util/tester/MockPageWithFormAndAjaxFormSubmitBehavior.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/util/tester/MockPageWithFormAndAjaxFormSubmitBehavior.java?rev=722103&r1=722102&r2=722103&view=diff == --- wicket/trunk/wicket/src/test/java/org/apache/wicket/util/tester/MockPageWithFormAndAjaxFormSubmitBehavior.java (original) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/util/tester/MockPageWithFormAndAjaxFormSubmitBehavior.java Mon Dec 1 07:52:11 2008 @@ -49,10 +49,10 @@ { pojo = new Pojo("Mock name"); - Form form = new Form("form", new CompoundPropertyModel(pojo)); + Form form = new Form("form", new CompoundPropertyModel(pojo)); add(form); - form.add(new TextField("name")); + form.add(new TextField("name")); // The Event behavior WebComponent eventComponent = new WebComponent(EVENT_COMPONENT); @@ -61,11 +61,13 @@ { private static final long serialVersionUID = 1L; + @Override protected void onSubmit(AjaxRequestTarget target) { executed = true; } + @Override protected void onError(AjaxRequestTarget target) { }
svn commit: r722099 - /wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/MarkupContainer.java
Author: jcompagner Date: Mon Dec 1 07:35:24 2008 New Revision: 722099 URL: http://svn.apache.org/viewvc?rev=722099&view=rev Log: class cast fix Modified: wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/MarkupContainer.java Modified: wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/MarkupContainer.java URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/MarkupContainer.java?rev=722099&r1=722098&r2=722099&view=diff == --- wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/MarkupContainer.java (original) +++ wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/MarkupContainer.java Mon Dec 1 07:35:24 2008 @@ -475,7 +475,7 @@ } else { - sorted = Arrays.asList((Component[])children); + sorted = Arrays.asList((Object[])children); } } Collections.sort(sorted, comparator);
svn commit: r722097 - in /wicket/trunk: wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/ wicket-examples/src/main/java/org/apache/wicket/examples/compref/ wicket-examples/src/mai
Author: thrantal Date: Mon Dec 1 07:34:17 2008 New Revision: 722097 URL: http://svn.apache.org/viewvc?rev=722097&view=rev Log: Added missing generics parameter types, and fixed other Java 5 stuff - no functional changes Modified: wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/AutoCompletePage.java wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/BasePage.java wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/compref/BookmarkablePage.java wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/compref/BookmarkablePageLinkPage.java wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/library/BookDetails.java wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/repeater/AjaxDataTablePage.java wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/spring/common/web/BasePage.java wicket/trunk/wicket-examples/src/test/java/org/apache/wicket/examples/AllTests.java wicket/trunk/wicket-examples/src/test/java/org/apache/wicket/filtertest/Application.java wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxEditableLabel.java wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/BreadCrumbBar.java wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/BreadCrumbLink.java wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/BreadCrumbModelListenerSupport.java wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/DefaultBreadCrumbsModel.java wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/IBreadCrumbModel.java wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/palette/component/AbstractOptions.java wicket/trunk/wicket-extensions/src/test/java/org/apache/wicket/extensions/ajax/markup/html/AjaxEditableLabelPage.java wicket/trunk/wicket-extensions/src/test/java/org/apache/wicket/extensions/ajax/markup/html/AjaxEditableTest.java wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/resolver/AutoLinkResolver.java wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/BufferedHttpServletResponse.java wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/coding/AbstractRequestTargetUrlCodingStrategy.java wicket/trunk/wicket/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java wicket/trunk/wicket/src/main/java/org/apache/wicket/util/value/AttributeMap.java wicket/trunk/wicket/src/test/java/org/apache/wicket/ApplicationSettingsTest.java wicket/trunk/wicket/src/test/java/org/apache/wicket/AuthorizationTest.java wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/border/BorderRenderWrappedTestPage_1.java wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/border/BoxBorderTest.java wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/border/BoxBorderTestPage_2.java wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkableHomePageLinksPage.java wicket/trunk/wicket/src/test/java/org/apache/wicket/redirect/abort/AbortExceptionPage.java wicket/trunk/wicket/src/test/java/org/apache/wicket/util/tester/BlockedResourceLinkPage.java wicket/trunk/wicket/src/test/java/org/apache/wicket/util/tester/WicketTesterTest.java wicket/trunk/wicket/src/test/java/org/apache/wicket/util/tester/apps_5/AjaxLinkClickTest.java Modified: wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/AutoCompletePage.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/AutoCompletePage.java?rev=722097&r1=722096&r2=722097&view=diff == --- wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/AutoCompletePage.java (original) +++ wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/AutoCompletePage.java Mon Dec 1 07:34:17 2008 @@ -43,7 +43,7 @@ */ public AutoCompletePage() { - Form form = new Form("form"); + Form form = new Form("form"); add(form); final AutoCompleteTextField field = new AutoCompleteTextField("ac", @@ -62,9 +62,8 @@ Locale[] locales = Locale.getAvailableLocales(); - for (int i = 0; i < locales.length; i++) + for (final Locale locale : locales) { - final Locale locale = locales[i]; final
[jira] Created: (WICKET-1964) Add IBehavior.isVisibilityAllowed(Component) or so
Add IBehavior.isVisibilityAllowed(Component) or so -- Key: WICKET-1964 URL: https://issues.apache.org/jira/browse/WICKET-1964 Project: Wicket Issue Type: New Feature Components: wicket Reporter: Anatoly Kupriyanov Fix For: 1.4-RC2, 1.5-M1 A behavior should able to control component's visibility. Discussion http://www.nabble.com/make-invisible-if-model-object-is-null-tt20769823.html explains useful usecase -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (WICKET-1886) WicketTester Cookie handling
[ https://issues.apache.org/jira/browse/WICKET-1886?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12652012#action_12652012 ] Jörn Zaefferer commented on WICKET-1886: I can't reproduce the issue with the attached file either, even though the SecureForm implementation is exactly the same. I'll post an update as soon as I find something. If nothing helps, I'll try to extract my own test from the application. > WicketTester Cookie handling > > > Key: WICKET-1886 > URL: https://issues.apache.org/jira/browse/WICKET-1886 > Project: Wicket > Issue Type: Bug >Affects Versions: 1.3.5, 1.4-RC1 >Reporter: Jörn Zaefferer >Assignee: Timo Rantalaiho > Fix For: 1.3.6, 1.4-RC2 > > Attachments: CookieTest.java, patch-WICKET-1886.diff, > WICKET-1886__SecureForm_and_failing_test.patch > > > While trying to test my SecureForm implementation > (https://issues.apache.org/jira/browse/WICKET-1885) with WicketTester I ran > into this issue: A cookie set in the response never shows up in the "next" > request, because both have their own lists of cookies that aren't shared. > Afaik both should share the same List instance to handle cookies. That way > its possible to set a cookie in the response and read it from the request. > A simple testcase is attached. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Resolved: (WICKET-693) What to do with the wicket dtd?
[ https://issues.apache.org/jira/browse/WICKET-693?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Timo Rantalaiho resolved WICKET-693. Resolution: Fixed Fix Version/s: 1.3.6 Well, now the current DTD is available here http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd and it can be referenced if someone knows the correct way :) Adding the xmlns:wicket attribute above seems to help IntelliJ IDEA to get that into use, even though it doesn't seem to be valid HTML. Better ideas are welcome. > What to do with the wicket dtd? > --- > > Key: WICKET-693 > URL: https://issues.apache.org/jira/browse/WICKET-693 > Project: Wicket > Issue Type: Bug > Components: site, wicket >Reporter: Martijn Dashorst >Assignee: Timo Rantalaiho > Fix For: 1.3.6, 1.4-RC2 > > > The current dtd is located at the wicket.sf.net site, and may not even work. > We need to come up with a solution for the wicket dtd and fix this for the > future: > ./jdk-1.4/wicket/src/site/resources/DTD/wicket-1.0-xhtml11.dtd: SYSTEM > "http://wicket.sourceforge.net/DTD/wicket-xhtml1.dtd"; -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (WICKET-1886) WicketTester Cookie handling
[ https://issues.apache.org/jira/browse/WICKET-1886?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12652001#action_12652001 ] Timo Rantalaiho commented on WICKET-1886: - OK, thanks for the comments. Could you change the attached SecureFormTest so that it demonstrates the problem? There must be something I'm missing here. > WicketTester Cookie handling > > > Key: WICKET-1886 > URL: https://issues.apache.org/jira/browse/WICKET-1886 > Project: Wicket > Issue Type: Bug >Affects Versions: 1.3.5, 1.4-RC1 >Reporter: Jörn Zaefferer >Assignee: Timo Rantalaiho > Fix For: 1.3.6, 1.4-RC2 > > Attachments: CookieTest.java, patch-WICKET-1886.diff, > WICKET-1886__SecureForm_and_failing_test.patch > > > While trying to test my SecureForm implementation > (https://issues.apache.org/jira/browse/WICKET-1885) with WicketTester I ran > into this issue: A cookie set in the response never shows up in the "next" > request, because both have their own lists of cookies that aren't shared. > Afaik both should share the same List instance to handle cookies. That way > its possible to set a cookie in the response and read it from the request. > A simple testcase is attached. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (WICKET-1886) WicketTester Cookie handling
[ https://issues.apache.org/jira/browse/WICKET-1886?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12651996#action_12651996 ] Jörn Zaefferer commented on WICKET-1886: Thanks Timo, but that doesn't fix it. I think the problem is setupRequestAndResponse isn't called "often enough". The flow seems to be like this: setup add cookie to response try to read previous cookie from request -> missing, therefore write new cookie setup So between rendering a page and submit a form and processing the submit, setupRequestAndResponse isn't called. So in that respect, SecureForm needs to read a cookie from the request just after it was written to the response. The WicketTesterTest is insufficient, as it never reads a cookie from the request after setting it to the response... > WicketTester Cookie handling > > > Key: WICKET-1886 > URL: https://issues.apache.org/jira/browse/WICKET-1886 > Project: Wicket > Issue Type: Bug >Affects Versions: 1.3.5, 1.4-RC1 >Reporter: Jörn Zaefferer >Assignee: Timo Rantalaiho > Fix For: 1.3.6, 1.4-RC2 > > Attachments: CookieTest.java, patch-WICKET-1886.diff, > WICKET-1886__SecureForm_and_failing_test.patch > > > While trying to test my SecureForm implementation > (https://issues.apache.org/jira/browse/WICKET-1885) with WicketTester I ran > into this issue: A cookie set in the response never shows up in the "next" > request, because both have their own lists of cookies that aren't shared. > Afaik both should share the same List instance to handle cookies. That way > its possible to set a cookie in the response and read it from the request. > A simple testcase is attached. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (WICKET-1886) WicketTester Cookie handling
[ https://issues.apache.org/jira/browse/WICKET-1886?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12651989#action_12651989 ] Timo Rantalaiho commented on WICKET-1886: - Jörn, I've committed what I think fixes this issue. Could you please try with the latest snapshot? (Either 1.3.x branch or trunk, the fix is in both.) > WicketTester Cookie handling > > > Key: WICKET-1886 > URL: https://issues.apache.org/jira/browse/WICKET-1886 > Project: Wicket > Issue Type: Bug >Affects Versions: 1.3.5, 1.4-RC1 >Reporter: Jörn Zaefferer >Assignee: Timo Rantalaiho > Fix For: 1.3.6, 1.4-RC2 > > Attachments: CookieTest.java, patch-WICKET-1886.diff, > WICKET-1886__SecureForm_and_failing_test.patch > > > While trying to test my SecureForm implementation > (https://issues.apache.org/jira/browse/WICKET-1885) with WicketTester I ran > into this issue: A cookie set in the response never shows up in the "next" > request, because both have their own lists of cookies that aren't shared. > Afaik both should share the same List instance to handle cookies. That way > its possible to set a cookie in the response and read it from the request. > A simple testcase is attached. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Updated: (WICKET-1886) WicketTester Cookie handling
[ https://issues.apache.org/jira/browse/WICKET-1886?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Timo Rantalaiho updated WICKET-1886: Fix Version/s: 1.4-RC2 Affects Version/s: (was: 1.3.4) 1.3.5 1.4-RC1 > WicketTester Cookie handling > > > Key: WICKET-1886 > URL: https://issues.apache.org/jira/browse/WICKET-1886 > Project: Wicket > Issue Type: Bug >Affects Versions: 1.3.5, 1.4-RC1 >Reporter: Jörn Zaefferer >Assignee: Timo Rantalaiho > Fix For: 1.3.6, 1.4-RC2 > > Attachments: CookieTest.java, patch-WICKET-1886.diff, > WICKET-1886__SecureForm_and_failing_test.patch > > > While trying to test my SecureForm implementation > (https://issues.apache.org/jira/browse/WICKET-1885) with WicketTester I ran > into this issue: A cookie set in the response never shows up in the "next" > request, because both have their own lists of cookies that aren't shared. > Afaik both should share the same List instance to handle cookies. That way > its possible to set a cookie in the response and read it from the request. > A simple testcase is attached. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
svn commit: r722058 - /wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/MockHttpServletRequest.java
Author: thrantal Date: Mon Dec 1 04:29:16 2008 New Revision: 722058 URL: http://svn.apache.org/viewvc?rev=722058&view=rev Log: WICKET-1886: It seems that Iterable is not in JDK 1.4. This should fix the TeamCity build. Modified: wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/MockHttpServletRequest.java Modified: wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/MockHttpServletRequest.java URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/MockHttpServletRequest.java?rev=722058&r1=722057&r2=722058&view=diff == --- wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/MockHttpServletRequest.java (original) +++ wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/MockHttpServletRequest.java Mon Dec 1 04:29:16 2008 @@ -28,6 +28,7 @@ import java.text.DateFormat; import java.text.ParseException; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; @@ -213,7 +214,7 @@ cookies.add(cookie); } - public void addCookies(Iterable cookies) + public void addCookies(Collection cookies) { for (Iterator it = cookies.iterator(); it.hasNext();) {
svn commit: r722044 - in /wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src: main/java/org/apache/wicket/protocol/http/ test/java/org/apache/wicket/util/tester/
Author: thrantal Date: Mon Dec 1 03:47:48 2008 New Revision: 722044 URL: http://svn.apache.org/viewvc?rev=722044&view=rev Log: WICKET-1886: Fixed testing things that require cookies persisted over multiple requests, such as CSRF protection in a hidden Form fields. An even more straight forward option would have been to remove clearing cookies in MockWebApplication.initialize(), and copy cookies to each request from response, because after all the lifecycle of a WicketTester (MockWebApplication) instance should be such that cookies could be preserved there. Backport from trunk. Modified: wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/MockHttpServletRequest.java wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/MockWebApplication.java wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/util/tester/WicketTesterTest.java Modified: wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/MockHttpServletRequest.java URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/MockHttpServletRequest.java?rev=722044&r1=722043&r2=722044&view=diff == --- wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/MockHttpServletRequest.java (original) +++ wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/MockHttpServletRequest.java Mon Dec 1 03:47:48 2008 @@ -213,6 +213,16 @@ cookies.add(cookie); } + public void addCookies(Iterable cookies) + { + for (Iterator it = cookies.iterator(); it.hasNext();) + { + Cookie cookie = (Cookie) it.next(); + addCookie(cookie); + } + } + + /** * Add an uploaded file to the request. Use this to simulate a file that has been uploaded to a * field. Modified: wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/MockWebApplication.java URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/MockWebApplication.java?rev=722044&r1=722043&r2=722044&view=diff == --- wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/MockWebApplication.java (original) +++ wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/MockWebApplication.java Mon Dec 1 03:47:48 2008 @@ -19,13 +19,16 @@ import java.io.File; import java.util.Enumeration; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.Map; +import java.util.Set; import java.util.TreeSet; import javax.servlet.FilterConfig; import javax.servlet.ServletContext; import javax.servlet.ServletException; +import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletResponse; import org.apache.wicket.Application; @@ -122,6 +125,7 @@ private final ServletContext context; private final WicketFilter filter; + private Set cookiesOfThisSession = new HashSet(); /** * Create the mock http tester that can be used for testing. @@ -195,7 +199,14 @@ servletSession = new MockHttpSession(context); servletSession.setTemporary(initializeHttpSessionAsTemporary()); servletRequest = new MockHttpServletRequest(this.application, servletSession, context); - servletResponse = new MockHttpServletResponse(servletRequest); + servletResponse = new MockHttpServletResponse(servletRequest) + { + public void addCookie(Cookie cookie) + { + super.addCookie(cookie); + cookiesOfThisSession.add(cookie); + } + }; // Construct request and response using factories wicketRequest = this.application.newWebRequest(servletRequest); @@ -619,6 +630,7 @@ { servletRequest.initialize(); servletResponse.initialize(); + servletRequest.addCookies(cookiesOfThisSession); servletRequest.setParameters(parametersForNextRequest); if (isAjax) { Modified: wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/util/tester/WicketTesterTest.java URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/util/tester/WicketTesterTest.java?rev=722044&r1=722043&r2=722044&view=diff ===
svn commit: r722039 - in /wicket/trunk/wicket/src: main/java/org/apache/wicket/protocol/http/MockWebApplication.java test/java/org/apache/wicket/util/tester/WicketTesterTest.java
Author: thrantal Date: Mon Dec 1 03:25:55 2008 New Revision: 722039 URL: http://svn.apache.org/viewvc?rev=722039&view=rev Log: WICKET-1886: Fixed testing things that require cookies persisted over multiple requests, such as CSRF protection in a hidden Form fields. An even more straight forward option would have been to remove clearing cookies in MockWebApplication.initialize(), and copy cookies to each request from response, because after all the lifecycle of a WicketTester (MockWebApplication) instance should be such that cookies could be preserved there. Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/MockWebApplication.java wicket/trunk/wicket/src/test/java/org/apache/wicket/util/tester/WicketTesterTest.java Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/MockWebApplication.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/MockWebApplication.java?rev=722039&r1=722038&r2=722039&view=diff == --- wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/MockWebApplication.java (original) +++ wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/MockWebApplication.java Mon Dec 1 03:25:55 2008 @@ -16,16 +16,18 @@ */ package org.apache.wicket.protocol.http; +import javax.servlet.FilterConfig; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletResponse; import java.io.File; import java.util.Enumeration; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.Map; - -import javax.servlet.FilterConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletResponse; +import java.util.Set; import org.apache.wicket.Application; import org.apache.wicket.Component; @@ -121,6 +123,7 @@ private final ServletContext context; private final WicketFilter filter; + private Set cookiesOfThisSession = new HashSet(); /** * Create the mock http tester that can be used for testing. @@ -195,7 +198,15 @@ servletSession = new MockHttpSession(context); servletSession.setTemporary(initializeHttpSessionAsTemporary()); servletRequest = new MockHttpServletRequest(this.application, servletSession, context); - servletResponse = new MockHttpServletResponse(servletRequest); + servletResponse = new MockHttpServletResponse(servletRequest) + { + @Override + public void addCookie(Cookie cookie) + { + super.addCookie(cookie); + cookiesOfThisSession.add(cookie); + } + }; // Construct request and response using factories wicketRequest = this.application.newWebRequest(servletRequest); @@ -620,6 +631,7 @@ { servletRequest.initialize(); servletResponse.initialize(); + servletRequest.addCookies(cookiesOfThisSession); servletRequest.setParameters(parametersForNextRequest); if (isAjax) { Modified: wicket/trunk/wicket/src/test/java/org/apache/wicket/util/tester/WicketTesterTest.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/util/tester/WicketTesterTest.java?rev=722039&r1=722038&r2=722039&view=diff == --- wicket/trunk/wicket/src/test/java/org/apache/wicket/util/tester/WicketTesterTest.java (original) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/util/tester/WicketTesterTest.java Mon Dec 1 03:25:55 2008 @@ -16,12 +16,16 @@ */ package org.apache.wicket.util.tester; +import javax.servlet.http.Cookie; +import java.util.Collection; import java.util.Locale; import junit.framework.TestCase; - -import org.apache.wicket.*; -import org.apache.wicket.protocol.http.WebRequestCycle; +import org.apache.wicket.Component; +import org.apache.wicket.MockPageWithLink; +import org.apache.wicket.MockPageWithOneComponent; +import org.apache.wicket.Page; +import org.apache.wicket.Session; import org.apache.wicket.ajax.AjaxEventBehavior; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.markup.html.AjaxLink; @@ -31,6 +35,7 @@ import org.apache.wicket.markup.html.form.TextField; import org.apache.wicket.markup.html.link.Link; import org.apache.wicket.model.IModel; +import org.apache.wicket.protocol.http.WebRequestCycle; import org.apache.wicket.request.target.coding.IRequestTargetUrlCodingStrategy; import org.apache.wicket.util.tester
[jira] Updated: (WICKET-1886) WicketTester Cookie handling
[ https://issues.apache.org/jira/browse/WICKET-1886?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Timo Rantalaiho updated WICKET-1886: Attachment: WICKET-1886__SecureForm_and_failing_test.patch Attached an example usage of FormTester to test SecurePage to demonstrate this bug. > WicketTester Cookie handling > > > Key: WICKET-1886 > URL: https://issues.apache.org/jira/browse/WICKET-1886 > Project: Wicket > Issue Type: Bug >Affects Versions: 1.3.4 >Reporter: Jörn Zaefferer >Assignee: Timo Rantalaiho > Fix For: 1.3.6 > > Attachments: CookieTest.java, patch-WICKET-1886.diff, > WICKET-1886__SecureForm_and_failing_test.patch > > > While trying to test my SecureForm implementation > (https://issues.apache.org/jira/browse/WICKET-1885) with WicketTester I ran > into this issue: A cookie set in the response never shows up in the "next" > request, because both have their own lists of cookies that aren't shared. > Afaik both should share the same List instance to handle cookies. That way > its possible to set a cookie in the response and read it from the request. > A simple testcase is attached. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
svn commit: r722035 - /wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/MockHttpServletRequest.java
Author: thrantal Date: Mon Dec 1 03:06:43 2008 New Revision: 722035 URL: http://svn.apache.org/viewvc?rev=722035&view=rev Log: WICKET-1886: Added a convenience method for adding several cookies at once. Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/MockHttpServletRequest.java Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/MockHttpServletRequest.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/MockHttpServletRequest.java?rev=722035&r1=722034&r2=722035&view=diff == --- wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/MockHttpServletRequest.java (original) +++ wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/MockHttpServletRequest.java Mon Dec 1 03:06:43 2008 @@ -16,6 +16,12 @@ */ package org.apache.wicket.protocol.http; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletContext; +import javax.servlet.ServletInputStream; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -37,13 +43,6 @@ import java.util.Locale; import java.util.Map; -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletContext; -import javax.servlet.ServletInputStream; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; - import org.apache.wicket.Application; import org.apache.wicket.Component; import org.apache.wicket.IPageMap; @@ -214,6 +213,15 @@ cookies.add(cookie); } + public void addCookies(Iterable cookies) + { + for (Cookie cookie : cookies) + { + addCookie(cookie); + } + } + + /** * Add an uploaded file to the request. Use this to simulate a file that has been uploaded to a * field.