[wicket] branch wicket-9.x updated: WICKET-7065 replace inline js with header item
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch wicket-9.x in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/wicket-9.x by this push: new 6eaaa5a32c WICKET-7065 replace inline js with header item 6eaaa5a32c is described below commit 6eaaa5a32c3d041c63f32e6377d8ec95633762f3 Author: Sven Meier AuthorDate: Fri Jul 28 22:51:06 2023 +0200 WICKET-7065 replace inline js with header item --- .../markup/html/repeater/data/table/filter/FilterForm.java | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/FilterForm.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/FilterForm.java index 48af754e9d..a3099c7455 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/FilterForm.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/FilterForm.java @@ -22,6 +22,7 @@ import org.apache.wicket.markup.ComponentTag; import org.apache.wicket.markup.MarkupStream; import org.apache.wicket.markup.head.IHeaderResponse; import org.apache.wicket.markup.head.JavaScriptHeaderItem; +import org.apache.wicket.markup.head.OnEventHeaderItem; import org.apache.wicket.markup.head.OnLoadHeaderItem; import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.markup.html.form.FormComponent; @@ -140,11 +141,9 @@ public class FilterForm extends Form } @Override - public void onComponentTag(final Component component, final ComponentTag tag) - { - tag.put("onfocus", getFocusTrackingHandler(component)); - - super.onComponentTag(component, tag); + public void renderHead(Component component, IHeaderResponse response) { + response.render(OnEventHeaderItem.forComponent(component, "focus", + getFocusTrackingHandler(component))); } }); }
[wicket] branch master updated: WICKET-7065 replace inline js with header item
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/master by this push: new a36ed9f200 WICKET-7065 replace inline js with header item a36ed9f200 is described below commit a36ed9f200429cc86ffe8b2134c42c49952a9e54 Author: Sven Meier AuthorDate: Fri Jul 28 22:51:06 2023 +0200 WICKET-7065 replace inline js with header item --- .../markup/html/repeater/data/table/filter/FilterForm.java | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/FilterForm.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/FilterForm.java index 48af754e9d..a3099c7455 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/FilterForm.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/FilterForm.java @@ -22,6 +22,7 @@ import org.apache.wicket.markup.ComponentTag; import org.apache.wicket.markup.MarkupStream; import org.apache.wicket.markup.head.IHeaderResponse; import org.apache.wicket.markup.head.JavaScriptHeaderItem; +import org.apache.wicket.markup.head.OnEventHeaderItem; import org.apache.wicket.markup.head.OnLoadHeaderItem; import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.markup.html.form.FormComponent; @@ -140,11 +141,9 @@ public class FilterForm extends Form } @Override - public void onComponentTag(final Component component, final ComponentTag tag) - { - tag.put("onfocus", getFocusTrackingHandler(component)); - - super.onComponentTag(component, tag); + public void renderHead(Component component, IHeaderResponse response) { + response.render(OnEventHeaderItem.forComponent(component, "focus", + getFocusTrackingHandler(component))); } }); }
[wicket] 01/01: WICKET-7065 replace inline js with header item
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch fix/WICKET-7065-filter-form-inline-js in repository https://gitbox.apache.org/repos/asf/wicket.git commit 9c7928fba264fcd4ae9ac3b7acc55bcdc19a424e Author: Sven Meier AuthorDate: Fri Jul 28 22:51:06 2023 +0200 WICKET-7065 replace inline js with header item --- .../markup/html/repeater/data/table/filter/FilterForm.java | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/FilterForm.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/FilterForm.java index 48af754e9d..a3099c7455 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/FilterForm.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/FilterForm.java @@ -22,6 +22,7 @@ import org.apache.wicket.markup.ComponentTag; import org.apache.wicket.markup.MarkupStream; import org.apache.wicket.markup.head.IHeaderResponse; import org.apache.wicket.markup.head.JavaScriptHeaderItem; +import org.apache.wicket.markup.head.OnEventHeaderItem; import org.apache.wicket.markup.head.OnLoadHeaderItem; import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.markup.html.form.FormComponent; @@ -140,11 +141,9 @@ public class FilterForm extends Form } @Override - public void onComponentTag(final Component component, final ComponentTag tag) - { - tag.put("onfocus", getFocusTrackingHandler(component)); - - super.onComponentTag(component, tag); + public void renderHead(Component component, IHeaderResponse response) { + response.render(OnEventHeaderItem.forComponent(component, "focus", + getFocusTrackingHandler(component))); } }); }
[wicket] branch fix/WICKET-7065-filter-form-inline-js created (now 9c7928fba2)
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a change to branch fix/WICKET-7065-filter-form-inline-js in repository https://gitbox.apache.org/repos/asf/wicket.git at 9c7928fba2 WICKET-7065 replace inline js with header item This branch includes the following new commits: new 9c7928fba2 WICKET-7065 replace inline js with header item The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
[wicket] 01/01: removed queuing
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch remove-queuing in repository https://gitbox.apache.org/repos/asf/wicket.git commit 5a73dd1f7e309824a7b12994f4add41ba68b20ae Author: Sven Meier AuthorDate: Wed Jun 2 23:06:39 2021 +0200 removed queuing --- .../java/org/apache/wicket/ChildToDequeueType.java | 49 - .../java/org/apache/wicket/DequeueContext.java | 301 -- .../java/org/apache/wicket/DequeueTagAction.java | 27 - .../main/java/org/apache/wicket/IQueueRegion.java | 61 -- .../java/org/apache/wicket/MarkupContainer.java| 348 -- .../src/main/java/org/apache/wicket/Page.java |3 +- .../apache/wicket/markup/html/border/Border.java | 147 +-- .../markup/html/form/FormComponentPanel.java |3 +- .../apache/wicket/markup/html/panel/Fragment.java | 17 +- .../org/apache/wicket/markup/html/panel/Panel.java | 26 +- .../wicket/markup/repeater/AbstractRepeater.java | 32 +- .../apache/wicket/BehavioursDetachTestPage.java|2 +- .../apache/wicket/OnComponentTagListenerTest.java |5 +- .../markup/html/border/BorderWithFormPage.java | 40 - .../markup/html/border/ComponentBorderTest.java| 24 - .../markup/html/internal/AjaxEnclosurePage_4.java |8 +- .../html/internal/ListViewInContainerPage.java |4 +- .../wicket/markupFragments/MarkupFragmentTest.java |3 - .../queueing/ComponentQueueingPerformanceTest.java | 400 --- .../wicket/queueing/ComponentQueueingTest.java | 1135 .../queueing/transparentresolvers/SubPage.java |2 +- .../TransparentContainerQueuePage.java |2 +- .../ajax/builtin/modal/ModalDialogPage.java| 39 +- 23 files changed, 42 insertions(+), 2636 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/ChildToDequeueType.java b/wicket-core/src/main/java/org/apache/wicket/ChildToDequeueType.java deleted file mode 100644 index 29cfdfefcf..00 --- a/wicket-core/src/main/java/org/apache/wicket/ChildToDequeueType.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.wicket; - -import org.apache.wicket.markup.html.border.Border; - -public enum ChildToDequeueType -{ - NULL, GENERIC_COMPONENT, MARKUP_CONTAINER, BORDER, QUEUE_REGION; - - public static ChildToDequeueType fromChild(Component child) - { - if (child == null) - { - return NULL; - } - - if (child instanceof Border) - { - return BORDER; - } - - if (child instanceof IQueueRegion) - { - return QUEUE_REGION; - } - - if (child instanceof MarkupContainer) - { - return MARKUP_CONTAINER; - } - - return GENERIC_COMPONENT; - } -} diff --git a/wicket-core/src/main/java/org/apache/wicket/DequeueContext.java b/wicket-core/src/main/java/org/apache/wicket/DequeueContext.java deleted file mode 100644 index 9c431e9310..00 --- a/wicket-core/src/main/java/org/apache/wicket/DequeueContext.java +++ /dev/null @@ -1,301 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limi
[wicket] branch remove-queuing updated (070cb953b9 -> 5a73dd1f7e)
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a change to branch remove-queuing in repository https://gitbox.apache.org/repos/asf/wicket.git discard 070cb953b9 removed queuing add 6513de5bd7 INFRA-22136 Replace bintray.io with apache.jfrog.io add 76866ab2c0 INFRA-22136 Set the Docker image label to LATEST-10 add d6c1659f59 minor changes add f5d1354880 WICKET-6909 Link to Javadoc for 9.x is broken on the website add 90bbe8f00f Fix javadoc errors add 494657d2b7 WICKET-6908 wrap exceptions for log data add 7c0009c8df WICKET-6908 detach all handlers add 270a5a4397 Fix some more javadoc issues. add c66b54ad42 Fix spelling in javadocs add 7ccaf3ba37 Fix a typo in javadoc add 8f8cceaa55 Bump SLF4J to 2.0.0-alpha3 add d22d154ff4 WICKET-6914 Visibility change of "File Upload" via ajax causes "missing" form-data add e1930d22df Simplify JUnit assertions add 47cf4ff8a4 WICKET-6914 Visibility change of "File Upload" via ajax causes "missing" form-data add 866fefc7f8 Explicitly install OpenJDK 11 and Maven add ba2169640c Bump SLF4J to 2.0.0-alpha4 add 8cfffea644 WICKET-6913 Replace CGLib with ByteBuddy (#476) add ac49a29b70 Bump JUnit to 5.8.0-RC1 add 395778f679 WICKET-6913 Interceptor must be public add 1255320863 Update Mockito to 3.12.1 add 8d030d2929 WICKET-6916 replace proxies with StandardMBean add 6238623cc0 Small logging improvements to JMX Initializer add d9275ce6f7 WICKET-6913 move package private add 7fb9fa5bcd WICKET-6913 use pipe add 8939f130ff WICKET-6911 refacture into factories add d48d4a9ac9 Update Mockito to 3.12.4 add e7aeb829dd WICKET-6913 Add generic type to IProxyFactory#createProxy() add d1b17b53b3 INFRA-22281 Test build on ci2.a.o (Buildbot 3.x) add 32c8b9e247 INFRA-22281 Test build on ci2.a.o (Buildbot 3.x) add 5373dc6dc2 INFRA-22046 Test deploying to https://nightlies.apache.org with rsync from GitHub Actions add 39f04b7767 Revert "INFRA-22046 Test deploying to https://nightlies.apache.org with rsync from GitHub Actions" add d09cc01517 Bump SLF4J to 2.0.0-alpha5 add 7ae1c652f6 INFRA-22281 Test build on ci2.a.o (Buildbot 3.x) add f45b97f516 WICKET-6918 Update the version to 10.0.0 add ecafdee1d6 WICKET-6919 Improve EnclosureContainer's javadoc to explain that it should not be used with add f9539f654e WICKET-6920 Improve the examples to use the browser's light/dark mode add 4942df6cda WICKET-6920 Improve the examples to use the browser's light/dark mode add 8366eb38f6 Bump JUnit to 5.8.0 add e8066ac044 Use the ROOT locale when parsing the date in WicketFilterTest add cd297625ad Optimize imports add 9bfb7794d1 WICKET-6921 Avoid updating hidden forms (#478) add 6a7e4c3d77 Update JUnit, maven-javadoc-plugin and maven-war-plugin add c4905848b7 Remove useless javadoc add b6e313ccf9 Bump japicmp to 0.15.4 add 1176afb860 Bump Mockito to 4.0.0 add 7d60d974ee WICKET-6924 Allow image/avif in SecurePackageResourceGuard add 475f5e852e WICKET-6925 Deprecate AbstractWrapModel add cf3715a7ad WICKET-6925 Remove AbstractWrapModel add 740237be90 Bump Jetty to 11.0.7 and Spring to 5.3.11 add 9d74a88d83 WICKET-6927 Get rid of java.security.AccessController add 7c68a150ed JDK 17 is stable since a month add 2e4ddf5621 INFRA-22281 Trigger build add 7f9e289ac4 INFRA-22281 Trigger build add fcec670558 Change wrong 'to determinate' into correct 'to determine' (#480) add f707376088 WICKET-6930: This commit adds: 1) allow to skip sending empty WS messages 2) pass page class as a kind of context that can be used to send a web socket to different pages + example of updating a component in a given page (not dependent on page ID) add d95a3c5262 WICKET-6933 use separate key for the default instance add 191de985e2 Remove 'final' modifier from a static field add 128125f25c Simplify the test for Strings#stripJSessionId() add 210cbe5222 [WICKET-6935] several minor datatable improvements add 858bb2a46d WICKET-6936 allow alternative read and write add 79f74d574b Fix spelling in user guide add 517a546f2d Update ASM, Assertj, ByteBuddy, Logback, Metrics, Mockito and Spring add 17fa392a8c WICKET-6937 Update the keystore used by the quickstart application add 920aa6cb29 WICKET-6937 maven-resources-plugin should not filter the keystore file add e10bc82d00 WICKET-6937 Few more updates of keystore file name add 15e4c015dd WICKET-6937 Fix a comment add 3ea6ff9c7f WICKET-6937 Use JKS keystore add 232ef2170d Update Maven plugins if there are non-Milestone releases add 51cf3c7c56 Specify version for Maven plugins where it was missing add 33a
[wicket] branch wicket-8.x updated: ListenerRequestHandler no longer hides IndexOutOfBoundsException in behavior
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch wicket-8.x in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/wicket-8.x by this push: new 9df46b4cb0 ListenerRequestHandler no longer hides IndexOutOfBoundsException in behavior 9df46b4cb0 is described below commit 9df46b4cb09a564423393d78206c52abd0dfc084 Author: dr0ps AuthorDate: Fri Nov 18 17:35:03 2022 +0100 ListenerRequestHandler no longer hides IndexOutOfBoundsException in behavior --- .../apache/wicket/core/request/handler/ListenerRequestHandler.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/ListenerRequestHandler.java b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/ListenerRequestHandler.java index 91b8b2a768..f9a6aec4ce 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/ListenerRequestHandler.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/ListenerRequestHandler.java @@ -216,16 +216,16 @@ public class ListenerRequestHandler } else { + final Behavior behavior; try { - Behavior behavior = getComponent().getBehaviorById(behaviorId); - invoke(requestCycle, policy, ajax, getComponent(), behavior); + behavior = getComponent().getBehaviorById(behaviorId); } catch (IndexOutOfBoundsException e) { throw new WicketRuntimeException("Couldn't find component behavior.", e); } - + invoke(requestCycle, policy, ajax, getComponent(), behavior); } }
[wicket] branch wicket-9.x updated: ListenerRequestHandler no longer hides IndexOutOfBoundsException in behavior
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch wicket-9.x in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/wicket-9.x by this push: new e92a01108a ListenerRequestHandler no longer hides IndexOutOfBoundsException in behavior e92a01108a is described below commit e92a01108aa1d7667666ea82b617e3414a3a679d Author: dr0ps AuthorDate: Fri Nov 18 17:35:03 2022 +0100 ListenerRequestHandler no longer hides IndexOutOfBoundsException in behavior --- .../apache/wicket/core/request/handler/ListenerRequestHandler.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/ListenerRequestHandler.java b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/ListenerRequestHandler.java index 80d0d5b098..5279cadb56 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/ListenerRequestHandler.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/ListenerRequestHandler.java @@ -210,16 +210,16 @@ public class ListenerRequestHandler } else { + final Behavior behavior; try { - Behavior behavior = getComponent().getBehaviorById(behaviorId); - invoke(requestCycle, policy, ajax, getComponent(), behavior); + behavior = getComponent().getBehaviorById(behaviorId); } catch (IndexOutOfBoundsException e) { throw new WicketRuntimeException("Couldn't find component behavior.", e); } - + invoke(requestCycle, policy, ajax, getComponent(), behavior); } }
[wicket] branch master updated: ListenerRequestHandler no longer hides IndexOutOfBoundsException in behavior
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/master by this push: new 0c4b88e16a ListenerRequestHandler no longer hides IndexOutOfBoundsException in behavior 0c4b88e16a is described below commit 0c4b88e16a3ec7478fbc8f86991c6b07805ed821 Author: dr0ps AuthorDate: Fri Nov 18 17:35:03 2022 +0100 ListenerRequestHandler no longer hides IndexOutOfBoundsException in behavior --- .../apache/wicket/core/request/handler/ListenerRequestHandler.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/ListenerRequestHandler.java b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/ListenerRequestHandler.java index 80d0d5b098..5279cadb56 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/ListenerRequestHandler.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/ListenerRequestHandler.java @@ -210,16 +210,16 @@ public class ListenerRequestHandler } else { + final Behavior behavior; try { - Behavior behavior = getComponent().getBehaviorById(behaviorId); - invoke(requestCycle, policy, ajax, getComponent(), behavior); + behavior = getComponent().getBehaviorById(behaviorId); } catch (IndexOutOfBoundsException e) { throw new WicketRuntimeException("Couldn't find component behavior.", e); } - + invoke(requestCycle, policy, ajax, getComponent(), behavior); } }
[wicket] branch master updated: WICKET-6990 check whether value is rebound
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/master by this push: new 86920872c6 WICKET-6990 check whether value is rebound 86920872c6 is described below commit 86920872c6bdcf62988f7b9271c0674f60da0874 Author: Sven Meier AuthorDate: Mon Jun 20 21:47:24 2022 +0200 WICKET-6990 check whether value is rebound in that case prevent removing all pages --- .../pageStore/AbstractPersistentPageStore.java | 38 ++--- .../pageStore/AbstractPersistentPageStoreTest.java | 93 ++ 2 files changed, 120 insertions(+), 11 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/pageStore/AbstractPersistentPageStore.java b/wicket-core/src/main/java/org/apache/wicket/pageStore/AbstractPersistentPageStore.java index ad294be7a1..0a4cd5dfaf 100644 --- a/wicket-core/src/main/java/org/apache/wicket/pageStore/AbstractPersistentPageStore.java +++ b/wicket-core/src/main/java/org/apache/wicket/pageStore/AbstractPersistentPageStore.java @@ -48,6 +48,14 @@ public abstract class AbstractPersistentPageStore implements IPageStore */ private static final ConcurrentMap STORES = new ConcurrentHashMap<>(); + private static final ThreadLocal gettingSessionAttribute = new ThreadLocal<>() + { + protected Boolean initialValue() + { + return Boolean.FALSE; + } + }; + private final String storeKey; protected AbstractPersistentPageStore(String applicationName) @@ -144,17 +152,22 @@ public abstract class AbstractPersistentPageStore implements IPageStore */ private String getSessionIdentifier(IPageContext context, boolean create) { - String key = KEY_PREFIX + Classes.simpleName(getClass()); - - SessionAttribute attribute = context.getSessionAttribute(key, create ? () -> { - return new SessionAttribute(storeKey, createSessionIdentifier(context)); - } : null); - - if (attribute == null) - { - return null; + gettingSessionAttribute.set(Boolean.TRUE); + try { + String key = KEY_PREFIX + Classes.simpleName(getClass()); + + SessionAttribute attribute = context.getSessionAttribute(key, create ? () -> { + return new SessionAttribute(storeKey, createSessionIdentifier(context)); + } : null); + + if (attribute == null) + { + return null; + } + return attribute.sessionIdentifier; + } finally { + gettingSessionAttribute.set(Boolean.FALSE); } - return attribute.sessionIdentifier; } /** @@ -207,7 +220,10 @@ public abstract class AbstractPersistentPageStore implements IPageStore } else { - store.removeAllPersistedPages(sessionIdentifier); + if (Boolean.FALSE.equals(gettingSessionAttribute.get())) + { + store.removeAllPersistedPages(sessionIdentifier); + } } } } diff --git a/wicket-core/src/test/java/org/apache/wicket/pageStore/AbstractPersistentPageStoreTest.java b/wicket-core/src/test/java/org/apache/wicket/pageStore/AbstractPersistentPageStoreTest.java new file mode 100644 index 00..e74c9ecb18 --- /dev/null +++ b/wicket-core/src/test/java/org/apache/wicket/pageStore/AbstractPersistentPageStoreTest.java @@ -0,0 +1,93 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *
[wicket] branch wicket-9.x updated: WICKET-6990 check whether value is rebound
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch wicket-9.x in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/wicket-9.x by this push: new 18c7c49af3 WICKET-6990 check whether value is rebound 18c7c49af3 is described below commit 18c7c49af31e0c9b89e45cab7ce36555a45d9e47 Author: Sven Meier AuthorDate: Mon Jun 20 21:47:24 2022 +0200 WICKET-6990 check whether value is rebound in that case prevent removing all pages --- .../pageStore/AbstractPersistentPageStore.java | 38 ++--- .../pageStore/AbstractPersistentPageStoreTest.java | 93 ++ 2 files changed, 120 insertions(+), 11 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/pageStore/AbstractPersistentPageStore.java b/wicket-core/src/main/java/org/apache/wicket/pageStore/AbstractPersistentPageStore.java index 15d3104619..ed054282d6 100644 --- a/wicket-core/src/main/java/org/apache/wicket/pageStore/AbstractPersistentPageStore.java +++ b/wicket-core/src/main/java/org/apache/wicket/pageStore/AbstractPersistentPageStore.java @@ -48,6 +48,14 @@ public abstract class AbstractPersistentPageStore implements IPageStore */ private static final ConcurrentMap STORES = new ConcurrentHashMap<>(); + private static final ThreadLocal gettingSessionAttribute = new ThreadLocal<>() + { + protected Boolean initialValue() + { + return Boolean.FALSE; + } + }; + private final String storeKey; protected AbstractPersistentPageStore(String applicationName) @@ -144,17 +152,22 @@ public abstract class AbstractPersistentPageStore implements IPageStore */ private String getSessionIdentifier(IPageContext context, boolean create) { - String key = KEY_PREFIX + Classes.simpleName(getClass()); - - SessionAttribute attribute = context.getSessionAttribute(key, create ? () -> { - return new SessionAttribute(storeKey, createSessionIdentifier(context)); - } : null); - - if (attribute == null) - { - return null; + gettingSessionAttribute.set(Boolean.TRUE); + try { + String key = KEY_PREFIX + Classes.simpleName(getClass()); + + SessionAttribute attribute = context.getSessionAttribute(key, create ? () -> { + return new SessionAttribute(storeKey, createSessionIdentifier(context)); + } : null); + + if (attribute == null) + { + return null; + } + return attribute.sessionIdentifier; + } finally { + gettingSessionAttribute.set(Boolean.FALSE); } - return attribute.sessionIdentifier; } /** @@ -207,7 +220,10 @@ public abstract class AbstractPersistentPageStore implements IPageStore } else { - store.removeAllPersistedPages(sessionIdentifier); + if (Boolean.FALSE.equals(gettingSessionAttribute.get())) + { + store.removeAllPersistedPages(sessionIdentifier); + } } } } diff --git a/wicket-core/src/test/java/org/apache/wicket/pageStore/AbstractPersistentPageStoreTest.java b/wicket-core/src/test/java/org/apache/wicket/pageStore/AbstractPersistentPageStoreTest.java new file mode 100644 index 00..7fb7f17e52 --- /dev/null +++ b/wicket-core/src/test/java/org/apache/wicket/pageStore/AbstractPersistentPageStoreTest.java @@ -0,0 +1,93 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limita
[wicket] branch master updated: WICKET-6981 session attributes have to be reset
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/master by this push: new 197a08f102 WICKET-6981 session attributes have to be reset 197a08f102 is described below commit 197a08f102d520cef1c289e668f6778fd3cfa856 Author: Sven Meier AuthorDate: Tue May 24 23:57:15 2022 +0200 WICKET-6981 session attributes have to be reset whenever it changes --- .../org/apache/wicket/mock/MockPageContext.java| 12 +- .../pageStore/AbstractPersistentPageStore.java | 11 +- .../wicket/pageStore/DefaultPageContext.java | 25 ++-- .../apache/wicket/pageStore/GroupingPageStore.java | 13 +- .../org/apache/wicket/pageStore/IPageContext.java | 8 +- .../wicket/pageStore/InSessionPageStore.java | 13 +- .../wicket/pageStore/AbstractPageStoreTest.java| 8 +- .../wicket/pageStore/DefaultPageContextTest.java | 146 + 8 files changed, 181 insertions(+), 55 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/mock/MockPageContext.java b/wicket-core/src/main/java/org/apache/wicket/mock/MockPageContext.java index 061b3770fd..12619c0b33 100644 --- a/wicket-core/src/main/java/org/apache/wicket/mock/MockPageContext.java +++ b/wicket-core/src/main/java/org/apache/wicket/mock/MockPageContext.java @@ -68,11 +68,9 @@ public class MockPageContext implements IPageContext { @SuppressWarnings("unchecked") T value = (T)sessionAttributes.get(key); - if (value == null) { + if (value == null && defaultValue != null) { value = defaultValue.get(); - if (value != null) { - sessionAttributes.put(key, value); - } + sessionAttributes.put(key, value); } return value; @@ -82,11 +80,9 @@ public class MockPageContext implements IPageContext public T getSessionData(MetaDataKey key, Supplier defaultValue) { T value = key.get(sessionData); - if (value == null) { + if (value == null && defaultValue != null) { value = defaultValue.get(); - if (value != null) { - sessionData = key.set(sessionData, value); - } + sessionData = key.set(sessionData, value); } return value; diff --git a/wicket-core/src/main/java/org/apache/wicket/pageStore/AbstractPersistentPageStore.java b/wicket-core/src/main/java/org/apache/wicket/pageStore/AbstractPersistentPageStore.java index 1c1480dc6b..ad294be7a1 100644 --- a/wicket-core/src/main/java/org/apache/wicket/pageStore/AbstractPersistentPageStore.java +++ b/wicket-core/src/main/java/org/apache/wicket/pageStore/AbstractPersistentPageStore.java @@ -146,14 +146,9 @@ public abstract class AbstractPersistentPageStore implements IPageStore { String key = KEY_PREFIX + Classes.simpleName(getClass()); - SessionAttribute attribute = context.getSessionAttribute(key, () -> { - if (create) - { - return new SessionAttribute(storeKey, createSessionIdentifier(context)); - } - - return null; - }); + SessionAttribute attribute = context.getSessionAttribute(key, create ? () -> { + return new SessionAttribute(storeKey, createSessionIdentifier(context)); + } : null); if (attribute == null) { diff --git a/wicket-core/src/main/java/org/apache/wicket/pageStore/DefaultPageContext.java b/wicket-core/src/main/java/org/apache/wicket/pageStore/DefaultPageContext.java index 780f440fb3..b0012e3f98 100644 --- a/wicket-core/src/main/java/org/apache/wicket/pageStore/DefaultPageContext.java +++ b/wicket-core/src/main/java/org/apache/wicket/pageStore/DefaultPageContext.java @@ -56,12 +56,13 @@ public class DefaultPageContext implements IPageContext synchronized (session) { T value = (T)session.getAttribute(key); - if (value == null) { - value = defaultValue.get(); - if (value != null) { + if (defaultValue != null) { + if (value == null) { + value = defaultValue.get(); session.bind(); -
[wicket] branch wicket-9.x updated: WICKET-6981 session attributes have to be reset
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch wicket-9.x in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/wicket-9.x by this push: new 1d84760b5a WICKET-6981 session attributes have to be reset 1d84760b5a is described below commit 1d84760b5af1c11f991514c42c065c873e9d8493 Author: Sven Meier AuthorDate: Tue May 24 23:57:15 2022 +0200 WICKET-6981 session attributes have to be reset whenever it changes --- .../org/apache/wicket/mock/MockPageContext.java| 12 +- .../pageStore/AbstractPersistentPageStore.java | 11 +- .../wicket/pageStore/DefaultPageContext.java | 25 ++-- .../apache/wicket/pageStore/GroupingPageStore.java | 13 +- .../org/apache/wicket/pageStore/IPageContext.java | 8 +- .../wicket/pageStore/InSessionPageStore.java | 13 +- .../wicket/pageStore/AbstractPageStoreTest.java| 8 +- .../wicket/pageStore/DefaultPageContextTest.java | 146 + 8 files changed, 181 insertions(+), 55 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/mock/MockPageContext.java b/wicket-core/src/main/java/org/apache/wicket/mock/MockPageContext.java index 061b3770fd..12619c0b33 100644 --- a/wicket-core/src/main/java/org/apache/wicket/mock/MockPageContext.java +++ b/wicket-core/src/main/java/org/apache/wicket/mock/MockPageContext.java @@ -68,11 +68,9 @@ public class MockPageContext implements IPageContext { @SuppressWarnings("unchecked") T value = (T)sessionAttributes.get(key); - if (value == null) { + if (value == null && defaultValue != null) { value = defaultValue.get(); - if (value != null) { - sessionAttributes.put(key, value); - } + sessionAttributes.put(key, value); } return value; @@ -82,11 +80,9 @@ public class MockPageContext implements IPageContext public T getSessionData(MetaDataKey key, Supplier defaultValue) { T value = key.get(sessionData); - if (value == null) { + if (value == null && defaultValue != null) { value = defaultValue.get(); - if (value != null) { - sessionData = key.set(sessionData, value); - } + sessionData = key.set(sessionData, value); } return value; diff --git a/wicket-core/src/main/java/org/apache/wicket/pageStore/AbstractPersistentPageStore.java b/wicket-core/src/main/java/org/apache/wicket/pageStore/AbstractPersistentPageStore.java index 74df252c6f..15d3104619 100644 --- a/wicket-core/src/main/java/org/apache/wicket/pageStore/AbstractPersistentPageStore.java +++ b/wicket-core/src/main/java/org/apache/wicket/pageStore/AbstractPersistentPageStore.java @@ -146,14 +146,9 @@ public abstract class AbstractPersistentPageStore implements IPageStore { String key = KEY_PREFIX + Classes.simpleName(getClass()); - SessionAttribute attribute = context.getSessionAttribute(key, () -> { - if (create) - { - return new SessionAttribute(storeKey, createSessionIdentifier(context)); - } - - return null; - }); + SessionAttribute attribute = context.getSessionAttribute(key, create ? () -> { + return new SessionAttribute(storeKey, createSessionIdentifier(context)); + } : null); if (attribute == null) { diff --git a/wicket-core/src/main/java/org/apache/wicket/pageStore/DefaultPageContext.java b/wicket-core/src/main/java/org/apache/wicket/pageStore/DefaultPageContext.java index 780f440fb3..b0012e3f98 100644 --- a/wicket-core/src/main/java/org/apache/wicket/pageStore/DefaultPageContext.java +++ b/wicket-core/src/main/java/org/apache/wicket/pageStore/DefaultPageContext.java @@ -56,12 +56,13 @@ public class DefaultPageContext implements IPageContext synchronized (session) { T value = (T)session.getAttribute(key); - if (value == null) { - value = defaultValue.get(); - if (value != null) { + if (defaultValue != null) { + if (value == null) { + value = defaultValue.get(); session.bind(); -
[wicket] 01/01: WICKET-6981 session attributes have to be reset
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch WICKET-6981-session-attributes-not-set in repository https://gitbox.apache.org/repos/asf/wicket.git commit fbce20096ce143f5ffd81d64b3f315a1dec09e19 Author: Sven Meier AuthorDate: Tue May 24 23:57:15 2022 +0200 WICKET-6981 session attributes have to be reset whenever it changes --- .../org/apache/wicket/mock/MockPageContext.java| 12 +- .../pageStore/AbstractPersistentPageStore.java | 11 +- .../wicket/pageStore/DefaultPageContext.java | 25 ++-- .../apache/wicket/pageStore/GroupingPageStore.java | 13 +- .../org/apache/wicket/pageStore/IPageContext.java | 8 +- .../wicket/pageStore/InSessionPageStore.java | 13 +- .../wicket/pageStore/AbstractPageStoreTest.java| 8 +- .../wicket/pageStore/DefaultPageContextTest.java | 146 + 8 files changed, 181 insertions(+), 55 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/mock/MockPageContext.java b/wicket-core/src/main/java/org/apache/wicket/mock/MockPageContext.java index 061b3770fd..12619c0b33 100644 --- a/wicket-core/src/main/java/org/apache/wicket/mock/MockPageContext.java +++ b/wicket-core/src/main/java/org/apache/wicket/mock/MockPageContext.java @@ -68,11 +68,9 @@ public class MockPageContext implements IPageContext { @SuppressWarnings("unchecked") T value = (T)sessionAttributes.get(key); - if (value == null) { + if (value == null && defaultValue != null) { value = defaultValue.get(); - if (value != null) { - sessionAttributes.put(key, value); - } + sessionAttributes.put(key, value); } return value; @@ -82,11 +80,9 @@ public class MockPageContext implements IPageContext public T getSessionData(MetaDataKey key, Supplier defaultValue) { T value = key.get(sessionData); - if (value == null) { + if (value == null && defaultValue != null) { value = defaultValue.get(); - if (value != null) { - sessionData = key.set(sessionData, value); - } + sessionData = key.set(sessionData, value); } return value; diff --git a/wicket-core/src/main/java/org/apache/wicket/pageStore/AbstractPersistentPageStore.java b/wicket-core/src/main/java/org/apache/wicket/pageStore/AbstractPersistentPageStore.java index 74df252c6f..15d3104619 100644 --- a/wicket-core/src/main/java/org/apache/wicket/pageStore/AbstractPersistentPageStore.java +++ b/wicket-core/src/main/java/org/apache/wicket/pageStore/AbstractPersistentPageStore.java @@ -146,14 +146,9 @@ public abstract class AbstractPersistentPageStore implements IPageStore { String key = KEY_PREFIX + Classes.simpleName(getClass()); - SessionAttribute attribute = context.getSessionAttribute(key, () -> { - if (create) - { - return new SessionAttribute(storeKey, createSessionIdentifier(context)); - } - - return null; - }); + SessionAttribute attribute = context.getSessionAttribute(key, create ? () -> { + return new SessionAttribute(storeKey, createSessionIdentifier(context)); + } : null); if (attribute == null) { diff --git a/wicket-core/src/main/java/org/apache/wicket/pageStore/DefaultPageContext.java b/wicket-core/src/main/java/org/apache/wicket/pageStore/DefaultPageContext.java index 780f440fb3..b0012e3f98 100644 --- a/wicket-core/src/main/java/org/apache/wicket/pageStore/DefaultPageContext.java +++ b/wicket-core/src/main/java/org/apache/wicket/pageStore/DefaultPageContext.java @@ -56,12 +56,13 @@ public class DefaultPageContext implements IPageContext synchronized (session) { T value = (T)session.getAttribute(key); - if (value == null) { - value = defaultValue.get(); - if (value != null) { + if (defaultValue != null) { + if (value == null) { + value = defaultValue.get(); session.bind(); -
[wicket] branch WICKET-6981-session-attributes-not-set updated (95c0639dad -> fbce20096c)
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a change to branch WICKET-6981-session-attributes-not-set in repository https://gitbox.apache.org/repos/asf/wicket.git discard 95c0639dad WICKET-6981 session attributes have to be reset new fbce20096c WICKET-6981 session attributes have to be reset This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (95c0639dad) \ N -- N -- N refs/heads/WICKET-6981-session-attributes-not-set (fbce20096c) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../apache/wicket/pageStore/DefaultPageContextTest.java | 16 1 file changed, 16 insertions(+)
[wicket] branch WICKET-6981-session-attributes-not-set created (now 95c0639dad)
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a change to branch WICKET-6981-session-attributes-not-set in repository https://gitbox.apache.org/repos/asf/wicket.git at 95c0639dad WICKET-6981 session attributes have to be reset This branch includes the following new commits: new 95c0639dad WICKET-6981 session attributes have to be reset The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
[wicket] 01/01: WICKET-6981 session attributes have to be reset
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch WICKET-6981-session-attributes-not-set in repository https://gitbox.apache.org/repos/asf/wicket.git commit 95c0639dade3214390e8e8820d670ed68aa97d7f Author: Sven Meier AuthorDate: Tue May 24 23:57:15 2022 +0200 WICKET-6981 session attributes have to be reset whenever it changes --- .../org/apache/wicket/mock/MockPageContext.java| 12 +- .../pageStore/AbstractPersistentPageStore.java | 11 +- .../wicket/pageStore/DefaultPageContext.java | 25 ++-- .../apache/wicket/pageStore/GroupingPageStore.java | 13 +-- .../org/apache/wicket/pageStore/IPageContext.java | 8 +- .../wicket/pageStore/InSessionPageStore.java | 13 +-- .../wicket/pageStore/AbstractPageStoreTest.java| 8 +- .../wicket/pageStore/DefaultPageContextTest.java | 130 + 8 files changed, 165 insertions(+), 55 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/mock/MockPageContext.java b/wicket-core/src/main/java/org/apache/wicket/mock/MockPageContext.java index 061b3770fd..12619c0b33 100644 --- a/wicket-core/src/main/java/org/apache/wicket/mock/MockPageContext.java +++ b/wicket-core/src/main/java/org/apache/wicket/mock/MockPageContext.java @@ -68,11 +68,9 @@ public class MockPageContext implements IPageContext { @SuppressWarnings("unchecked") T value = (T)sessionAttributes.get(key); - if (value == null) { + if (value == null && defaultValue != null) { value = defaultValue.get(); - if (value != null) { - sessionAttributes.put(key, value); - } + sessionAttributes.put(key, value); } return value; @@ -82,11 +80,9 @@ public class MockPageContext implements IPageContext public T getSessionData(MetaDataKey key, Supplier defaultValue) { T value = key.get(sessionData); - if (value == null) { + if (value == null && defaultValue != null) { value = defaultValue.get(); - if (value != null) { - sessionData = key.set(sessionData, value); - } + sessionData = key.set(sessionData, value); } return value; diff --git a/wicket-core/src/main/java/org/apache/wicket/pageStore/AbstractPersistentPageStore.java b/wicket-core/src/main/java/org/apache/wicket/pageStore/AbstractPersistentPageStore.java index 74df252c6f..15d3104619 100644 --- a/wicket-core/src/main/java/org/apache/wicket/pageStore/AbstractPersistentPageStore.java +++ b/wicket-core/src/main/java/org/apache/wicket/pageStore/AbstractPersistentPageStore.java @@ -146,14 +146,9 @@ public abstract class AbstractPersistentPageStore implements IPageStore { String key = KEY_PREFIX + Classes.simpleName(getClass()); - SessionAttribute attribute = context.getSessionAttribute(key, () -> { - if (create) - { - return new SessionAttribute(storeKey, createSessionIdentifier(context)); - } - - return null; - }); + SessionAttribute attribute = context.getSessionAttribute(key, create ? () -> { + return new SessionAttribute(storeKey, createSessionIdentifier(context)); + } : null); if (attribute == null) { diff --git a/wicket-core/src/main/java/org/apache/wicket/pageStore/DefaultPageContext.java b/wicket-core/src/main/java/org/apache/wicket/pageStore/DefaultPageContext.java index 780f440fb3..b0012e3f98 100644 --- a/wicket-core/src/main/java/org/apache/wicket/pageStore/DefaultPageContext.java +++ b/wicket-core/src/main/java/org/apache/wicket/pageStore/DefaultPageContext.java @@ -56,12 +56,13 @@ public class DefaultPageContext implements IPageContext synchronized (session) { T value = (T)session.getAttribute(key); - if (value == null) { - value = defaultValue.get(); - if (value != null) { + if (defaultValue != null) { + if (value == null) { + value = defaultValue.get(); session.bind(); -
[wicket] branch wicket-9.x updated: WICKET-6966 do not record session size by default
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch wicket-9.x in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/wicket-9.x by this push: new a37fecc WICKET-6966 do not record session size by default a37fecc is described below commit a37fecc1c4302b6895dcd9084b628cc1d65e2bf8 Author: Sven Meier AuthorDate: Fri Apr 1 09:31:38 2022 +0200 WICKET-6966 do not record session size by default if request logging is enabled --- .../main/java/org/apache/wicket/settings/RequestLoggerSettings.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/RequestLoggerSettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/RequestLoggerSettings.java index a62d1a5..112c65e 100644 --- a/wicket-core/src/main/java/org/apache/wicket/settings/RequestLoggerSettings.java +++ b/wicket-core/src/main/java/org/apache/wicket/settings/RequestLoggerSettings.java @@ -28,11 +28,12 @@ package org.apache.wicket.settings; */ public class RequestLoggerSettings { - private boolean recordSessionSize = true; + private boolean requestLoggerEnabled = false; + + private boolean recordSessionSize = false; private int requestsWindowSize = 0; - private boolean requestLoggerEnabled; /** * @return true if the session size is recorded. (default true)
[wicket] branch master updated: WICKET-6966 do not record session size by default
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/master by this push: new 4764ac8 WICKET-6966 do not record session size by default 4764ac8 is described below commit 4764ac8010e34160bb61716ba3dc33cd1468e412 Author: Sven Meier AuthorDate: Fri Apr 1 09:31:38 2022 +0200 WICKET-6966 do not record session size by default if request logging is enabled --- .../main/java/org/apache/wicket/settings/RequestLoggerSettings.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/RequestLoggerSettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/RequestLoggerSettings.java index a62d1a5..112c65e 100644 --- a/wicket-core/src/main/java/org/apache/wicket/settings/RequestLoggerSettings.java +++ b/wicket-core/src/main/java/org/apache/wicket/settings/RequestLoggerSettings.java @@ -28,11 +28,12 @@ package org.apache.wicket.settings; */ public class RequestLoggerSettings { - private boolean recordSessionSize = true; + private boolean requestLoggerEnabled = false; + + private boolean recordSessionSize = false; private int requestsWindowSize = 0; - private boolean requestLoggerEnabled; /** * @return true if the session size is recorded. (default true)
[wicket] branch wicket-9.x updated: WICKET-6953 defer non-ajax only
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch wicket-9.x in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/wicket-9.x by this push: new 7761896 WICKET-6953 defer non-ajax only 7761896 is described below commit 77618961508f7a799c3cb7b40d4a89eed054b0c0 Author: Sven Meier AuthorDate: Wed Feb 2 22:01:55 2022 +0100 WICKET-6953 defer non-ajax only --- .../head/filter/JavaScriptDeferHeaderResponse.java | 33 ++ .../wicket/markup/head/filter/DeferredPage.html| 1 + .../wicket/markup/head/filter/DeferredPage.java| 9 +- .../markup/head/filter/DeferredPageExpected.html | 9 +++--- .../head/filter/DeferredPage_AjaxExpected.html | 18 .../head/filter/FilteringHeaderResponseTest.java | 6 +++- 6 files changed, 52 insertions(+), 24 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/JavaScriptDeferHeaderResponse.java b/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/JavaScriptDeferHeaderResponse.java index c00519f..e0cdacc 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/JavaScriptDeferHeaderResponse.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/JavaScriptDeferHeaderResponse.java @@ -16,6 +16,7 @@ */ package org.apache.wicket.markup.head.filter; +import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.core.util.string.JavaScriptUtils; import org.apache.wicket.markup.head.AbstractJavaScriptReferenceHeaderItem; import org.apache.wicket.markup.head.HeaderItem; @@ -26,8 +27,8 @@ import org.apache.wicket.markup.head.JavaScriptHeaderItem; import org.apache.wicket.markup.head.OnDomReadyHeaderItem; import org.apache.wicket.markup.head.OnLoadHeaderItem; import org.apache.wicket.markup.html.DecoratingHeaderResponse; -import org.apache.wicket.page.PartialPageUpdate; import org.apache.wicket.request.Response; +import org.apache.wicket.request.cycle.RequestCycle; import org.apache.wicket.util.string.Strings; /** @@ -60,18 +61,20 @@ public class JavaScriptDeferHeaderResponse extends DecoratingHeaderResponse @Override public void render(HeaderItem item) { - while (item instanceof IWrappedHeaderItem) { - item = ((IWrappedHeaderItem)item).getWrapped(); - } + if (RequestCycle.get().find(AjaxRequestTarget.class).isEmpty()) { + while (item instanceof IWrappedHeaderItem) { + item = ((IWrappedHeaderItem)item).getWrapped(); + } - if (item instanceof AbstractJavaScriptReferenceHeaderItem) { - ((AbstractJavaScriptReferenceHeaderItem)item).setDefer(true); - } else if (item instanceof JavaScriptContentHeaderItem) { - item = new NativeOnDomContentLoadedHeaderItem(((JavaScriptContentHeaderItem)item).getJavaScript()); - } else if (item instanceof OnDomReadyHeaderItem) { - item = new NativeOnDomContentLoadedHeaderItem(((OnDomReadyHeaderItem)item).getJavaScript()); - } else if (item instanceof OnLoadHeaderItem) { - item = new NativeOnLoadHeaderItem(((OnLoadHeaderItem)item).getJavaScript()); + if (item instanceof AbstractJavaScriptReferenceHeaderItem) { + ((AbstractJavaScriptReferenceHeaderItem)item).setDefer(true); + } else if (item instanceof JavaScriptContentHeaderItem) { + item = new NativeOnDomContentLoadedHeaderItem(((JavaScriptContentHeaderItem)item).getJavaScript()); + } else if (item instanceof OnDomReadyHeaderItem) { + item = new NativeOnDomContentLoadedHeaderItem(((OnDomReadyHeaderItem)item).getJavaScript()); + } else if (item instanceof OnLoadHeaderItem) { + item = new NativeOnLoadHeaderItem(((OnLoadHeaderItem)item).getJavaScript()); + } } super.render(item); @@ -79,9 +82,6 @@ public class JavaScriptDeferHeaderResponse extends DecoratingHeaderResponse /** * A specialization that uses native "DOMContentLoaded" events without dependency to external JavaScript. -* -* For Ajax requests we utilize the fact, that {@link PartialPageUpdate} renders {@link #getJavaScript()} only, -* thus executing the JavaScript directly without any event registration. */ private static class NativeOnDomContentLoadedHeaderItem extends OnDomReadyHeaderItem { @@ -113,9 +113,6 @@ public class JavaScriptDeferHeaderResponse extends DecoratingHead
[wicket] branch master updated: WICKET-6953 defer non-ajax only
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/master by this push: new c6fde82 WICKET-6953 defer non-ajax only c6fde82 is described below commit c6fde82ce9637c43753b59620b2f5551ad7f20fe Author: Sven Meier AuthorDate: Wed Feb 2 22:01:55 2022 +0100 WICKET-6953 defer non-ajax only --- .../head/filter/JavaScriptDeferHeaderResponse.java | 33 ++ .../wicket/markup/head/filter/DeferredPage.html| 1 + .../wicket/markup/head/filter/DeferredPage.java| 9 +- .../markup/head/filter/DeferredPageExpected.html | 9 +++--- .../head/filter/DeferredPage_AjaxExpected.html | 18 .../head/filter/FilteringHeaderResponseTest.java | 6 +++- 6 files changed, 52 insertions(+), 24 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/JavaScriptDeferHeaderResponse.java b/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/JavaScriptDeferHeaderResponse.java index c00519f..e0cdacc 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/JavaScriptDeferHeaderResponse.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/JavaScriptDeferHeaderResponse.java @@ -16,6 +16,7 @@ */ package org.apache.wicket.markup.head.filter; +import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.core.util.string.JavaScriptUtils; import org.apache.wicket.markup.head.AbstractJavaScriptReferenceHeaderItem; import org.apache.wicket.markup.head.HeaderItem; @@ -26,8 +27,8 @@ import org.apache.wicket.markup.head.JavaScriptHeaderItem; import org.apache.wicket.markup.head.OnDomReadyHeaderItem; import org.apache.wicket.markup.head.OnLoadHeaderItem; import org.apache.wicket.markup.html.DecoratingHeaderResponse; -import org.apache.wicket.page.PartialPageUpdate; import org.apache.wicket.request.Response; +import org.apache.wicket.request.cycle.RequestCycle; import org.apache.wicket.util.string.Strings; /** @@ -60,18 +61,20 @@ public class JavaScriptDeferHeaderResponse extends DecoratingHeaderResponse @Override public void render(HeaderItem item) { - while (item instanceof IWrappedHeaderItem) { - item = ((IWrappedHeaderItem)item).getWrapped(); - } + if (RequestCycle.get().find(AjaxRequestTarget.class).isEmpty()) { + while (item instanceof IWrappedHeaderItem) { + item = ((IWrappedHeaderItem)item).getWrapped(); + } - if (item instanceof AbstractJavaScriptReferenceHeaderItem) { - ((AbstractJavaScriptReferenceHeaderItem)item).setDefer(true); - } else if (item instanceof JavaScriptContentHeaderItem) { - item = new NativeOnDomContentLoadedHeaderItem(((JavaScriptContentHeaderItem)item).getJavaScript()); - } else if (item instanceof OnDomReadyHeaderItem) { - item = new NativeOnDomContentLoadedHeaderItem(((OnDomReadyHeaderItem)item).getJavaScript()); - } else if (item instanceof OnLoadHeaderItem) { - item = new NativeOnLoadHeaderItem(((OnLoadHeaderItem)item).getJavaScript()); + if (item instanceof AbstractJavaScriptReferenceHeaderItem) { + ((AbstractJavaScriptReferenceHeaderItem)item).setDefer(true); + } else if (item instanceof JavaScriptContentHeaderItem) { + item = new NativeOnDomContentLoadedHeaderItem(((JavaScriptContentHeaderItem)item).getJavaScript()); + } else if (item instanceof OnDomReadyHeaderItem) { + item = new NativeOnDomContentLoadedHeaderItem(((OnDomReadyHeaderItem)item).getJavaScript()); + } else if (item instanceof OnLoadHeaderItem) { + item = new NativeOnLoadHeaderItem(((OnLoadHeaderItem)item).getJavaScript()); + } } super.render(item); @@ -79,9 +82,6 @@ public class JavaScriptDeferHeaderResponse extends DecoratingHeaderResponse /** * A specialization that uses native "DOMContentLoaded" events without dependency to external JavaScript. -* -* For Ajax requests we utilize the fact, that {@link PartialPageUpdate} renders {@link #getJavaScript()} only, -* thus executing the JavaScript directly without any event registration. */ private static class NativeOnDomContentLoadedHeaderItem extends OnDomReadyHeaderItem { @@ -113,9 +113,6 @@ public class JavaScriptDeferHeaderResponse extends DecoratingHead
[wicket] branch wicket-9.x updated: WICKET-6946 Document limitations of overriding isVisible/isEnabled
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch wicket-9.x in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/wicket-9.x by this push: new 860c803 WICKET-6946 Document limitations of overriding isVisible/isEnabled 860c803 is described below commit 860c803ba287b71c76a9096b3d2f8109ad694248 Author: Mathieu Mitchell AuthorDate: Tue Jan 18 20:22:28 2022 -0500 WICKET-6946 Document limitations of overriding isVisible/isEnabled --- .../asciidoc/bestpractices/bestpractices_1.adoc| 2 +- .../asciidoc/bestpractices/bestpractices_4.adoc| 6 +++-- .../asciidoc/bestpractices/bestpractices_5.adoc| 31 +++--- .../asciidoc/bestpractices/bestpractices_6.adoc| 2 +- .../main/asciidoc/keepControl/keepControl_1.adoc | 6 +++-- 5 files changed, 32 insertions(+), 15 deletions(-) diff --git a/wicket-user-guide/src/main/asciidoc/bestpractices/bestpractices_1.adoc b/wicket-user-guide/src/main/asciidoc/bestpractices/bestpractices_1.adoc index 1124afd..308c1cf 100644 --- a/wicket-user-guide/src/main/asciidoc/bestpractices/bestpractices_1.adoc +++ b/wicket-user-guide/src/main/asciidoc/bestpractices/bestpractices_1.adoc @@ -64,7 +64,7 @@ The code above shows the usage of the poor component in the _RegistrationPage_. public class RegistrationInputPanel extends Panel{ public RegistrationInputPanel(String id, IModel regModel) { super(id, regModel); -IModel compound = new CompoundPropertyModel compound = new CompoundPropertyModel(regmodel); Form form = new Form("form", compound); // Correct: Add components to Form over the instance variable form.add(new TextField("username")); diff --git a/wicket-user-guide/src/main/asciidoc/bestpractices/bestpractices_4.adoc b/wicket-user-guide/src/main/asciidoc/bestpractices/bestpractices_4.adoc index 122e42f..f3b2635 100644 --- a/wicket-user-guide/src/main/asciidoc/bestpractices/bestpractices_4.adoc +++ b/wicket-user-guide/src/main/asciidoc/bestpractices/bestpractices_4.adoc @@ -1,7 +1,9 @@ -You should consider Wicket's component tree a constant and fixed skeleton which gets revived when its model is filled with data like a robot without brain. Without brain the robot is not able to do anything and is just a dead and fixed skeleton. However, when you fill it with data, it becomes alive and can act. There is no need for changing hardware when filling him with data. In Wicket, you should manipulate the component tree as little as possible. Consequently, you should avoid callin [...] +You should consider the component tree as a constant and fixed skeleton which gets revived when its model is filled with data like a robot without brain. Without brain the robot is not able to do anything and is just a dead and fixed skeleton. However, when you fill it with data, it becomes alive and can act. There is no need for changing hardware when filling it with data. + +In Wicket, you should manipulate the component tree as little as possible. Consequently, you should avoid calling methods like _Component.replace(Component)_ and _Component.remove(Component)_. Calling these methods indicates missing usage or misusage of Wicket's models. Furthermore the component trees should not be constructed using conditions (see listing 5). This reduces the possibility of reusing the same instance significantly. *Listing 5:* @@ -16,4 +18,4 @@ else { } -Instead of constructing _LoginBoxPanel_ conditionally, it is recommended to always add the panel and control the visibility by overriding _isVisible()_. So the component _LoginBoxPanel_ is responsible for displaying itself. We move the responsibility into the same component which executes the login. Brilliant! Cleanly encapsulated business logic. There is no decision from outside, the component handles all the logic. You can see another example in "Implement visibilities of components c [...] +Instead of constructing _LoginBoxPanel_ conditionally, it is recommended to always add the panel and set the visibility within _onConfigure()_. So the component _LoginBoxPanel_ is responsible for displaying itself. We move the responsibility into the same component which executes the login. Brilliant! Cleanly encapsulated business logic. There is no decision from outside, the component handles all the logic. You can see another example in "Implement visibilities of components correctly" . diff --git a/wicket-user-guide/src/main/asciidoc/bestpractices/bestpractices_5.adoc b/wicket-user-guide/src/main/asciidoc/bestpractices/bestpractices_5.adoc index ecd0095..31e297a 100644 --- a/wicket-user-guide/src/main/asciidoc/bestpractices/bestpractices_5.adoc +++ b/wicket-user-guide/src/main/asciidoc/bestpractices/bestpractices_5.adoc @@ -13,7 +13,13 @@ loginBox.setVisible(My
[wicket] branch master updated: WICKET-6946 Document limitations of overriding isVisible/isEnabled
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/master by this push: new b543a1e WICKET-6946 Document limitations of overriding isVisible/isEnabled b543a1e is described below commit b543a1eef47dfb451c9a4b255c829e8fb89e757d Author: Mathieu Mitchell AuthorDate: Tue Jan 18 20:22:28 2022 -0500 WICKET-6946 Document limitations of overriding isVisible/isEnabled --- .../asciidoc/bestpractices/bestpractices_1.adoc| 2 +- .../asciidoc/bestpractices/bestpractices_4.adoc| 6 +++-- .../asciidoc/bestpractices/bestpractices_5.adoc| 31 +++--- .../asciidoc/bestpractices/bestpractices_6.adoc| 2 +- .../main/asciidoc/keepControl/keepControl_1.adoc | 6 +++-- 5 files changed, 32 insertions(+), 15 deletions(-) diff --git a/wicket-user-guide/src/main/asciidoc/bestpractices/bestpractices_1.adoc b/wicket-user-guide/src/main/asciidoc/bestpractices/bestpractices_1.adoc index 1124afd..308c1cf 100644 --- a/wicket-user-guide/src/main/asciidoc/bestpractices/bestpractices_1.adoc +++ b/wicket-user-guide/src/main/asciidoc/bestpractices/bestpractices_1.adoc @@ -64,7 +64,7 @@ The code above shows the usage of the poor component in the _RegistrationPage_. public class RegistrationInputPanel extends Panel{ public RegistrationInputPanel(String id, IModel regModel) { super(id, regModel); -IModel compound = new CompoundPropertyModel compound = new CompoundPropertyModel(regmodel); Form form = new Form("form", compound); // Correct: Add components to Form over the instance variable form.add(new TextField("username")); diff --git a/wicket-user-guide/src/main/asciidoc/bestpractices/bestpractices_4.adoc b/wicket-user-guide/src/main/asciidoc/bestpractices/bestpractices_4.adoc index 122e42f..f3b2635 100644 --- a/wicket-user-guide/src/main/asciidoc/bestpractices/bestpractices_4.adoc +++ b/wicket-user-guide/src/main/asciidoc/bestpractices/bestpractices_4.adoc @@ -1,7 +1,9 @@ -You should consider Wicket's component tree a constant and fixed skeleton which gets revived when its model is filled with data like a robot without brain. Without brain the robot is not able to do anything and is just a dead and fixed skeleton. However, when you fill it with data, it becomes alive and can act. There is no need for changing hardware when filling him with data. In Wicket, you should manipulate the component tree as little as possible. Consequently, you should avoid callin [...] +You should consider the component tree as a constant and fixed skeleton which gets revived when its model is filled with data like a robot without brain. Without brain the robot is not able to do anything and is just a dead and fixed skeleton. However, when you fill it with data, it becomes alive and can act. There is no need for changing hardware when filling it with data. + +In Wicket, you should manipulate the component tree as little as possible. Consequently, you should avoid calling methods like _Component.replace(Component)_ and _Component.remove(Component)_. Calling these methods indicates missing usage or misusage of Wicket's models. Furthermore the component trees should not be constructed using conditions (see listing 5). This reduces the possibility of reusing the same instance significantly. *Listing 5:* @@ -16,4 +18,4 @@ else { } -Instead of constructing _LoginBoxPanel_ conditionally, it is recommended to always add the panel and control the visibility by overriding _isVisible()_. So the component _LoginBoxPanel_ is responsible for displaying itself. We move the responsibility into the same component which executes the login. Brilliant! Cleanly encapsulated business logic. There is no decision from outside, the component handles all the logic. You can see another example in "Implement visibilities of components c [...] +Instead of constructing _LoginBoxPanel_ conditionally, it is recommended to always add the panel and set the visibility within _onConfigure()_. So the component _LoginBoxPanel_ is responsible for displaying itself. We move the responsibility into the same component which executes the login. Brilliant! Cleanly encapsulated business logic. There is no decision from outside, the component handles all the logic. You can see another example in "Implement visibilities of components correctly" . diff --git a/wicket-user-guide/src/main/asciidoc/bestpractices/bestpractices_5.adoc b/wicket-user-guide/src/main/asciidoc/bestpractices/bestpractices_5.adoc index ecd0095..31e297a 100644 --- a/wicket-user-guide/src/main/asciidoc/bestpractices/bestpractices_5.adoc +++ b/wicket-user-guide/src/main/asciidoc/bestpractices/bestpractices_5.adoc @@ -13,7 +13,13 @@ loginBox.setVisible(MySession.get().isNotLo
[wicket] branch master updated: WICKET-6936 allow alternative read and write
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/master by this push: new 858bb2a WICKET-6936 allow alternative read and write 858bb2a is described below commit 858bb2a46df1a43378dd2a762614c309e6707e07 Author: Sven Meier AuthorDate: Mon Nov 22 20:43:50 2021 +0100 WICKET-6936 allow alternative read and write --- .../org/apache/wicket/pageStore/FilePageStore.java | 114 - .../apache/wicket/pageStore/FilePageStoreTest.java | 1 - 2 files changed, 68 insertions(+), 47 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/pageStore/FilePageStore.java b/wicket-core/src/main/java/org/apache/wicket/pageStore/FilePageStore.java index 4462b1b..38a8d0a 100644 --- a/wicket-core/src/main/java/org/apache/wicket/pageStore/FilePageStore.java +++ b/wicket-core/src/main/java/org/apache/wicket/pageStore/FilePageStore.java @@ -102,43 +102,50 @@ public class FilePageStore extends AbstractPersistentPageStore implements IPersi @Override protected IManageablePage getPersistedPage(String sessionIdentifier, int id) { - byte[] data = readFile(sessionIdentifier, id); - if (data == null) + File file = getPageFile(sessionIdentifier, id, false); + if (file.exists() == false) { return null; } - - return new SerializedPage(id, "unknown", data); - } - private byte[] readFile(String sessionIdentifier, int id) - { - File file = getPageFile(sessionIdentifier, id, false); - if (file.exists() == false) + byte[] data; + try + { + data = readFile(file); + } + catch (IOException ex) { + log.warn("cannot read page data for session {} page {}", sessionIdentifier, id, ex); return null; } - byte[] data = null; + return new SerializedPage(id, "unknown", data); + } + + /** +* Read a file. +* +* Note: This implementation uses a {@link FileChannel}. +* +* @param file +*file to read +* @throws IOException +*/ + protected byte[] readFile(File file) throws IOException + { + byte[] data; + FileChannel channel = FileChannel.open(file.toPath()); try { - FileChannel channel = FileChannel.open(file.toPath()); - try - { - int size = (int)channel.size(); - MappedByteBuffer buf = channel.map(MapMode.READ_ONLY, 0, size); - data = new byte[size]; - buf.get(data); - } - finally - { - IOUtils.closeQuietly(channel); - } + int size = (int)channel.size(); + MappedByteBuffer buf = channel.map(MapMode.READ_ONLY, 0, size); + data = new byte[size]; + buf.get(data); } - catch (IOException ex) + finally { - log.warn("cannot read page data for session {} page {}", sessionIdentifier, id, ex); + IOUtils.closeQuietly(channel); } return data; @@ -170,39 +177,54 @@ public class FilePageStore extends AbstractPersistentPageStore implements IPersi { throw new WicketRuntimeException("FilePageStore works with serialized pages only"); } - SerializedPage serializedPage = (SerializedPage) page; + SerializedPage serializedPage = (SerializedPage)page; - String type = serializedPage.getPageType(); byte[] data = serializedPage.getData(); - writeFile(sessionIdentifier, serializedPage.getPageId(), type, data); + File file = getPageFile(sessionIdentifier, serializedPage.getPageId(), true); + try + { + writeFile(file, data); + } + catch (IOException ex) + { + log.warn("cannot store page data for session {} page {}", sessionIdentifier, + serializedPage.getPageId(), ex); + } + + setPageType(file, s
[wicket] branch wicket-9.x updated: WICKET-6936 allow alternative read and write
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch wicket-9.x in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/wicket-9.x by this push: new e7dc93b WICKET-6936 allow alternative read and write e7dc93b is described below commit e7dc93b4997faaba9cdbe49399ff856e00f8b0c5 Author: Sven Meier AuthorDate: Mon Nov 22 20:43:50 2021 +0100 WICKET-6936 allow alternative read and write --- .../org/apache/wicket/pageStore/FilePageStore.java | 114 - .../apache/wicket/pageStore/FilePageStoreTest.java | 1 - 2 files changed, 68 insertions(+), 47 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/pageStore/FilePageStore.java b/wicket-core/src/main/java/org/apache/wicket/pageStore/FilePageStore.java index 4462b1b..38a8d0a 100644 --- a/wicket-core/src/main/java/org/apache/wicket/pageStore/FilePageStore.java +++ b/wicket-core/src/main/java/org/apache/wicket/pageStore/FilePageStore.java @@ -102,43 +102,50 @@ public class FilePageStore extends AbstractPersistentPageStore implements IPersi @Override protected IManageablePage getPersistedPage(String sessionIdentifier, int id) { - byte[] data = readFile(sessionIdentifier, id); - if (data == null) + File file = getPageFile(sessionIdentifier, id, false); + if (file.exists() == false) { return null; } - - return new SerializedPage(id, "unknown", data); - } - private byte[] readFile(String sessionIdentifier, int id) - { - File file = getPageFile(sessionIdentifier, id, false); - if (file.exists() == false) + byte[] data; + try + { + data = readFile(file); + } + catch (IOException ex) { + log.warn("cannot read page data for session {} page {}", sessionIdentifier, id, ex); return null; } - byte[] data = null; + return new SerializedPage(id, "unknown", data); + } + + /** +* Read a file. +* +* Note: This implementation uses a {@link FileChannel}. +* +* @param file +*file to read +* @throws IOException +*/ + protected byte[] readFile(File file) throws IOException + { + byte[] data; + FileChannel channel = FileChannel.open(file.toPath()); try { - FileChannel channel = FileChannel.open(file.toPath()); - try - { - int size = (int)channel.size(); - MappedByteBuffer buf = channel.map(MapMode.READ_ONLY, 0, size); - data = new byte[size]; - buf.get(data); - } - finally - { - IOUtils.closeQuietly(channel); - } + int size = (int)channel.size(); + MappedByteBuffer buf = channel.map(MapMode.READ_ONLY, 0, size); + data = new byte[size]; + buf.get(data); } - catch (IOException ex) + finally { - log.warn("cannot read page data for session {} page {}", sessionIdentifier, id, ex); + IOUtils.closeQuietly(channel); } return data; @@ -170,39 +177,54 @@ public class FilePageStore extends AbstractPersistentPageStore implements IPersi { throw new WicketRuntimeException("FilePageStore works with serialized pages only"); } - SerializedPage serializedPage = (SerializedPage) page; + SerializedPage serializedPage = (SerializedPage)page; - String type = serializedPage.getPageType(); byte[] data = serializedPage.getData(); - writeFile(sessionIdentifier, serializedPage.getPageId(), type, data); + File file = getPageFile(sessionIdentifier, serializedPage.getPageId(), true); + try + { + writeFile(file, data); + } + catch (IOException ex) + { + log.warn("cannot store page data for session {} page {}", sessionIdentifier, + serializedPage.getPageId(), ex); + } + + setPageType(file, s
[wicket] branch wicket-9.x updated: WICKET-6933 use separate key for the default instance
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch wicket-9.x in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/wicket-9.x by this push: new 76a28ef WICKET-6933 use separate key for the default instance 76a28ef is described below commit 76a28ef384a07c9afa738a6b53897847e0a95f87 Author: Sven Meier AuthorDate: Wed Nov 10 22:11:55 2021 +0100 WICKET-6933 use separate key for the default instance --- .../apache/wicket/DefaultPageManagerProvider.java | 25 +- .../wicket/pageStore/InSessionPageStore.java | 5 ++--- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/DefaultPageManagerProvider.java b/wicket-core/src/main/java/org/apache/wicket/DefaultPageManagerProvider.java index 0b44073..11eeff1 100644 --- a/wicket-core/src/main/java/org/apache/wicket/DefaultPageManagerProvider.java +++ b/wicket-core/src/main/java/org/apache/wicket/DefaultPageManagerProvider.java @@ -147,7 +147,7 @@ public class DefaultPageManagerProvider implements IPageManagerProvider */ protected IPageStore newCachingStore(IPageStore pageStore) { - return new CachingPageStore(pageStore, new InSessionPageStore(1)); + return new CachingPageStore(pageStore, new InSessionCache()); } /** @@ -210,4 +210,27 @@ public class DefaultPageManagerProvider implements IPageManagerProvider return new DiskPageStore(application.getName(), fileStoreFolder, maxSizePerSession); } + + private static class InSessionCache extends InSessionPageStore { + + private static final MetaDataKey KEY = new MetaDataKey<>() + { + private static final long serialVersionUID = 1L; + }; + + InSessionCache() + { + super(1); + } + + /** +* Use a separate key, so this store does not interfere with any additional {@link InSessionPageStore} +* the application might set up. +*/ + @Override + protected MetaDataKey getKey() + { + return KEY; + } + } } \ No newline at end of file diff --git a/wicket-core/src/main/java/org/apache/wicket/pageStore/InSessionPageStore.java b/wicket-core/src/main/java/org/apache/wicket/pageStore/InSessionPageStore.java index 5aaf563..d2b3653 100644 --- a/wicket-core/src/main/java/org/apache/wicket/pageStore/InSessionPageStore.java +++ b/wicket-core/src/main/java/org/apache/wicket/pageStore/InSessionPageStore.java @@ -172,9 +172,8 @@ public class InSessionPageStore implements IPageStore /** * Session data is stored under a {@link MetaDataKey}. * -* In cases where more than one instance is used in an application (e.g. as a fast cache -* and a persistent store of serialized pages in the session), this method has to be -* overridden to provide a separate key for each instance. +* In the unlikely case that an application utilizes more than one instance of this store, +* this method has to be overridden to provide a separate key for each instance. */ protected MetaDataKey getKey() {
[wicket] branch master updated: WICKET-6933 use separate key for the default instance
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/master by this push: new d95a3c5 WICKET-6933 use separate key for the default instance d95a3c5 is described below commit d95a3c526229092ecc035ca3e901f5d9a7d4e1c2 Author: Sven Meier AuthorDate: Wed Nov 10 22:11:55 2021 +0100 WICKET-6933 use separate key for the default instance --- .../apache/wicket/DefaultPageManagerProvider.java | 25 +- .../wicket/pageStore/InSessionPageStore.java | 5 ++--- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/DefaultPageManagerProvider.java b/wicket-core/src/main/java/org/apache/wicket/DefaultPageManagerProvider.java index 0b44073..11eeff1 100644 --- a/wicket-core/src/main/java/org/apache/wicket/DefaultPageManagerProvider.java +++ b/wicket-core/src/main/java/org/apache/wicket/DefaultPageManagerProvider.java @@ -147,7 +147,7 @@ public class DefaultPageManagerProvider implements IPageManagerProvider */ protected IPageStore newCachingStore(IPageStore pageStore) { - return new CachingPageStore(pageStore, new InSessionPageStore(1)); + return new CachingPageStore(pageStore, new InSessionCache()); } /** @@ -210,4 +210,27 @@ public class DefaultPageManagerProvider implements IPageManagerProvider return new DiskPageStore(application.getName(), fileStoreFolder, maxSizePerSession); } + + private static class InSessionCache extends InSessionPageStore { + + private static final MetaDataKey KEY = new MetaDataKey<>() + { + private static final long serialVersionUID = 1L; + }; + + InSessionCache() + { + super(1); + } + + /** +* Use a separate key, so this store does not interfere with any additional {@link InSessionPageStore} +* the application might set up. +*/ + @Override + protected MetaDataKey getKey() + { + return KEY; + } + } } \ No newline at end of file diff --git a/wicket-core/src/main/java/org/apache/wicket/pageStore/InSessionPageStore.java b/wicket-core/src/main/java/org/apache/wicket/pageStore/InSessionPageStore.java index af0fae8..50ae0af 100644 --- a/wicket-core/src/main/java/org/apache/wicket/pageStore/InSessionPageStore.java +++ b/wicket-core/src/main/java/org/apache/wicket/pageStore/InSessionPageStore.java @@ -172,9 +172,8 @@ public class InSessionPageStore implements IPageStore /** * Session data is stored under a {@link MetaDataKey}. * -* In cases where more than one instance is used in an application (e.g. as a fast cache -* and a persistent store of serialized pages in the session), this method has to be -* overridden to provide a separate key for each instance. +* In the unlikely case that an application utilizes more than one instance of this store, +* this method has to be overridden to provide a separate key for each instance. */ protected MetaDataKey getKey() {
[wicket] branch wicket-9.x updated: WICKET-6913 backport bytebuddy and objenesis improvements
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch wicket-9.x in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/wicket-9.x by this push: new 5892a60 WICKET-6913 backport bytebuddy and objenesis improvements 5892a60 is described below commit 5892a6009ac6933c36062ab1f2264ba11dbfcc1b Author: Sven Meier AuthorDate: Mon Aug 23 15:02:31 2021 +0200 WICKET-6913 backport bytebuddy and objenesis improvements to wicket-9.x --- NOTICE | 7 +- README.md | 3 +- pom.xml| 6 + wicket-examples/src/main/resources/META-INF/NOTICE | 9 +- wicket-ioc/pom.xml | 6 +- wicket-ioc/src/main/java/module-info.java | 2 + .../apache/wicket/proxy/IProxyFactory.java}| 25 +- .../apache/wicket/proxy/LazyInitProxyFactory.java | 327 - .../proxy/bytebuddy/ByteBuddyInterceptor.java | 112 +++ .../proxy/bytebuddy/ByteBuddyProxyFactory.java | 211 + .../wicket/proxy/cglib/CglibProxyFactory.java | 186 .../apache/wicket/proxy/jdk/JdkProxyFactory.java | 196 ...sisCGLibInterceptor.java => IInstantiator.java} | 39 ++- .../proxy/objenesis/ObjenesisCGLibInterceptor.java | 12 +- .../proxy/objenesis/ObjenesisInstantiator.java}| 23 +- .../proxy/objenesis/ObjenesisProxyFactory.java | 30 +- .../proxy/objenesis/ObjenesisProxyReplacement.java | 55 .../wicket/injection/util/MockDependency.java | 5 +- .../wicket/proxy/LazyInitProxyFactoryTest.java | 65 ++-- .../wicket/proxy/util/NoDefaultConstructor.java} | 17 +- .../annot/SpringBeanWithGenericsTest.java | 2 +- wicket-user-guide/src/main/asciidoc/jee/jee_4.adoc | 16 + 22 files changed, 931 insertions(+), 423 deletions(-) diff --git a/NOTICE b/NOTICE index 3e462db..bc97306 100644 --- a/NOTICE +++ b/NOTICE @@ -56,8 +56,11 @@ src/./wicket-examples This product includes software developed by the CGLib Project (http://cglib.sourceforge.net). - This product includes ASM, released under a BSD style license (http://asm.objectweb.org). - Copyright (c) 2000-2005 INRIA, France Telecom + This product includes ASM, released under a BSD style license (https://asm.ow2.io/). + Copyright (c) 2000-2011 INRIA, France Telecom + + This product includes software developed by the ByteBuddy Project + (https://bytebuddy.net/). This product includes jhighlight (https://jhighlight.dev.java.net/) which is released under CDDL 1.0 license (http://www.opensource.org/licenses/cddl1.php). diff --git a/README.md b/README.md index 01e9982..8faa041 100644 --- a/README.md +++ b/README.md @@ -159,7 +159,8 @@ the src/ folder. - wicket-ioc: cglib 3.1 (http://cglib.sourceforge.net/) and -asm-util 5.0.3 (http://asm.objectweb.org/) +asm-util 9.1 (https://asm.ow2.io/) +byte-buddy 1.11.12 (https://bytebuddy.net/) and - wicket-spring: diff --git a/pom.xml b/pom.xml index b4cbc76..589c2a8 100644 --- a/pom.xml +++ b/pom.xml @@ -139,6 +139,7 @@ 3.19.0 4.1.0 3.3.0 + 1.11.12 3.2.2 4.4 1.4 @@ -321,6 +322,11 @@ true + net.bytebuddy + byte-buddy + ${byte-buddy.version} + + org.apache.commons commons-collections4 ${commons-collections4.version} diff --git a/wicket-examples/src/main/resources/META-INF/NOTICE b/wicket-examples/src/main/resources/META-INF/NOTICE index 619dd91..3598cb3 100644 --- a/wicket-examples/src/main/resources/META-INF/NOTICE +++ b/wicket-examples/src/main/resources/META-INF/NOTICE @@ -29,8 +29,11 @@ This product includes software developed by the CGLib Project (http://cglib.sourceforge.net). - This product includes ASM, released under a BSD style license (http://asm.objectweb.org). - Copyright (c) 2000-2005 INRIA, France Telecom + This product includes ASM, released under a BSD style license (https://asm.ow2.io/). + Copyright (c) 2000-2011 INRIA, France Telecom + + This product includes software developed by the ByteBuddy Project + (https://bytebuddy.net/). This product includes jhighlight (https://jhighlight.dev.java.net/) which is released under CDDL 1.0 license (http://www.opensource.org/licenses/cddl1.php). @@ -42,4 +45,4 @@ jQuery Foundation, Inc, http://jquery.org/license Contains qunit.css released under a MIT style license. - jQuery Foundation,
[wicket] branch master updated: WICKET-6911 refacture into factories
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/master by this push: new 8939f13 WICKET-6911 refacture into factories 8939f13 is described below commit 8939f130ffcb3d468aef060b7bcf000499510c4f Author: Sven Meier AuthorDate: Fri Aug 27 21:06:02 2021 +0200 WICKET-6911 refacture into factories so it is easier to backport Byte Buddy (WICKET-6913); remove code duplication with objenesis, improved detection, added hint to exception and improvement to user-guide --- wicket-ioc/src/main/java/module-info.java | 1 - .../apache/wicket/proxy/IProxyFactory.java}| 25 +- .../apache/wicket/proxy/LazyInitProxyFactory.java | 392 + .../proxy/bytebuddy/ByteBuddyInterceptor.java | 112 ++ .../proxy/bytebuddy/ByteBuddyProxyFactory.java | 211 +++ .../apache/wicket/proxy/jdk/JdkProxyFactory.java | 196 +++ ...yteBuddyInterceptor.java => IInstantiator.java} | 39 +- ...roxyFactory.java => ObjenesisInstantiator.java} | 21 +- .../proxy/objenesis/ObjenesisProxyReplacement.java | 55 --- .../wicket/proxy/LazyInitProxyFactoryTest.java | 28 +- .../wicket/proxy/util/NoDefaultConstructor.java} | 17 +- wicket-user-guide/src/main/asciidoc/jee/jee_4.adoc | 7 + 12 files changed, 627 insertions(+), 477 deletions(-) diff --git a/wicket-ioc/src/main/java/module-info.java b/wicket-ioc/src/main/java/module-info.java index b9814fe..f0ca78b 100644 --- a/wicket-ioc/src/main/java/module-info.java +++ b/wicket-ioc/src/main/java/module-info.java @@ -23,5 +23,4 @@ module org.apache.wicket.ioc { exports org.apache.wicket.injection; exports org.apache.wicket.proxy; -exports org.apache.wicket.proxy.objenesis; } diff --git a/wicket-ioc/src/main/java/module-info.java b/wicket-ioc/src/main/java/org/apache/wicket/proxy/IProxyFactory.java similarity index 70% copy from wicket-ioc/src/main/java/module-info.java copy to wicket-ioc/src/main/java/org/apache/wicket/proxy/IProxyFactory.java index b9814fe..ef5f638 100644 --- a/wicket-ioc/src/main/java/module-info.java +++ b/wicket-ioc/src/main/java/org/apache/wicket/proxy/IProxyFactory.java @@ -14,14 +14,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +package org.apache.wicket.proxy; -module org.apache.wicket.ioc { -requires org.apache.wicket.util; -requires org.apache.wicket.core; -requires net.bytebuddy; -requires org.objenesis; - -exports org.apache.wicket.injection; -exports org.apache.wicket.proxy; -exports org.apache.wicket.proxy.objenesis; +/** + * A factory of proxies. + */ +public interface IProxyFactory +{ + /** +* Create a proxy. +* +* @param type +*the target type +* @param locator +*the locator of the target +* @return a proxy +*/ + public Object createProxy(final Class type, final IProxyTargetLocator locator); } diff --git a/wicket-ioc/src/main/java/org/apache/wicket/proxy/LazyInitProxyFactory.java b/wicket-ioc/src/main/java/org/apache/wicket/proxy/LazyInitProxyFactory.java index 61629b7..8440c8f 100644 --- a/wicket-ioc/src/main/java/org/apache/wicket/proxy/LazyInitProxyFactory.java +++ b/wicket-ioc/src/main/java/org/apache/wicket/proxy/LazyInitProxyFactory.java @@ -17,37 +17,17 @@ package org.apache.wicket.proxy; import java.io.ObjectStreamException; -import java.io.Serializable; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.lang.reflect.Proxy; import java.util.Arrays; import java.util.List; -import java.util.function.Function; -import org.apache.wicket.Application; import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.core.util.lang.WicketObjects; import org.apache.wicket.model.IModel; -import org.apache.wicket.proxy.objenesis.ObjenesisProxyFactory; +import org.apache.wicket.proxy.bytebuddy.ByteBuddyProxyFactory; +import org.apache.wicket.proxy.jdk.JdkProxyFactory; import org.apache.wicket.util.io.IClusterable; -import net.bytebuddy.ByteBuddy; -import net.bytebuddy.NamingStrategy; -import net.bytebuddy.TypeCache; -import net.bytebuddy.description.modifier.Visibility; -import net.bytebuddy.description.type.TypeDescription; -import net.bytebuddy.dynamic.loading.ClassLoadingStrategy; -import net.bytebuddy.implementation.FieldAccessor; -import net.bytebuddy.implementation.MethodDelegation; -import net.bytebuddy.implementation.bind.annotation.AllArguments; -import net.bytebuddy.implementation.bind.annotation.Origin; -import net.bytebuddy.implementation.bind.annotation.Pipe; -
[wicket] 01/01: WICKET-6913 bytebuddy for wicket-9.x
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch WICKET-6913-wicket-9.x in repository https://gitbox.apache.org/repos/asf/wicket.git commit 8287aa9f762a08574fe4ff433524aa9f374687fc Author: Sven Meier AuthorDate: Mon Aug 23 15:02:31 2021 +0200 WICKET-6913 bytebuddy for wicket-9.x optional via system parameter wicket.ioc.proxyfactory --- NOTICE | 7 +- README.md | 3 +- pom.xml| 6 + wicket-examples/src/main/resources/META-INF/NOTICE | 9 +- wicket-ioc/pom.xml | 6 +- wicket-ioc/src/main/java/module-info.java | 1 + .../apache/wicket/proxy/IProxyFactory.java}| 25 +- .../apache/wicket/proxy/IProxyTargetLocator.java | 3 +- .../apache/wicket/proxy/LazyInitProxyFactory.java | 434 ++--- .../proxy/bytebuddy/ByteBuddyProxyFactory.java | 302 ++ .../ObjenesisByteBuddyInterceptor.java}| 11 +- .../ObjenesisProxyFactory.java}| 25 +- .../ObjenesisProxyReplacement.java | 5 +- .../wicket/proxy/cglib/CglibProxyFactory.java | 155 .../apache/wicket/proxy/jdk/JdkProxyFactory.java | 196 ++ .../proxy/objenesis/ObjenesisCGLibInterceptor.java | 4 +- .../proxy/objenesis/ObjenesisProxyReplacement.java | 4 +- .../wicket/injection/util/MockDependency.java | 5 +- .../annot/SpringBeanWithGenericsTest.java | 2 +- 19 files changed, 832 insertions(+), 371 deletions(-) diff --git a/NOTICE b/NOTICE index 3e462db..bc97306 100644 --- a/NOTICE +++ b/NOTICE @@ -56,8 +56,11 @@ src/./wicket-examples This product includes software developed by the CGLib Project (http://cglib.sourceforge.net). - This product includes ASM, released under a BSD style license (http://asm.objectweb.org). - Copyright (c) 2000-2005 INRIA, France Telecom + This product includes ASM, released under a BSD style license (https://asm.ow2.io/). + Copyright (c) 2000-2011 INRIA, France Telecom + + This product includes software developed by the ByteBuddy Project + (https://bytebuddy.net/). This product includes jhighlight (https://jhighlight.dev.java.net/) which is released under CDDL 1.0 license (http://www.opensource.org/licenses/cddl1.php). diff --git a/README.md b/README.md index 01e9982..8faa041 100644 --- a/README.md +++ b/README.md @@ -159,7 +159,8 @@ the src/ folder. - wicket-ioc: cglib 3.1 (http://cglib.sourceforge.net/) and -asm-util 5.0.3 (http://asm.objectweb.org/) +asm-util 9.1 (https://asm.ow2.io/) +byte-buddy 1.11.12 (https://bytebuddy.net/) and - wicket-spring: diff --git a/pom.xml b/pom.xml index b4cbc76..589c2a8 100644 --- a/pom.xml +++ b/pom.xml @@ -139,6 +139,7 @@ 3.19.0 4.1.0 3.3.0 + 1.11.12 3.2.2 4.4 1.4 @@ -321,6 +322,11 @@ true + net.bytebuddy + byte-buddy + ${byte-buddy.version} + + org.apache.commons commons-collections4 ${commons-collections4.version} diff --git a/wicket-examples/src/main/resources/META-INF/NOTICE b/wicket-examples/src/main/resources/META-INF/NOTICE index 619dd91..3598cb3 100644 --- a/wicket-examples/src/main/resources/META-INF/NOTICE +++ b/wicket-examples/src/main/resources/META-INF/NOTICE @@ -29,8 +29,11 @@ This product includes software developed by the CGLib Project (http://cglib.sourceforge.net). - This product includes ASM, released under a BSD style license (http://asm.objectweb.org). - Copyright (c) 2000-2005 INRIA, France Telecom + This product includes ASM, released under a BSD style license (https://asm.ow2.io/). + Copyright (c) 2000-2011 INRIA, France Telecom + + This product includes software developed by the ByteBuddy Project + (https://bytebuddy.net/). This product includes jhighlight (https://jhighlight.dev.java.net/) which is released under CDDL 1.0 license (http://www.opensource.org/licenses/cddl1.php). @@ -42,4 +45,4 @@ jQuery Foundation, Inc, http://jquery.org/license Contains qunit.css released under a MIT style license. - jQuery Foundation, Inc, http://jquery.org/license \ No newline at end of file + jQuery Foundation, Inc, http://jquery.org/license diff --git a/wicket-ioc/pom.xml b/wicket-ioc/pom.xml index d34c07f..8ccb684 100644 --- a/wicket-ioc/pom.xml +++ b/wicket-ioc/pom.xml @@ -41,9 +41,13 @@ javax.inject
[wicket] branch WICKET-6913-wicket-9.x created (now 8287aa9)
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a change to branch WICKET-6913-wicket-9.x in repository https://gitbox.apache.org/repos/asf/wicket.git. at 8287aa9 WICKET-6913 bytebuddy for wicket-9.x This branch includes the following new commits: new 8287aa9 WICKET-6913 bytebuddy for wicket-9.x The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
[wicket] branch wicket-9.x updated: WICKET-6913 move package private
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch wicket-9.x in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/wicket-9.x by this push: new eb42b15 WICKET-6913 move package private eb42b15 is described below commit eb42b157a0f856b9e6a37b82a0102cd0f1c5cf7b Author: Sven Meier AuthorDate: Mon Aug 23 14:04:22 2021 +0200 WICKET-6913 move package private works fine with cglib already --- .../wicket/proxy/LazyInitProxyFactoryTest.java | 85 ++-- .../PackagePrivateConcreteObject.java | 4 +- .../proxy/packageprivate/PackagePrivateTest.java | 109 + 3 files changed, 120 insertions(+), 78 deletions(-) diff --git a/wicket-ioc/src/test/java/org/apache/wicket/proxy/LazyInitProxyFactoryTest.java b/wicket-ioc/src/test/java/org/apache/wicket/proxy/LazyInitProxyFactoryTest.java index 5483ce4..ff6c96a 100644 --- a/wicket-ioc/src/test/java/org/apache/wicket/proxy/LazyInitProxyFactoryTest.java +++ b/wicket-ioc/src/test/java/org/apache/wicket/proxy/LazyInitProxyFactoryTest.java @@ -16,6 +16,15 @@ */ package org.apache.wicket.proxy; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotSame; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.io.ObjectStreamException; +import java.lang.reflect.Proxy; + import org.apache.wicket.core.util.lang.WicketObjects; import org.apache.wicket.proxy.LazyInitProxyFactory.ProxyReplacement; import org.apache.wicket.proxy.util.ConcreteObject; @@ -25,14 +34,6 @@ import org.apache.wicket.proxy.util.InterfaceObject; import org.apache.wicket.proxy.util.ObjectMethodTester; import org.junit.jupiter.api.Test; -import java.lang.reflect.Proxy; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotSame; -import static org.junit.jupiter.api.Assertions.assertSame; -import static org.junit.jupiter.api.Assertions.assertTrue; - /** * Tests lazy init proxy factory * @@ -45,8 +46,6 @@ public class LazyInitProxyFactoryTest private static ConcreteObject concreteObject = new ConcreteObject("concrete"); - private static final PackagePrivateConcreteObject PACKAGE_PRIVATE_CONCRETE_OBJECT = new PackagePrivateConcreteObject("package-private-concrete"); - private static IProxyTargetLocator interfaceObjectLocator = new IProxyTargetLocator() { private static final long serialVersionUID = 1L; @@ -69,17 +68,6 @@ public class LazyInitProxyFactoryTest } }; - private final static IProxyTargetLocator PACKAGE_PRIVATE_CONCRETE_OBJECT_LOCATOR = new IProxyTargetLocator() - { - private static final long serialVersionUID = 1L; - - @Override - public Object locateProxyTarget() - { - return LazyInitProxyFactoryTest.PACKAGE_PRIVATE_CONCRETE_OBJECT; - } - }; - private static IProxyTargetLocator stringObjectLocator = new IProxyTargetLocator() { private static final long serialVersionUID = 1L; @@ -192,61 +180,6 @@ public class LazyInitProxyFactoryTest } /** -* Tests lazy init proxy to represent package private concrete objects -* -* https://issues.apache.org/jira/browse/WICKET-4324 -*/ - @Test - public void testPackagePrivateConcreteProxy() - { - PackagePrivateConcreteObject proxy = (PackagePrivateConcreteObject)LazyInitProxyFactory.createProxy( - PackagePrivateConcreteObject.class, PACKAGE_PRIVATE_CONCRETE_OBJECT_LOCATOR); - - // test proxy implements ILazyInitProxy - assertTrue(proxy instanceof ILazyInitProxy); - assertTrue(((ILazyInitProxy)proxy).getObjectLocator() == PACKAGE_PRIVATE_CONCRETE_OBJECT_LOCATOR); - - // test we do not have a jdk dynamic proxy - assertFalse(Proxy.isProxyClass(proxy.getClass())); - - // test method invocation - assertEquals(proxy.getMessage(), "package-private-concrete"); - - // test serialization - PackagePrivateConcreteObject proxy2 = WicketObjects.cloneObject(proxy); - assertTrue(proxy != proxy2); - assertEquals(proxy2.getMessage(), "package-private-concrete"); - - // test equals/hashcode method interception - final IObjectMethodTester tester = new ObjectMethodTester(); - assertTrue(tester.isVa
[wicket] 01/02: WICKET-6913 move package private
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git commit d9275ce6f78ffe8ada321af480b66ddd8ca41f57 Author: Sven Meier AuthorDate: Mon Aug 23 14:04:22 2021 +0200 WICKET-6913 move package private to trigger package access error --- .../wicket/proxy/LazyInitProxyFactoryTest.java | 85 ++-- .../PackagePrivateConcreteObject.java | 4 +- .../proxy/packageprivate/PackagePrivateTest.java | 109 + 3 files changed, 120 insertions(+), 78 deletions(-) diff --git a/wicket-ioc/src/test/java/org/apache/wicket/proxy/LazyInitProxyFactoryTest.java b/wicket-ioc/src/test/java/org/apache/wicket/proxy/LazyInitProxyFactoryTest.java index 6b907d2..60f4fc5 100644 --- a/wicket-ioc/src/test/java/org/apache/wicket/proxy/LazyInitProxyFactoryTest.java +++ b/wicket-ioc/src/test/java/org/apache/wicket/proxy/LazyInitProxyFactoryTest.java @@ -16,6 +16,15 @@ */ package org.apache.wicket.proxy; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotSame; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.io.ObjectStreamException; +import java.lang.reflect.Proxy; + import org.apache.wicket.core.util.lang.WicketObjects; import org.apache.wicket.proxy.LazyInitProxyFactory.ProxyReplacement; import org.apache.wicket.proxy.util.ConcreteObject; @@ -25,15 +34,6 @@ import org.apache.wicket.proxy.util.InterfaceObject; import org.apache.wicket.proxy.util.ObjectMethodTester; import org.junit.jupiter.api.Test; -import java.io.ObjectStreamException; -import java.lang.reflect.Proxy; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotSame; -import static org.junit.jupiter.api.Assertions.assertSame; -import static org.junit.jupiter.api.Assertions.assertTrue; - /** * Tests lazy init proxy factory * @@ -46,8 +46,6 @@ class LazyInitProxyFactoryTest private static final ConcreteObject concreteObject = new ConcreteObject("concrete"); - private static final PackagePrivateConcreteObject PACKAGE_PRIVATE_CONCRETE_OBJECT = new PackagePrivateConcreteObject("package-private-concrete"); - private static IProxyTargetLocator interfaceObjectLocator = new IProxyTargetLocator() { private static final long serialVersionUID = 1L; @@ -75,17 +73,6 @@ class LazyInitProxyFactoryTest } }; - private final static IProxyTargetLocator PACKAGE_PRIVATE_CONCRETE_OBJECT_LOCATOR = new IProxyTargetLocator() - { - private static final long serialVersionUID = 1L; - - @Override - public Object locateProxyTarget() - { - return LazyInitProxyFactoryTest.PACKAGE_PRIVATE_CONCRETE_OBJECT; - } - }; - private static IProxyTargetLocator stringObjectLocator = new IProxyTargetLocator() { private static final long serialVersionUID = 1L; @@ -199,60 +186,6 @@ class LazyInitProxyFactoryTest } /** -* Tests lazy init proxy to represent package private concrete objects -* -* https://issues.apache.org/jira/browse/WICKET-4324 -*/ - @Test - void testPackagePrivateConcreteProxy() - { - PackagePrivateConcreteObject proxy = (PackagePrivateConcreteObject)LazyInitProxyFactory.createProxy( - PackagePrivateConcreteObject.class, PACKAGE_PRIVATE_CONCRETE_OBJECT_LOCATOR); - - // test proxy implements ILazyInitProxy - assertTrue(proxy instanceof ILazyInitProxy); - assertSame(((ILazyInitProxy)proxy).getObjectLocator(), PACKAGE_PRIVATE_CONCRETE_OBJECT_LOCATOR); - - // test we do not have a jdk dynamic proxy - assertFalse(Proxy.isProxyClass(proxy.getClass())); - - // test method invocation - assertEquals("package-private-concrete", proxy.getMessage()); - - // test serialization - PackagePrivateConcreteObject proxy2 = WicketObjects.cloneObject(proxy); - assertNotSame(proxy, proxy2); - assertEquals("package-private-concrete", proxy2.getMessage()); - - // test equals/hashcode method interception - final IObjectMethodTester tester = new ObjectMethodTester(); - assertTrue(tester.isValid()); - - // test only a single class is generated, - // otherwise permgen space will fill up with each proxy -
[wicket] 02/02: WICKET-6913 use pipe
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git commit 7fb9fa5bcdb8361e14be3118e7c96f57e605659d Author: Sven Meier AuthorDate: Mon Aug 23 14:09:12 2021 +0200 WICKET-6913 use pipe to delegate, this works with package private and should be faster too --- .../apache/wicket/proxy/LazyInitProxyFactory.java | 47 ++ 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/wicket-ioc/src/main/java/org/apache/wicket/proxy/LazyInitProxyFactory.java b/wicket-ioc/src/main/java/org/apache/wicket/proxy/LazyInitProxyFactory.java index 3e33b74..61629b7 100644 --- a/wicket-ioc/src/main/java/org/apache/wicket/proxy/LazyInitProxyFactory.java +++ b/wicket-ioc/src/main/java/org/apache/wicket/proxy/LazyInitProxyFactory.java @@ -25,6 +25,14 @@ import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.util.Arrays; import java.util.List; +import java.util.function.Function; + +import org.apache.wicket.Application; +import org.apache.wicket.WicketRuntimeException; +import org.apache.wicket.core.util.lang.WicketObjects; +import org.apache.wicket.model.IModel; +import org.apache.wicket.proxy.objenesis.ObjenesisProxyFactory; +import org.apache.wicket.util.io.IClusterable; import net.bytebuddy.ByteBuddy; import net.bytebuddy.NamingStrategy; @@ -36,16 +44,10 @@ import net.bytebuddy.implementation.FieldAccessor; import net.bytebuddy.implementation.MethodDelegation; import net.bytebuddy.implementation.bind.annotation.AllArguments; import net.bytebuddy.implementation.bind.annotation.Origin; +import net.bytebuddy.implementation.bind.annotation.Pipe; import net.bytebuddy.implementation.bind.annotation.RuntimeType; import net.bytebuddy.matcher.ElementMatchers; -import org.apache.wicket.Application; -import org.apache.wicket.WicketRuntimeException; -import org.apache.wicket.core.util.lang.WicketObjects; -import org.apache.wicket.model.IModel; -import org.apache.wicket.proxy.objenesis.ObjenesisProxyFactory; -import org.apache.wicket.util.io.IClusterable; - /** * A factory class that creates lazy init proxies given a type and a {@link IProxyTargetLocator} * used to retrieve the object the proxy will represent. @@ -203,11 +205,15 @@ public class LazyInitProxyFactory new TypeCache.SimpleKey(type), () -> BYTE_BUDDY .subclass(type) - .implement(Serializable.class, ILazyInitProxy.class, IWriteReplace.class) - .method(ElementMatchers.any()) - .intercept(MethodDelegation.toField("interceptor")) + .method(ElementMatchers.isPublic()) + .intercept( + MethodDelegation + .withDefaultConfiguration() + .withBinders(Pipe.Binder.install(Function.class)) + .toField("interceptor")) .defineField("interceptor", ByteBuddyInterceptor.class, Visibility.PRIVATE) .implement(InterceptorMutator.class).intercept(FieldAccessor.ofBeanProperty()) + .implement(Serializable.class, IWriteReplace.class, ILazyInitProxy.class).intercept(MethodDelegation.toField("interceptor")) .make() .load(classLoader, ClassLoadingStrategy.Default.INJECTION) .getLoaded()); @@ -355,14 +361,13 @@ public class LazyInitProxyFactory public ByteBuddyInterceptor(final Class type, final IProxyTargetLocator locator) { super(); - typeName = type.getName(); + + this.typeName = type.getName(); this.locator = locator; } @RuntimeType - public Object intercept(final @Origin Method method, - final @AllArguments Object[] args) - throws Exception + public Object intercept(@Origin Method method, @AllArguments Object[] args, @Pipe Function pipe) throws Exception { if (isFinalizeMethod(method))
[wicket] branch master updated (6238623 -> 7fb9fa5)
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git. from 6238623 Small logging improvements to JMX Initializer new d9275ce WICKET-6913 move package private new 7fb9fa5 WICKET-6913 use pipe The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../apache/wicket/proxy/LazyInitProxyFactory.java | 47 + .../wicket/proxy/LazyInitProxyFactoryTest.java | 85 ++-- .../PackagePrivateConcreteObject.java | 4 +- .../proxy/packageprivate/PackagePrivateTest.java | 109 + 4 files changed, 142 insertions(+), 103 deletions(-) rename wicket-ioc/src/test/java/org/apache/wicket/proxy/{ => packageprivate}/PackagePrivateConcreteObject.java (91%) create mode 100644 wicket-ioc/src/test/java/org/apache/wicket/proxy/packageprivate/PackagePrivateTest.java
[wicket] branch wicket-9.x updated: WICKET-6916 replace proxies with StandardMBean
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch wicket-9.x in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/wicket-9.x by this push: new 04b3440 WICKET-6916 replace proxies with StandardMBean 04b3440 is described below commit 04b3440df6affbd11b0286de5ed54f587ff55f52 Author: Sven Meier AuthorDate: Fri Aug 20 19:34:33 2021 +0200 WICKET-6916 replace proxies with StandardMBean --- wicket-jmx/pom.xml | 8 -- wicket-jmx/src/main/java/module-info.java | 1 - .../java/org/apache/wicket/jmx/Initializer.java| 93 ++ 3 files changed, 42 insertions(+), 60 deletions(-) diff --git a/wicket-jmx/pom.xml b/wicket-jmx/pom.xml index 15c050c..9c6facb 100644 --- a/wicket-jmx/pom.xml +++ b/wicket-jmx/pom.xml @@ -30,16 +30,8 @@ - cglib - cglib - - org.apache.wicket wicket-core - - org.ow2.asm - asm - diff --git a/wicket-jmx/src/main/java/module-info.java b/wicket-jmx/src/main/java/module-info.java index d07942d..b646aaf 100644 --- a/wicket-jmx/src/main/java/module-info.java +++ b/wicket-jmx/src/main/java/module-info.java @@ -20,7 +20,6 @@ module org.apache.wicket.jmx { requires org.apache.wicket.util; requires org.apache.wicket.core; requires org.slf4j; -requires cglib; provides org.apache.wicket.IInitializer with org.apache.wicket.jmx.Initializer; exports org.apache.wicket.jmx; diff --git a/wicket-jmx/src/main/java/org/apache/wicket/jmx/Initializer.java b/wicket-jmx/src/main/java/org/apache/wicket/jmx/Initializer.java index ca990ac..6b896ba 100644 --- a/wicket-jmx/src/main/java/org/apache/wicket/jmx/Initializer.java +++ b/wicket-jmx/src/main/java/org/apache/wicket/jmx/Initializer.java @@ -17,10 +17,12 @@ package org.apache.wicket.jmx; import java.lang.management.ManagementFactory; -import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.Callable; +import javax.management.Attribute; +import javax.management.AttributeList; import javax.management.InstanceAlreadyExistsException; import javax.management.InstanceNotFoundException; import javax.management.MBeanRegistrationException; @@ -29,10 +31,7 @@ import javax.management.MBeanServerFactory; import javax.management.MalformedObjectNameException; import javax.management.NotCompliantMBeanException; import javax.management.ObjectName; - -import net.sf.cglib.core.DefaultNamingPolicy; -import net.sf.cglib.core.Predicate; -import net.sf.cglib.proxy.Enhancer; +import javax.management.StandardMBean; import org.apache.wicket.IInitializer; import org.apache.wicket.ThreadContext; @@ -229,24 +228,39 @@ public class Initializer implements IInitializer * @throws MBeanRegistrationException * @throws InstanceAlreadyExistsException */ - private void register(final org.apache.wicket.Application application, final Object o, + private void register(final org.apache.wicket.Application application, final T o, final ObjectName objectName) throws InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException { - Object proxy = createProxy(application, o); - mbeanServer.registerMBean(proxy, objectName); - registered.add(objectName); - } - - private Object createProxy(final org.apache.wicket.Application application, final Object o) - { - Enhancer e = new Enhancer(); - e.setInterfaces(o.getClass().getInterfaces()); - e.setSuperclass(Object.class); - e.setCallback(new net.sf.cglib.proxy.InvocationHandler() - { + StandardMBean bean = new StandardMBean(o, (Class)o.getClass().getInterfaces()[0]) { + @Override + public Object getAttribute(String attribute) + { + return withApplication(() -> super.getAttribute(attribute)); + } + @Override - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable + public void setAttribute(Attribute attribute) + { + withApplication(() -> { + super.setAttribute(attribute); + return null; + }); + } + + @Ov
[wicket] branch master updated: WICKET-6916 replace proxies with StandardMBean
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/master by this push: new 8d030d2 WICKET-6916 replace proxies with StandardMBean 8d030d2 is described below commit 8d030d2929f8d37a2ae4b28be9d3cef7877373e5 Author: Sven Meier AuthorDate: Fri Aug 20 19:34:33 2021 +0200 WICKET-6916 replace proxies with StandardMBean --- wicket-jmx/pom.xml | 8 - wicket-jmx/src/main/java/module-info.java | 1 - .../java/org/apache/wicket/jmx/Initializer.java| 175 +++-- 3 files changed, 60 insertions(+), 124 deletions(-) diff --git a/wicket-jmx/pom.xml b/wicket-jmx/pom.xml index 67303ae..5fa7d4b 100644 --- a/wicket-jmx/pom.xml +++ b/wicket-jmx/pom.xml @@ -30,16 +30,8 @@ - net.bytebuddy - byte-buddy - - org.apache.wicket wicket-core - - org.ow2.asm - asm - diff --git a/wicket-jmx/src/main/java/module-info.java b/wicket-jmx/src/main/java/module-info.java index a0366f8..b646aaf 100644 --- a/wicket-jmx/src/main/java/module-info.java +++ b/wicket-jmx/src/main/java/module-info.java @@ -20,7 +20,6 @@ module org.apache.wicket.jmx { requires org.apache.wicket.util; requires org.apache.wicket.core; requires org.slf4j; -requires net.bytebuddy; provides org.apache.wicket.IInitializer with org.apache.wicket.jmx.Initializer; exports org.apache.wicket.jmx; diff --git a/wicket-jmx/src/main/java/org/apache/wicket/jmx/Initializer.java b/wicket-jmx/src/main/java/org/apache/wicket/jmx/Initializer.java index 181f293..6b896ba 100644 --- a/wicket-jmx/src/main/java/org/apache/wicket/jmx/Initializer.java +++ b/wicket-jmx/src/main/java/org/apache/wicket/jmx/Initializer.java @@ -17,11 +17,12 @@ package org.apache.wicket.jmx; import java.lang.management.ManagementFactory; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.Callable; +import javax.management.Attribute; +import javax.management.AttributeList; import javax.management.InstanceAlreadyExistsException; import javax.management.InstanceNotFoundException; import javax.management.MBeanRegistrationException; @@ -30,17 +31,7 @@ import javax.management.MBeanServerFactory; import javax.management.MalformedObjectNameException; import javax.management.NotCompliantMBeanException; import javax.management.ObjectName; - -import net.bytebuddy.ByteBuddy; -import net.bytebuddy.NamingStrategy; -import net.bytebuddy.TypeCache; -import net.bytebuddy.description.type.TypeDescription; -import net.bytebuddy.dynamic.loading.ClassLoadingStrategy; -import net.bytebuddy.implementation.MethodDelegation; -import net.bytebuddy.implementation.bind.annotation.AllArguments; -import net.bytebuddy.implementation.bind.annotation.Origin; -import net.bytebuddy.implementation.bind.annotation.RuntimeType; -import net.bytebuddy.matcher.ElementMatchers; +import javax.management.StandardMBean; import org.apache.wicket.IInitializer; import org.apache.wicket.ThreadContext; @@ -76,17 +67,8 @@ import org.slf4j.LoggerFactory; */ public class Initializer implements IInitializer { - private static final Logger LOG = LoggerFactory.getLogger(Initializer.class); - - /** -* A cache used to store the dynamically generated classes by ByteBuddy. -* Without this cache a new class will be generated for each proxy creation -* and this will fill up the metaspace -*/ - private static final TypeCache DYNAMIC_CLASS_CACHE = new TypeCache.WithInlineExpunction<>(TypeCache.Sort.SOFT); + private static Logger log = LoggerFactory.getLogger(Initializer.class); - private static final ByteBuddy BYTE_BUDDY = new ByteBuddy(); - // It's best to store a reference to the MBeanServer rather than getting it // over and over private MBeanServer mbeanServer = null; @@ -107,7 +89,7 @@ public class Initializer implements IInitializer } catch (InstanceNotFoundException | MBeanRegistrationException e) { - LOG.error(e.getMessage(), e); + log.error(e.getMessage(), e); } } } @@ -127,7 +109,7 @@ public class Initializer implements IInitializer catch (SecurityException e) { // Ignore - we're not allowed to read this property. -
[wicket] branch jmx-standardmbean-instead-proxy updated (c776f4d -> 7b3b938)
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a change to branch jmx-standardmbean-instead-proxy in repository https://gitbox.apache.org/repos/asf/wicket.git. discard c776f4d WICKET-6913 replace proxies with StandardMBean new 7b3b938 WICKET-6913 replace proxies with StandardMBean This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (c776f4d) \ N -- N -- N refs/heads/jmx-standardmbean-instead-proxy (7b3b938) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: wicket-jmx/pom.xml| 8 wicket-jmx/src/main/java/module-info.java | 1 - 2 files changed, 9 deletions(-)
[wicket] 01/01: WICKET-6913 replace proxies with StandardMBean
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch jmx-standardmbean-instead-proxy in repository https://gitbox.apache.org/repos/asf/wicket.git commit 7b3b938c065a224d3762179d42fc5cd5d3be7084 Author: Sven Meier AuthorDate: Fri Aug 20 19:34:33 2021 +0200 WICKET-6913 replace proxies with StandardMBean --- wicket-jmx/pom.xml | 8 -- wicket-jmx/src/main/java/module-info.java | 1 - .../java/org/apache/wicket/jmx/Initializer.java| 160 +++-- 3 files changed, 54 insertions(+), 115 deletions(-) diff --git a/wicket-jmx/pom.xml b/wicket-jmx/pom.xml index 67303ae..5fa7d4b 100644 --- a/wicket-jmx/pom.xml +++ b/wicket-jmx/pom.xml @@ -30,16 +30,8 @@ - net.bytebuddy - byte-buddy - - org.apache.wicket wicket-core - - org.ow2.asm - asm - diff --git a/wicket-jmx/src/main/java/module-info.java b/wicket-jmx/src/main/java/module-info.java index a0366f8..b646aaf 100644 --- a/wicket-jmx/src/main/java/module-info.java +++ b/wicket-jmx/src/main/java/module-info.java @@ -20,7 +20,6 @@ module org.apache.wicket.jmx { requires org.apache.wicket.util; requires org.apache.wicket.core; requires org.slf4j; -requires net.bytebuddy; provides org.apache.wicket.IInitializer with org.apache.wicket.jmx.Initializer; exports org.apache.wicket.jmx; diff --git a/wicket-jmx/src/main/java/org/apache/wicket/jmx/Initializer.java b/wicket-jmx/src/main/java/org/apache/wicket/jmx/Initializer.java index 181f293..bb89f78 100644 --- a/wicket-jmx/src/main/java/org/apache/wicket/jmx/Initializer.java +++ b/wicket-jmx/src/main/java/org/apache/wicket/jmx/Initializer.java @@ -17,11 +17,11 @@ package org.apache.wicket.jmx; import java.lang.management.ManagementFactory; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; +import javax.management.Attribute; +import javax.management.AttributeList; import javax.management.InstanceAlreadyExistsException; import javax.management.InstanceNotFoundException; import javax.management.MBeanRegistrationException; @@ -30,17 +30,7 @@ import javax.management.MBeanServerFactory; import javax.management.MalformedObjectNameException; import javax.management.NotCompliantMBeanException; import javax.management.ObjectName; - -import net.bytebuddy.ByteBuddy; -import net.bytebuddy.NamingStrategy; -import net.bytebuddy.TypeCache; -import net.bytebuddy.description.type.TypeDescription; -import net.bytebuddy.dynamic.loading.ClassLoadingStrategy; -import net.bytebuddy.implementation.MethodDelegation; -import net.bytebuddy.implementation.bind.annotation.AllArguments; -import net.bytebuddy.implementation.bind.annotation.Origin; -import net.bytebuddy.implementation.bind.annotation.RuntimeType; -import net.bytebuddy.matcher.ElementMatchers; +import javax.management.StandardMBean; import org.apache.wicket.IInitializer; import org.apache.wicket.ThreadContext; @@ -78,15 +68,6 @@ public class Initializer implements IInitializer { private static final Logger LOG = LoggerFactory.getLogger(Initializer.class); - /** -* A cache used to store the dynamically generated classes by ByteBuddy. -* Without this cache a new class will be generated for each proxy creation -* and this will fill up the metaspace -*/ - private static final TypeCache DYNAMIC_CLASS_CACHE = new TypeCache.WithInlineExpunction<>(TypeCache.Sort.SOFT); - - private static final ByteBuddy BYTE_BUDDY = new ByteBuddy(); - // It's best to store a reference to the MBeanServer rather than getting it // over and over private MBeanServer mbeanServer = null; @@ -246,102 +227,69 @@ public class Initializer implements IInitializer * @throws MBeanRegistrationException * @throws InstanceAlreadyExistsException */ - private void register(final org.apache.wicket.Application application, final Object o, + private void register(final org.apache.wicket.Application application, final T o, final ObjectName objectName) throws InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException { - Object proxy = createProxy(application, o); - mbeanServer.registerMBean(proxy, objectName); - registered.add(objectName); - } - - // must be public to prevent JMX Server throwing: - // failed to access class org.apache.wicket.jmx.Initializer$Interceptor from class org.apache.wicket.jmx.Application - public static class
[wicket] 01/01: WICKET-6913 replace proxies with StandardMBean
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch jmx-standardmbean-instead-proxy in repository https://gitbox.apache.org/repos/asf/wicket.git commit c776f4d922b6ecd704f846748d488942d5b87ec2 Author: Sven Meier AuthorDate: Fri Aug 20 19:34:33 2021 +0200 WICKET-6913 replace proxies with StandardMBean --- .../java/org/apache/wicket/jmx/Initializer.java| 160 +++-- 1 file changed, 54 insertions(+), 106 deletions(-) diff --git a/wicket-jmx/src/main/java/org/apache/wicket/jmx/Initializer.java b/wicket-jmx/src/main/java/org/apache/wicket/jmx/Initializer.java index 181f293..bb89f78 100644 --- a/wicket-jmx/src/main/java/org/apache/wicket/jmx/Initializer.java +++ b/wicket-jmx/src/main/java/org/apache/wicket/jmx/Initializer.java @@ -17,11 +17,11 @@ package org.apache.wicket.jmx; import java.lang.management.ManagementFactory; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; +import javax.management.Attribute; +import javax.management.AttributeList; import javax.management.InstanceAlreadyExistsException; import javax.management.InstanceNotFoundException; import javax.management.MBeanRegistrationException; @@ -30,17 +30,7 @@ import javax.management.MBeanServerFactory; import javax.management.MalformedObjectNameException; import javax.management.NotCompliantMBeanException; import javax.management.ObjectName; - -import net.bytebuddy.ByteBuddy; -import net.bytebuddy.NamingStrategy; -import net.bytebuddy.TypeCache; -import net.bytebuddy.description.type.TypeDescription; -import net.bytebuddy.dynamic.loading.ClassLoadingStrategy; -import net.bytebuddy.implementation.MethodDelegation; -import net.bytebuddy.implementation.bind.annotation.AllArguments; -import net.bytebuddy.implementation.bind.annotation.Origin; -import net.bytebuddy.implementation.bind.annotation.RuntimeType; -import net.bytebuddy.matcher.ElementMatchers; +import javax.management.StandardMBean; import org.apache.wicket.IInitializer; import org.apache.wicket.ThreadContext; @@ -78,15 +68,6 @@ public class Initializer implements IInitializer { private static final Logger LOG = LoggerFactory.getLogger(Initializer.class); - /** -* A cache used to store the dynamically generated classes by ByteBuddy. -* Without this cache a new class will be generated for each proxy creation -* and this will fill up the metaspace -*/ - private static final TypeCache DYNAMIC_CLASS_CACHE = new TypeCache.WithInlineExpunction<>(TypeCache.Sort.SOFT); - - private static final ByteBuddy BYTE_BUDDY = new ByteBuddy(); - // It's best to store a reference to the MBeanServer rather than getting it // over and over private MBeanServer mbeanServer = null; @@ -246,102 +227,69 @@ public class Initializer implements IInitializer * @throws MBeanRegistrationException * @throws InstanceAlreadyExistsException */ - private void register(final org.apache.wicket.Application application, final Object o, + private void register(final org.apache.wicket.Application application, final T o, final ObjectName objectName) throws InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException { - Object proxy = createProxy(application, o); - mbeanServer.registerMBean(proxy, objectName); - registered.add(objectName); - } - - // must be public to prevent JMX Server throwing: - // failed to access class org.apache.wicket.jmx.Initializer$Interceptor from class org.apache.wicket.jmx.Application - public static class Interceptor - { - private final org.apache.wicket.Application application; - private final Object object; - - private Interceptor(org.apache.wicket.Application application, Object object) { - this.application = application; - this.object = object; - } - - @RuntimeType - public Object intercept(final @Origin Method method, - final @AllArguments Object[] args) - throws Throwable - { - boolean existed = ThreadContext.exists(); - - if (existed == false) + StandardMBean bean = new StandardMBean(o, (Class)o.getClass().getInterfaces()[0]) { + @Override + public Object getAttribute(String attribute) { - ThreadContext.setApplication(application); + return withApplication(() -> super.getAttri
[wicket] branch jmx-standardmbean-instead-proxy created (now c776f4d)
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a change to branch jmx-standardmbean-instead-proxy in repository https://gitbox.apache.org/repos/asf/wicket.git. at c776f4d WICKET-6913 replace proxies with StandardMBean This branch includes the following new commits: new c776f4d WICKET-6913 replace proxies with StandardMBean The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
[wicket] branch master updated: WICKET-6913 Interceptor must be public
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/master by this push: new 395778f WICKET-6913 Interceptor must be public 395778f is described below commit 395778f679b7d9be920e0f8ecec0dbc6f2c48b61 Author: Sven Meier AuthorDate: Fri Aug 20 18:07:04 2021 +0200 WICKET-6913 Interceptor must be public otherwise JMX console will show no values --- .../java/org/apache/wicket/jmx/Initializer.java| 32 -- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/wicket-jmx/src/main/java/org/apache/wicket/jmx/Initializer.java b/wicket-jmx/src/main/java/org/apache/wicket/jmx/Initializer.java index a2d9b3d..181f293 100644 --- a/wicket-jmx/src/main/java/org/apache/wicket/jmx/Initializer.java +++ b/wicket-jmx/src/main/java/org/apache/wicket/jmx/Initializer.java @@ -85,16 +85,8 @@ public class Initializer implements IInitializer */ private static final TypeCache DYNAMIC_CLASS_CACHE = new TypeCache.WithInlineExpunction<>(TypeCache.Sort.SOFT); - private static final ByteBuddy BYTE_BUDDY = new ByteBuddy() - .with(new NamingStrategy.AbstractBase() - { - @Override - protected String name(TypeDescription superClass) - { - return superClass.getName().replace(".wrapper", ""); - } - }); - + private static final ByteBuddy BYTE_BUDDY = new ByteBuddy(); + // It's best to store a reference to the MBeanServer rather than getting it // over and over private MBeanServer mbeanServer = null; @@ -263,7 +255,9 @@ public class Initializer implements IInitializer registered.add(objectName); } - private static class Interceptor + // must be public to prevent JMX Server throwing: + // failed to access class org.apache.wicket.jmx.Initializer$Interceptor from class org.apache.wicket.jmx.Application + public static class Interceptor { private final org.apache.wicket.Application application; private final Object object; @@ -301,13 +295,21 @@ public class Initializer implements IInitializer private Object createProxy(final org.apache.wicket.Application application, final Object o) { - Class type = o.getClass(); - ClassLoader classLoader = resolveClassLoader(); + final Class type = o.getClass(); + final ClassLoader classLoader = resolveClassLoader(); Class proxyClass = DYNAMIC_CLASS_CACHE.findOrInsert(classLoader, new TypeCache.SimpleKey(type), () -> BYTE_BUDDY - .subclass(type) + .with(new NamingStrategy.AbstractBase() + { + @Override + protected String name(TypeDescription superClass) + { + return type.getName().replace(".wrapper", ""); + } + }) + .subclass(Object.class) .implement(type.getInterfaces()) .method(ElementMatchers.any()) .intercept(MethodDelegation.to(new Interceptor(application, o))) @@ -318,7 +320,7 @@ public class Initializer implements IInitializer try { - return proxyClass.getDeclaredConstructor(org.apache.wicket.Application.class).newInstance(application); + return proxyClass.getDeclaredConstructor().newInstance(); } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
[wicket] branch wicket-8.x updated: WICKET-6908 adjusted test to junit 4
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch wicket-8.x in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/wicket-8.x by this push: new db80c7e WICKET-6908 adjusted test to junit 4 db80c7e is described below commit db80c7e74673c582cb5be1ceb335af89694df8e3 Author: Sven Meier AuthorDate: Wed Jul 28 00:50:59 2021 +0200 WICKET-6908 adjusted test to junit 4 --- .../core/request/handler/logger/ListenerLogDataTest.java | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/wicket-core/src/test/java/org/apache/wicket/core/request/handler/logger/ListenerLogDataTest.java b/wicket-core/src/test/java/org/apache/wicket/core/request/handler/logger/ListenerLogDataTest.java index 88c4976..e68a0b2 100644 --- a/wicket-core/src/test/java/org/apache/wicket/core/request/handler/logger/ListenerLogDataTest.java +++ b/wicket-core/src/test/java/org/apache/wicket/core/request/handler/logger/ListenerLogDataTest.java @@ -21,18 +21,23 @@ import org.apache.wicket.protocol.http.PageExpiredException; import org.apache.wicket.request.component.IRequestableComponent; import org.apache.wicket.request.component.IRequestablePage; import org.apache.wicket.request.mapper.parameter.PageParameters; -import org.junit.jupiter.api.Test; +import org.junit.Test; -class ListenerLogDataTest { +public class ListenerLogDataTest { /** * Test for WICKET-6908. */ @Test - void neverFails() { + public void neverFails() { IPageAndComponentProvider provider = new IPageAndComponentProvider() { @Override + public boolean isNewPageInstance() { + throw new IllegalStateException(); + } + + @Override public boolean wasExpired() { throw new IllegalStateException(); }
[wicket] branch wicket-8.x updated (b5af5f6 -> 53b487c)
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a change to branch wicket-8.x in repository https://gitbox.apache.org/repos/asf/wicket.git. from b5af5f6 Start next development version new 8bacc08 WICKET-6908 wrap exceptions for log data new 53b487c WICKET-6908 detach all handlers The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../request/handler/logger/ListenerLogData.java| 79 +-- .../core/request/handler/logger/PageLogData.java | 27 --- .../handler/logger/ListenerLogDataTest.java| 92 ++ .../wicket/request/RequestHandlerExecutor.java | 16 ++-- 4 files changed, 136 insertions(+), 78 deletions(-) create mode 100644 wicket-core/src/test/java/org/apache/wicket/core/request/handler/logger/ListenerLogDataTest.java
[wicket] 01/02: WICKET-6908 wrap exceptions for log data
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch wicket-8.x in repository https://gitbox.apache.org/repos/asf/wicket.git commit 8bacc08cffd026acbb0e9fc317ebe347babcc079 Author: Sven Meier AuthorDate: Mon Jul 26 21:37:01 2021 +0200 WICKET-6908 wrap exceptions for log data --- .../request/handler/logger/ListenerLogData.java| 79 +-- .../core/request/handler/logger/PageLogData.java | 27 --- .../handler/logger/ListenerLogDataTest.java| 92 ++ 3 files changed, 125 insertions(+), 73 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/logger/ListenerLogData.java b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/logger/ListenerLogData.java index ad83c3a..1bed21e 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/logger/ListenerLogData.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/logger/ListenerLogData.java @@ -35,9 +35,9 @@ public class ListenerLogData extends PageLogData private final Class componentClass; private final String componentPath; private final Integer behaviorIndex; - private Class behaviorClass; - private Class submittingComponentClass; - private String submittingComponentPath; + private final Class behaviorClass; + private final Class submittingComponentClass; + private final String submittingComponentPath; /** * Construct. @@ -48,68 +48,24 @@ public class ListenerLogData extends PageLogData public ListenerLogData(IPageAndComponentProvider pageAndComponentProvider, Integer behaviorIndex) { super(pageAndComponentProvider); - componentClass = tryToGetComponentClass(pageAndComponentProvider); - componentPath = tryToGetComponentPath(pageAndComponentProvider); + this.behaviorIndex = behaviorIndex; - if (behaviorIndex != null && componentClass != null) + + componentClass = optional(() -> pageAndComponentProvider.getComponent().getClass()); + componentPath = optional(() -> pageAndComponentProvider.getComponentPath()); + + if (behaviorIndex != null) { - try - { - behaviorClass = pageAndComponentProvider.getComponent() + behaviorClass = optional(() -> pageAndComponentProvider.getComponent() .getBehaviorById(behaviorIndex) - .getClass(); - } - catch (Exception ignore) - { - behaviorClass = null; - } + .getClass()); } else { behaviorClass = null; } - final Component formSubmitter = tryToGetFormSubmittingComponent(pageAndComponentProvider); - if (formSubmitter != null) - { - submittingComponentClass = formSubmitter.getClass(); - submittingComponentPath = formSubmitter.getPageRelativePath(); - } - } - - private static Class tryToGetComponentClass( - IPageAndComponentProvider pageAndComponentProvider) - { - try - { - return pageAndComponentProvider.getComponent().getClass(); - } - catch (Exception e) - { - // getComponent might fail if the page does not exist (ie session timeout) - return null; - } - } - - - private static String tryToGetComponentPath(IPageAndComponentProvider pageAndComponentProvider) - { - try - { - return pageAndComponentProvider.getComponentPath(); - } - catch (Exception e) - { - // getComponentPath might fail if the page does not exist (ie session timeout) - return null; - } - } - - private static Component tryToGetFormSubmittingComponent( - IPageAndComponentProvider pageAndComponentProvider) - { - try - { + final Component formSubmitter = optional(() -> { final IRequestableComponent component = pageAndComponentProvider.getComponent(); if (component instanceof Form) { @@ -117,11 +73,14 @@ public class ListenerLogData extends PageLogData return submitter
[wicket] 02/02: WICKET-6908 detach all handlers
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch wicket-8.x in repository https://gitbox.apache.org/repos/asf/wicket.git commit 53b487c8849419e68afb6055148432cb9ca86bc9 Author: Sven Meier AuthorDate: Mon Jul 26 22:03:05 2021 +0200 WICKET-6908 detach all handlers even if one throws a RuntimeException --- .../apache/wicket/request/RequestHandlerExecutor.java| 16 +++- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/wicket-request/src/main/java/org/apache/wicket/request/RequestHandlerExecutor.java b/wicket-request/src/main/java/org/apache/wicket/request/RequestHandlerExecutor.java index 8d41bd2..ff7588a 100644 --- a/wicket-request/src/main/java/org/apache/wicket/request/RequestHandlerExecutor.java +++ b/wicket-request/src/main/java/org/apache/wicket/request/RequestHandlerExecutor.java @@ -151,21 +151,27 @@ public abstract class RequestHandlerExecutor active = null; } + RuntimeException rethrow = null;; for (IRequestHandler handler : inactiveRequestHandlers) { try { detach(handler); } - catch (RuntimeException exception) - { - throw exception; - } catch (Exception exception) { - log.error("Error detaching RequestHandler", exception); + if (rethrow == null && exception instanceof RuntimeException) { + rethrow = (RuntimeException) exception; + } else { + log.error("Error detaching RequestHandler", exception); + } } } + if (rethrow != null) { + // WICKET-6001 runtime exceptions are rethrown + // TODO obsolete should component-queueing be removed + throw rethrow; + } } /**
[wicket] 01/02: WICKET-6908 wrap exceptions for log data
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git commit 494657d2b7b8e1eb297b76120be20d41e0e9f5fe Author: Sven Meier AuthorDate: Mon Jul 26 21:37:01 2021 +0200 WICKET-6908 wrap exceptions for log data --- .../request/handler/logger/ListenerLogData.java| 79 +-- .../core/request/handler/logger/PageLogData.java | 27 --- .../handler/logger/ListenerLogDataTest.java| 92 ++ 3 files changed, 125 insertions(+), 73 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/logger/ListenerLogData.java b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/logger/ListenerLogData.java index c0f4165..da4887b 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/logger/ListenerLogData.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/logger/ListenerLogData.java @@ -35,9 +35,9 @@ public class ListenerLogData extends PageLogData private final Class componentClass; private final String componentPath; private final Integer behaviorIndex; - private Class behaviorClass; - private Class submittingComponentClass; - private String submittingComponentPath; + private final Class behaviorClass; + private final Class submittingComponentClass; + private final String submittingComponentPath; /** * Construct. @@ -48,68 +48,24 @@ public class ListenerLogData extends PageLogData public ListenerLogData(IPageAndComponentProvider pageAndComponentProvider, Integer behaviorIndex) { super(pageAndComponentProvider); - componentClass = tryToGetComponentClass(pageAndComponentProvider); - componentPath = tryToGetComponentPath(pageAndComponentProvider); + this.behaviorIndex = behaviorIndex; - if (behaviorIndex != null && componentClass != null) + + componentClass = optional(() -> pageAndComponentProvider.getComponent().getClass()); + componentPath = optional(() -> pageAndComponentProvider.getComponentPath()); + + if (behaviorIndex != null) { - try - { - behaviorClass = pageAndComponentProvider.getComponent() + behaviorClass = optional(() -> pageAndComponentProvider.getComponent() .getBehaviorById(behaviorIndex) - .getClass(); - } - catch (Exception ignore) - { - behaviorClass = null; - } + .getClass()); } else { behaviorClass = null; } - final Component formSubmitter = tryToGetFormSubmittingComponent(pageAndComponentProvider); - if (formSubmitter != null) - { - submittingComponentClass = formSubmitter.getClass(); - submittingComponentPath = formSubmitter.getPageRelativePath(); - } - } - - private static Class tryToGetComponentClass( - IPageAndComponentProvider pageAndComponentProvider) - { - try - { - return pageAndComponentProvider.getComponent().getClass(); - } - catch (Exception e) - { - // getComponent might fail if the page does not exist (ie session timeout) - return null; - } - } - - - private static String tryToGetComponentPath(IPageAndComponentProvider pageAndComponentProvider) - { - try - { - return pageAndComponentProvider.getComponentPath(); - } - catch (Exception e) - { - // getComponentPath might fail if the page does not exist (ie session timeout) - return null; - } - } - - private static Component tryToGetFormSubmittingComponent( - IPageAndComponentProvider pageAndComponentProvider) - { - try - { + final Component formSubmitter = optional(() -> { final IRequestableComponent component = pageAndComponentProvider.getComponent(); if (component instanceof Form) { @@ -117,11 +73,14 @@ public class ListenerLogData extends PageLogData return submitter
[wicket] branch master updated (90bbe8f -> 7c0009c)
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git. from 90bbe8f Fix javadoc errors new 494657d WICKET-6908 wrap exceptions for log data new 7c0009c WICKET-6908 detach all handlers The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../request/handler/logger/ListenerLogData.java| 79 +-- .../core/request/handler/logger/PageLogData.java | 27 --- .../handler/logger/ListenerLogDataTest.java| 92 ++ .../wicket/request/RequestHandlerExecutor.java | 16 ++-- 4 files changed, 136 insertions(+), 78 deletions(-) create mode 100644 wicket-core/src/test/java/org/apache/wicket/core/request/handler/logger/ListenerLogDataTest.java
[wicket] 02/02: WICKET-6908 detach all handlers
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git commit 7c0009c8dffcaa625525a87c9b1a381127594787 Author: Sven Meier AuthorDate: Mon Jul 26 22:03:05 2021 +0200 WICKET-6908 detach all handlers even if one throws a RuntimeException --- .../apache/wicket/request/RequestHandlerExecutor.java| 16 +++- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/wicket-request/src/main/java/org/apache/wicket/request/RequestHandlerExecutor.java b/wicket-request/src/main/java/org/apache/wicket/request/RequestHandlerExecutor.java index f60b27a..47df808 100644 --- a/wicket-request/src/main/java/org/apache/wicket/request/RequestHandlerExecutor.java +++ b/wicket-request/src/main/java/org/apache/wicket/request/RequestHandlerExecutor.java @@ -132,21 +132,27 @@ public abstract class RequestHandlerExecutor active = null; } + RuntimeException rethrow = null;; for (IRequestHandler handler : inactiveRequestHandlers) { try { detach(handler); } - catch (RuntimeException exception) - { - throw exception; - } catch (Exception exception) { - log.error("Error detaching RequestHandler", exception); + if (rethrow == null && exception instanceof RuntimeException) { + rethrow = (RuntimeException) exception; + } else { + log.error("Error detaching RequestHandler", exception); + } } } + if (rethrow != null) { + // WICKET-6001 runtime exceptions are rethrown + // TODO obsolete should component-queueing be removed + throw rethrow; + } } /**
[wicket] 01/02: WICKET-6908 wrap exceptions for log data
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch wicket-9.x in repository https://gitbox.apache.org/repos/asf/wicket.git commit b1c2d67d656970111407d384feabda87050b8ecd Author: Sven Meier AuthorDate: Mon Jul 26 21:37:01 2021 +0200 WICKET-6908 wrap exceptions for log data --- .../request/handler/logger/ListenerLogData.java| 79 +-- .../core/request/handler/logger/PageLogData.java | 27 --- .../handler/logger/ListenerLogDataTest.java| 92 ++ 3 files changed, 125 insertions(+), 73 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/logger/ListenerLogData.java b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/logger/ListenerLogData.java index c0f4165..da4887b 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/logger/ListenerLogData.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/logger/ListenerLogData.java @@ -35,9 +35,9 @@ public class ListenerLogData extends PageLogData private final Class componentClass; private final String componentPath; private final Integer behaviorIndex; - private Class behaviorClass; - private Class submittingComponentClass; - private String submittingComponentPath; + private final Class behaviorClass; + private final Class submittingComponentClass; + private final String submittingComponentPath; /** * Construct. @@ -48,68 +48,24 @@ public class ListenerLogData extends PageLogData public ListenerLogData(IPageAndComponentProvider pageAndComponentProvider, Integer behaviorIndex) { super(pageAndComponentProvider); - componentClass = tryToGetComponentClass(pageAndComponentProvider); - componentPath = tryToGetComponentPath(pageAndComponentProvider); + this.behaviorIndex = behaviorIndex; - if (behaviorIndex != null && componentClass != null) + + componentClass = optional(() -> pageAndComponentProvider.getComponent().getClass()); + componentPath = optional(() -> pageAndComponentProvider.getComponentPath()); + + if (behaviorIndex != null) { - try - { - behaviorClass = pageAndComponentProvider.getComponent() + behaviorClass = optional(() -> pageAndComponentProvider.getComponent() .getBehaviorById(behaviorIndex) - .getClass(); - } - catch (Exception ignore) - { - behaviorClass = null; - } + .getClass()); } else { behaviorClass = null; } - final Component formSubmitter = tryToGetFormSubmittingComponent(pageAndComponentProvider); - if (formSubmitter != null) - { - submittingComponentClass = formSubmitter.getClass(); - submittingComponentPath = formSubmitter.getPageRelativePath(); - } - } - - private static Class tryToGetComponentClass( - IPageAndComponentProvider pageAndComponentProvider) - { - try - { - return pageAndComponentProvider.getComponent().getClass(); - } - catch (Exception e) - { - // getComponent might fail if the page does not exist (ie session timeout) - return null; - } - } - - - private static String tryToGetComponentPath(IPageAndComponentProvider pageAndComponentProvider) - { - try - { - return pageAndComponentProvider.getComponentPath(); - } - catch (Exception e) - { - // getComponentPath might fail if the page does not exist (ie session timeout) - return null; - } - } - - private static Component tryToGetFormSubmittingComponent( - IPageAndComponentProvider pageAndComponentProvider) - { - try - { + final Component formSubmitter = optional(() -> { final IRequestableComponent component = pageAndComponentProvider.getComponent(); if (component instanceof Form) { @@ -117,11 +73,14 @@ public class ListenerLogData extends PageLogData return submitter
[wicket] 02/02: WICKET-6908 detach all handlers
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch wicket-9.x in repository https://gitbox.apache.org/repos/asf/wicket.git commit 6c88207455fb7e523b598c5fed760917ca6f00b5 Author: Sven Meier AuthorDate: Mon Jul 26 22:03:05 2021 +0200 WICKET-6908 detach all handlers even if one throws a RuntimeException --- .../apache/wicket/request/RequestHandlerExecutor.java| 16 +++- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/wicket-request/src/main/java/org/apache/wicket/request/RequestHandlerExecutor.java b/wicket-request/src/main/java/org/apache/wicket/request/RequestHandlerExecutor.java index f60b27a..47df808 100644 --- a/wicket-request/src/main/java/org/apache/wicket/request/RequestHandlerExecutor.java +++ b/wicket-request/src/main/java/org/apache/wicket/request/RequestHandlerExecutor.java @@ -132,21 +132,27 @@ public abstract class RequestHandlerExecutor active = null; } + RuntimeException rethrow = null;; for (IRequestHandler handler : inactiveRequestHandlers) { try { detach(handler); } - catch (RuntimeException exception) - { - throw exception; - } catch (Exception exception) { - log.error("Error detaching RequestHandler", exception); + if (rethrow == null && exception instanceof RuntimeException) { + rethrow = (RuntimeException) exception; + } else { + log.error("Error detaching RequestHandler", exception); + } } } + if (rethrow != null) { + // WICKET-6001 runtime exceptions are rethrown + // TODO obsolete should component-queueing be removed + throw rethrow; + } } /**
[wicket] branch wicket-9.x updated (5256d3c -> 6c88207)
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a change to branch wicket-9.x in repository https://gitbox.apache.org/repos/asf/wicket.git. from 5256d3c Fix javadoc errors new b1c2d67 WICKET-6908 wrap exceptions for log data new 6c88207 WICKET-6908 detach all handlers The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../request/handler/logger/ListenerLogData.java| 79 +-- .../core/request/handler/logger/PageLogData.java | 27 --- .../handler/logger/ListenerLogDataTest.java| 92 ++ .../wicket/request/RequestHandlerExecutor.java | 16 ++-- 4 files changed, 136 insertions(+), 78 deletions(-) create mode 100644 wicket-core/src/test/java/org/apache/wicket/core/request/handler/logger/ListenerLogDataTest.java
[wicket] branch WICKET-6908-detach-failure created (now 05ab776)
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a change to branch WICKET-6908-detach-failure in repository https://gitbox.apache.org/repos/asf/wicket.git. at 05ab776 WICKET-6908 detach all handlers This branch includes the following new commits: new 6dceb0c WICKET-6908 wrap exceptions for log data new 05ab776 WICKET-6908 detach all handlers The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
[wicket] 02/02: WICKET-6908 detach all handlers
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch WICKET-6908-detach-failure in repository https://gitbox.apache.org/repos/asf/wicket.git commit 05ab77655fb00d27ade1402b72db1dc6968b3dbe Author: Sven Meier AuthorDate: Mon Jul 26 22:03:05 2021 +0200 WICKET-6908 detach all handlers even if one throws a RuntimeException --- .../apache/wicket/request/RequestHandlerExecutor.java| 16 +++- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/wicket-request/src/main/java/org/apache/wicket/request/RequestHandlerExecutor.java b/wicket-request/src/main/java/org/apache/wicket/request/RequestHandlerExecutor.java index f60b27a..47df808 100644 --- a/wicket-request/src/main/java/org/apache/wicket/request/RequestHandlerExecutor.java +++ b/wicket-request/src/main/java/org/apache/wicket/request/RequestHandlerExecutor.java @@ -132,21 +132,27 @@ public abstract class RequestHandlerExecutor active = null; } + RuntimeException rethrow = null;; for (IRequestHandler handler : inactiveRequestHandlers) { try { detach(handler); } - catch (RuntimeException exception) - { - throw exception; - } catch (Exception exception) { - log.error("Error detaching RequestHandler", exception); + if (rethrow == null && exception instanceof RuntimeException) { + rethrow = (RuntimeException) exception; + } else { + log.error("Error detaching RequestHandler", exception); + } } } + if (rethrow != null) { + // WICKET-6001 runtime exceptions are rethrown + // TODO obsolete should component-queueing be removed + throw rethrow; + } } /**
[wicket] 01/02: WICKET-6908 wrap exceptions for log data
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch WICKET-6908-detach-failure in repository https://gitbox.apache.org/repos/asf/wicket.git commit 6dceb0cd86eee796203e335b8d23f667758aca41 Author: Sven Meier AuthorDate: Mon Jul 26 21:37:01 2021 +0200 WICKET-6908 wrap exceptions for log data --- .../request/handler/logger/ListenerLogData.java| 79 +-- .../core/request/handler/logger/PageLogData.java | 27 --- .../handler/logger/ListenerLogDataTest.java| 92 ++ 3 files changed, 125 insertions(+), 73 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/logger/ListenerLogData.java b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/logger/ListenerLogData.java index c0f4165..da4887b 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/logger/ListenerLogData.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/logger/ListenerLogData.java @@ -35,9 +35,9 @@ public class ListenerLogData extends PageLogData private final Class componentClass; private final String componentPath; private final Integer behaviorIndex; - private Class behaviorClass; - private Class submittingComponentClass; - private String submittingComponentPath; + private final Class behaviorClass; + private final Class submittingComponentClass; + private final String submittingComponentPath; /** * Construct. @@ -48,68 +48,24 @@ public class ListenerLogData extends PageLogData public ListenerLogData(IPageAndComponentProvider pageAndComponentProvider, Integer behaviorIndex) { super(pageAndComponentProvider); - componentClass = tryToGetComponentClass(pageAndComponentProvider); - componentPath = tryToGetComponentPath(pageAndComponentProvider); + this.behaviorIndex = behaviorIndex; - if (behaviorIndex != null && componentClass != null) + + componentClass = optional(() -> pageAndComponentProvider.getComponent().getClass()); + componentPath = optional(() -> pageAndComponentProvider.getComponentPath()); + + if (behaviorIndex != null) { - try - { - behaviorClass = pageAndComponentProvider.getComponent() + behaviorClass = optional(() -> pageAndComponentProvider.getComponent() .getBehaviorById(behaviorIndex) - .getClass(); - } - catch (Exception ignore) - { - behaviorClass = null; - } + .getClass()); } else { behaviorClass = null; } - final Component formSubmitter = tryToGetFormSubmittingComponent(pageAndComponentProvider); - if (formSubmitter != null) - { - submittingComponentClass = formSubmitter.getClass(); - submittingComponentPath = formSubmitter.getPageRelativePath(); - } - } - - private static Class tryToGetComponentClass( - IPageAndComponentProvider pageAndComponentProvider) - { - try - { - return pageAndComponentProvider.getComponent().getClass(); - } - catch (Exception e) - { - // getComponent might fail if the page does not exist (ie session timeout) - return null; - } - } - - - private static String tryToGetComponentPath(IPageAndComponentProvider pageAndComponentProvider) - { - try - { - return pageAndComponentProvider.getComponentPath(); - } - catch (Exception e) - { - // getComponentPath might fail if the page does not exist (ie session timeout) - return null; - } - } - - private static Component tryToGetFormSubmittingComponent( - IPageAndComponentProvider pageAndComponentProvider) - { - try - { + final Component formSubmitter = optional(() -> { final IRequestableComponent component = pageAndComponentProvider.getComponent(); if (component instanceof Form) { @@ -117,11 +73,14 @@ public class ListenerLogData extends PageLogData
[wicket] branch master updated: minor changes
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/master by this push: new d6c1659 minor changes d6c1659 is described below commit d6c1659f59853b0d2d4ab4220748c0db5dd54889 Author: Sven Meier AuthorDate: Mon Jul 26 01:19:27 2021 +0200 minor changes removed duplicated test dependencies corrected parent version for testing submodules corrected threadtests --- testing/wicket-arquillian/pom.xml | 7 +-- testing/wicket-common-tests/pom.xml| 5 -- testing/wicket-threadtest/pom.xml | 57 ++ .../apache/wicket/threadtest/apps/app1/Home.java | 3 +- .../wicket/threadtest/apps/app1/TestApp1.java | 29 +-- .../wicket/threadtest/apps/app2/TestApp2.java | 29 +-- .../apache/wicket/threadtest/tester/Tester.java| 4 +- wicket-bean-validation/pom.xml | 4 -- .../wicket-native-websocket-core/pom.xml | 4 -- .../wicket-native-websocket-javax/pom.xml | 5 -- 10 files changed, 53 insertions(+), 94 deletions(-) diff --git a/testing/wicket-arquillian/pom.xml b/testing/wicket-arquillian/pom.xml index 191d9db..b1ee2f7 100644 --- a/testing/wicket-arquillian/pom.xml +++ b/testing/wicket-arquillian/pom.xml @@ -21,7 +21,7 @@ org.apache.wicket wicket-parent - 9.0.0-M2-SNAPSHOT + 10.0.0-M1-SNAPSHOT ../../pom.xml @@ -110,11 +110,6 @@ provided - org.junit.jupiter - junit-jupiter-engine - test - - org.wildfly wildfly-weld diff --git a/testing/wicket-common-tests/pom.xml b/testing/wicket-common-tests/pom.xml index d8bcefd..b4ed490 100644 --- a/testing/wicket-common-tests/pom.xml +++ b/testing/wicket-common-tests/pom.xml @@ -129,11 +129,6 @@ wicket-http2-undertow test - - junit-jupiter-engine - org.junit.jupiter - test - diff --git a/testing/wicket-threadtest/pom.xml b/testing/wicket-threadtest/pom.xml index d8cb009..84598a3 100644 --- a/testing/wicket-threadtest/pom.xml +++ b/testing/wicket-threadtest/pom.xml @@ -20,7 +20,7 @@ org.apache.wicket wicket-parent - 9.0.0-SNAPSHOT + 10.0.0-M1-SNAPSHOT ../../pom.xml wicket-threadtest @@ -33,8 +33,28 @@ true + + + + commons-httpclient + commons-httpclient + 3.1 + + + commons-logging + commons-logging + + + + + + + commons-httpclient + commons-httpclient + + org.apache.wicket wicket-core @@ -44,48 +64,25 @@ org.eclipse.jetty - jetty-webapp - compile - - - org.eclipse.jetty jetty-server compile - org.httpunit - httpunit + org.eclipse.jetty + jetty-webapp compile - - - jakarta.servlet - servlet-api - - - - - commons-httpclient - commons-httpclient - 3.1 - - - commons-logging - commons-logging - - org.slf4j - slf4j-log4j12 + jcl-over
[wicket] 01/01: removed queuing
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch remove-queuing in repository https://gitbox.apache.org/repos/asf/wicket.git commit 070cb953b9afb13b3c6a21236cc9169d79a9b2d6 Author: Sven Meier AuthorDate: Wed Jun 2 23:06:39 2021 +0200 removed queuing --- .../java/org/apache/wicket/ChildToDequeueType.java | 49 - .../java/org/apache/wicket/DequeueContext.java | 301 -- .../java/org/apache/wicket/DequeueTagAction.java | 27 - .../main/java/org/apache/wicket/IQueueRegion.java | 61 -- .../java/org/apache/wicket/MarkupContainer.java| 348 -- .../src/main/java/org/apache/wicket/Page.java |3 +- .../apache/wicket/markup/html/border/Border.java | 147 +-- .../markup/html/form/FormComponentPanel.java |3 +- .../apache/wicket/markup/html/panel/Fragment.java | 17 +- .../org/apache/wicket/markup/html/panel/Panel.java | 26 +- .../wicket/markup/repeater/AbstractRepeater.java | 32 +- .../apache/wicket/BehavioursDetachTestPage.java|2 +- .../apache/wicket/OnComponentTagListenerTest.java |5 +- .../markup/html/border/BorderWithFormPage.java | 40 - .../markup/html/border/ComponentBorderTest.java| 24 - .../markup/html/internal/AjaxEnclosurePage_4.java |8 +- .../html/internal/ListViewInContainerPage.java |4 +- .../wicket/markupFragments/MarkupFragmentTest.java |3 - .../queueing/ComponentQueueingPerformanceTest.java | 400 --- .../wicket/queueing/ComponentQueueingTest.java | 1135 .../queueing/transparentresolvers/SubPage.java |2 +- .../TransparentContainerQueuePage.java |2 +- .../ajax/builtin/modal/ModalDialogPage.java| 39 +- 23 files changed, 42 insertions(+), 2636 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/ChildToDequeueType.java b/wicket-core/src/main/java/org/apache/wicket/ChildToDequeueType.java deleted file mode 100644 index 29cfdfe..000 --- a/wicket-core/src/main/java/org/apache/wicket/ChildToDequeueType.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.wicket; - -import org.apache.wicket.markup.html.border.Border; - -public enum ChildToDequeueType -{ - NULL, GENERIC_COMPONENT, MARKUP_CONTAINER, BORDER, QUEUE_REGION; - - public static ChildToDequeueType fromChild(Component child) - { - if (child == null) - { - return NULL; - } - - if (child instanceof Border) - { - return BORDER; - } - - if (child instanceof IQueueRegion) - { - return QUEUE_REGION; - } - - if (child instanceof MarkupContainer) - { - return MARKUP_CONTAINER; - } - - return GENERIC_COMPONENT; - } -} diff --git a/wicket-core/src/main/java/org/apache/wicket/DequeueContext.java b/wicket-core/src/main/java/org/apache/wicket/DequeueContext.java deleted file mode 100644 index 9c431e9..000 --- a/wicket-core/src/main/java/org/apache/wicket/DequeueContext.java +++ /dev/null @@ -1,301 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the
[wicket] branch remove-queuing updated (adbf35e -> 070cb95)
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a change to branch remove-queuing in repository https://gitbox.apache.org/repos/asf/wicket.git. discard adbf35e removed queuing add 67165d1 Update javax.inject:inject:1 to jakarta.inject:inject:2.0.0 add 7f8a61a Update Mockito to 3.11.0 add b66ab27 WICKET-6893 Use DefaultListableBeanFactory as a delegate in ApplicationContextMock add 9da8061 Fix a typo in javadoc add 9c241b8 Non-functional changes add 139bd6b Minor simplification. Non-functional change add 5897251 Update Jetty to 11.0.4 and Spring to 5.3.8 add 6a75c7c Update Mockito to 3.11.1 add f37 Add a profile for JDK 18 add 43888b6 WICKET-895 Links to examples in documentation not points to old version of 8x add 99f3c12 WICKET-6896 AutoCompleteTextField re-opens dropdown item list after item has been selected add c8974ee WICKET-6897 Javadoc build fails on fresh checkout of master or rel/wicket-9.3.0 add d79c4c2 WICKET-6897 Javadoc build fails on fresh checkout of master or rel/wicket-9.3.0 add f0d01b8 Remove dependencies which already come as transitive ones from wicket-native-websocket-core add 5136688 WICKET-6897 Javadoc build fails on fresh checkout of master or rel/wicket-9.3.0 add 47deef3 Do not fail the build when maven-javadoc-plugin fails add e1f1662 Add a profile for JDK EA (17+) that fixes the url to the javadocs add 6d4f2b3 WICKET-6897 Javadoc build fails on fresh checkout of master or rel/wicket-9.3.0 add ebee64a WICKET-6897 Fix the linking of the sources in javadoc add f201226 Update Mockito to 3.11.2 add 0c747f4 WICKET-6899 Add setExceptionMapperProvider() to Application add 191ac59 Do not fail the build on Javadoc errors add 1f95c72 Minor non-functional cleanup: add 2ec7b18 WICKET-6901 document size modifier add 0e9c7de WICKET-6904 Make Apache Wicket fully supporting Java9+ module system add 24d390d Fix failing test by updating the resource url scheme to HTTPS add 336d5b7 WICKET-6904 Make Apache Wicket fully supporting Java9+ module system add d74e466 WICKET-6904 Make Apache Wicket fully supporting Java9+ module system add edd4fa0 WICKET-6903 Replace maven-clirr-plugin with something newer add a479020 WICKET-6901 Rename ITagModifier.NoOp to NO_OP add fa65fd7 WICKET-6902 allow prepend and append add 887b4b3 WICKET-6906 removed deprecations add 966b18f Minor non-functional changes. add a9d13a9 WICKET-6907 Upgrade Guice to 5.x add e43285a WICKET-6906 removed further deprecations new 070cb95 removed queuing This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (adbf35e) \ N -- N -- N refs/heads/remove-queuing (070cb95) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: archetypes/quickstart/pom.xml |5 + pom.xml| 208 +-- testing/wicket-common-tests/pom.xml|3 +- .../wicket/osgi/OsgiClashingPackagesTest.java | 13 +- testing/wicket-js-tests/pom.xml|3 +- testing/wicket-threadtest/pom.xml |2 +- wicket-auth-roles/pom.xml |4 - .../src/main/java/module-info.java | 59 +- .../util/license/ApacheLicenceHeaderTest.java |4 +- .../util/markup/xhtml/WellFormedXmlTest.java | 69 +- wicket-bean-validation/pom.xml | 22 +- .../src/main/java/module-info.java | 12 +- .../validation/BeanValidationConfiguration.java| 29 +- .../bean/validation/BeanValidationContext.java | 16 + .../wicket/bean/validation/ConstraintIterator.java | 16 + .../bean/validation/DefaultPropertyResolver.java | 16 + .../bean/validation/DefaultValidatorProvider.java | 16 + .../validation/DefaultViolationTranslator.java | 16 + .../apache/wicket/bean/validation/GroupsModel.java | 16 + .../wicket/bean/validation/IPropertyResolver.java | 18 +- .../wicket/bean/validation/IT
[wicket] branch master updated: WICKET-6906 removed further deprecations
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/master by this push: new e43285a WICKET-6906 removed further deprecations e43285a is described below commit e43285aaa08f63e85bc60834342924572c1cb7dc Author: Sven Meier AuthorDate: Tue Jul 20 13:11:51 2021 +0200 WICKET-6906 removed further deprecations --- .../apache/wicket/core/util/string/CssUtils.java | 67 --- .../wicket/core/util/string/JavaScriptUtils.java | 194 - .../ajax/markup/html/modal/ModalDialog.java| 3 - .../java/org/apache/wicket/util/crypt/ICrypt.java | 4 - .../contrib/velocity/VelocityJavaScriptPage.java | 11 +- 5 files changed, 8 insertions(+), 271 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/core/util/string/CssUtils.java b/wicket-core/src/main/java/org/apache/wicket/core/util/string/CssUtils.java index 7a69547..99d627c 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/util/string/CssUtils.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/util/string/CssUtils.java @@ -56,25 +56,6 @@ public final class CssUtils /** * Write the simple text to the response object surrounded by a style tag. -* -* @param response -*The HTTP: response -* @param text -*The text to added in between the style tags -* @param id -*Unique identifier of element -* @deprecated please use {@link #writeInlineStyle(Response, CharSequence, AttributeMap)} instead -*/ - @Deprecated - public static void writeCss(final Response response, final CharSequence text, String id) - { - writeOpenTag(response, id); - response.write(text); - writeCloseTag(response); - } - - /** -* Write the simple text to the response object surrounded by a style tag. * In most cases the text simply an inline CSS. * * @param response @@ -133,54 +114,6 @@ public final class CssUtils * Writes a reference to a css file in the response object * * @param response -*the response to write to -* @param url -*the url of the css reference -* @param media -*the CSS media -* @param markupId -*the markupId -* @deprecated please use {@link #writeLink(Response, AttributeMap)} instead -*/ - @Deprecated - public static void writeLinkUrl(final Response response, final CharSequence url, - final CharSequence media, final String markupId) - { - CssUtils.writeLinkUrl(response, url, media, markupId, null); - } - - /** -* Writes a reference to a css file in the response object -* -* @param response -*the response to write to -* @param url -*the url of the css reference -* @param media -*the CSS media -* @param markupId -*the markupId -* @param rel -*the rel attribute -* @deprecated please use {@link #writeLink(Response, AttributeMap)} instead -*/ - @Deprecated - public static void writeLinkUrl(final Response response, final CharSequence url, - final CharSequence media, final String markupId, final String rel) - { - AttributeMap attributes = new AttributeMap(); - attributes.putAttribute(ATTR_LINK_REL, Strings.isEmpty(rel) ? "stylesheet" : rel); - attributes.putAttribute(ATTR_TYPE, "text/css"); - attributes.putAttribute(ATTR_LINK_HREF, url); - attributes.putAttribute(ATTR_LINK_MEDIA, media.toString()); - attributes.putAttribute(ATTR_ID, markupId); - writeLink(response, attributes); - } - - /** -* Writes a reference to a css file in the response object -* -* @param response * the response to write to * @param attributes * Attributes map diff --git a/wicket-core/src/main/java/org/apache/wicket/core/util/string/JavaScriptUtils.java b/wicket-core/src/main/java/org/apache/wicket/core/util/string/JavaScriptUtils.java index 4038fe5..bd8629c 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/util/string/JavaScriptUtils.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/util/string/JavaScriptUtils.java @@ -55,35 +55,6 @@ public class JavaScriptUtils public static final String ATTR_CROSS_ORIGIN = "crossOrigin"; public static final String ATTR_INTEGRITY = "int
[wicket] branch master updated (a479020 -> 887b4b3)
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git. from a479020 WICKET-6901 Rename ITagModifier.NoOp to NO_OP new fa65fd7 WICKET-6902 allow prepend and append new 887b4b3 WICKET-6906 removed deprecations The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../main/java/org/apache/wicket/Application.java | 23 - .../wicket/ajax/AbstractAjaxTimerBehavior.java | 14 - .../org/apache/wicket/ajax/AjaxEventBehavior.java |9 +- .../org/apache/wicket/ajax/AjaxRequestHandler.java | 12 +- .../org/apache/wicket/ajax/AjaxRequestTarget.java | 40 +- .../wicket/ajax/AjaxSelfUpdatingTimerBehavior.java | 15 +- .../strategy/DefaultAuthenticationStrategy.java| 46 - .../wicket/core/util/crypt/AbstractJceCrypt.java |9 +- .../util/crypt/KeyInSessionSunJceCryptFactory.java | 11 - .../html/navigation/paging/PagingNavigation.java |1 - .../org/apache/wicket/page/PartialPageUpdate.java | 40 +- .../apache/wicket/page/XmlPartialPageUpdate.java | 10 - .../http/CsrfPreventionRequestCycleListener.java | 612 .../wicket/protocol/http/WebApplication.java | 26 +- .../filter/AjaxServerAndClientTimeFilter.java | 132 -- .../response/filter/ServerAndClientTimeFilter.java | 106 -- .../apache/wicket/settings/SecuritySettings.java | 11 +- .../apache/wicket/ajax/AjaxRequestHandlerTest.java | 58 +- .../core/request/mapper/CryptoMapperTest.java |2 +- .../markup/html/form/encryption/CryptTest.java |3 +- .../CsrfPreventionRequestCycleListenerTest.java| 658 .../CryptedUrlWebRequestCodingStrategyTest.java|5 - .../examples/ajax/builtin/AjaxApplication.java |3 - .../ajax/builtin/modal/ModalContent1Page.html | 24 - .../ajax/builtin/modal/ModalContent1Page.java | 101 -- .../ajax/builtin/modal/ModalContent2Page.html | 20 - .../ajax/builtin/modal/ModalContent2Page.java | 49 - .../examples/ajax/builtin/modal/ModalPanel1.html |9 - .../examples/ajax/builtin/modal/ModalPanel1.java | 53 - .../ajax/builtin/modal/ModalWindowPage.html| 10 - .../ajax/builtin/modal/ModalWindowPage.java| 116 -- .../examples/repeater/RepeaterApplication.java |1 - .../wicket/examples/tree/TreeApplication.java |1 - .../markup/html/form/upload/UploadProgressBar.java | 23 +- .../ajax/markup/html/modal/ModalWindow.html| 21 - .../ajax/markup/html/modal/ModalWindow.java| 1184 --- .../markup/html/modal/res/frame-blue-1-alpha.png | Bin 2706 -> 0 bytes .../ajax/markup/html/modal/res/frame-blue-1-ie.png | Bin 1672 -> 0 bytes .../markup/html/modal/res/frame-blue-2-alpha.png | Bin 272 -> 0 bytes .../ajax/markup/html/modal/res/frame-blue-2-ie.png | Bin 245 -> 0 bytes .../markup/html/modal/res/frame-gray-1-alpha.png | Bin 2568 -> 0 bytes .../ajax/markup/html/modal/res/frame-gray-1-ie.png | Bin 1578 -> 0 bytes .../markup/html/modal/res/frame-gray-2-alpha.png | Bin 264 -> 0 bytes .../ajax/markup/html/modal/res/frame-gray-2-ie.png | Bin 245 -> 0 bytes .../ajax/markup/html/modal/res/modal.css | 264 .../extensions/ajax/markup/html/modal/res/modal.js | 1594 .../ajax/markup/html/modal/res/transparent1.gif| Bin 156 -> 0 bytes .../ajax/markup/html/modal/res/transparent2.png| Bin 425 -> 0 bytes .../markup/html/form/select/SelectOptions.java | 40 +- ...ketAwareCsrfPreventionRequestCycleListener.java | 45 - .../apache/wicket/util/collections/MicroMap.java | 359 - .../apache/wicket/util/crypt/AbstractCrypt.java|1 - .../util/crypt/CachingSunJceCryptFactory.java | 39 - .../wicket/util/crypt/ClassCryptFactory.java | 98 -- .../java/org/apache/wicket/util/crypt/ICrypt.java | 13 - .../java/org/apache/wicket/util/crypt/NoCrypt.java | 11 - .../org/apache/wicket/util/crypt/SunJceCrypt.java | 36 - .../org/apache/wicket/util/time/AbstractTime.java | 122 -- .../apache/wicket/util/time/AbstractTimeValue.java | 55 - .../java/org/apache/wicket/util/time/Duration.java | 565 --- .../apache/wicket/util/time/ITimeFrameSource.java | 41 - .../java/org/apache/wicket/util/time/Time.java | 615 .../org/apache/wicket/util/time/TimeFrame.java | 261 .../java/org/apache/wicket/util/time/TimeMap.java | 111 -- .../org/apache/wicket/util/time/TimeOfDay.java | 420 -- .../wicket/util/collections/MicroMapTest.java | 105 -- .../apache/wicket/util/crypt/SunJceCryptTest.java |6 +- 67 files changed, 99 in
[wicket] 01/02: WICKET-6902 allow prepend and append
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git commit fa65fd754ca9345dd966d04204521d7edbe645ec Author: Sven Meier AuthorDate: Sat Jul 17 00:18:02 2021 +0200 WICKET-6902 allow prepend and append up-to including #onAfterRespond() --- .../org/apache/wicket/ajax/AjaxRequestHandler.java | 12 + .../org/apache/wicket/ajax/AjaxRequestTarget.java | 45 + .../org/apache/wicket/page/PartialPageUpdate.java | 22 +++- .../apache/wicket/ajax/AjaxRequestHandlerTest.java | 58 -- 4 files changed, 98 insertions(+), 39 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestHandler.java b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestHandler.java index 78699bf..fd54daa 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestHandler.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestHandler.java @@ -145,19 +145,9 @@ public class AjaxRequestHandler extends AbstractPartialPageRequestHandler implem final Map components = Collections .unmodifiableMap(markupIdToComponent); - // create response that will be used by listeners to append javascript - final AjaxRequestTarget.IJavaScriptResponse jsresponse = new AjaxRequestTarget.IJavaScriptResponse() - { - @Override - public void addJavaScript(String script) - { - writeEvaluations(response, Collections. singleton(script)); - } - }; - for (AjaxRequestTarget.IListener listener : listeners) { - listener.onAfterRespond(components, jsresponse); + listener.onAfterRespond(components, AjaxRequestHandler.this); } } } diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java index 6c874dc..2e1efb6 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java @@ -38,35 +38,54 @@ public interface AjaxRequestTarget extends IPartialPageRequestHandler, ILoggable interface IListener { /** -* Triggered before ajax request target begins its response cycle +* Triggered before the target begins writing components. * * @param map *modifiable map (markupId -> component) of components already added to the target * @param target *the target itself. Could be used to add components or to append/prepend -*javascript +*JavaScript * */ default void onBeforeRespond(Map map, AjaxRequestTarget target) {} /** -* Triggered after ajax request target is done with its response cycle. At this point only -* additional javascript can be output to the response using the provided -* {@link AjaxRequestTarget.IJavaScriptResponse} object +* Triggered after the target has written components. At this point only +* additional JavaScript can be added to the response. * -* NOTE: During this stage of processing any calls to target that manipulate the response -* (adding components, javascript) will have no effect +* NOTE: During this stage of processing any calls that manipulate components will result in +* an exception. * * @param map *read-only map:markupId->component of components already added to the target * @param response -*response object that can be used to output javascript +*response object that can be used to output JavaScript +* +* @deprecated implement {@link #onAfterRespond(Map, AjaxRequestTarget)} i
[wicket] branch wicket-9.x updated: WICKET-6902 allow prepend and append
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch wicket-9.x in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/wicket-9.x by this push: new 23c1584 WICKET-6902 allow prepend and append 23c1584 is described below commit 23c1584636d374ee380a8f5b9fb25aef969ee3f8 Author: Sven Meier AuthorDate: Sat Jul 17 00:18:02 2021 +0200 WICKET-6902 allow prepend and append up-to including #onAfterRespond() --- .../org/apache/wicket/ajax/AjaxRequestHandler.java | 12 + .../org/apache/wicket/ajax/AjaxRequestTarget.java | 45 + .../org/apache/wicket/page/PartialPageUpdate.java | 22 +++- .../apache/wicket/ajax/AjaxRequestHandlerTest.java | 58 -- 4 files changed, 98 insertions(+), 39 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestHandler.java b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestHandler.java index 78699bf..fd54daa 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestHandler.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestHandler.java @@ -145,19 +145,9 @@ public class AjaxRequestHandler extends AbstractPartialPageRequestHandler implem final Map components = Collections .unmodifiableMap(markupIdToComponent); - // create response that will be used by listeners to append javascript - final AjaxRequestTarget.IJavaScriptResponse jsresponse = new AjaxRequestTarget.IJavaScriptResponse() - { - @Override - public void addJavaScript(String script) - { - writeEvaluations(response, Collections. singleton(script)); - } - }; - for (AjaxRequestTarget.IListener listener : listeners) { - listener.onAfterRespond(components, jsresponse); + listener.onAfterRespond(components, AjaxRequestHandler.this); } } } diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java index 6c874dc..2e1efb6 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java @@ -38,35 +38,54 @@ public interface AjaxRequestTarget extends IPartialPageRequestHandler, ILoggable interface IListener { /** -* Triggered before ajax request target begins its response cycle +* Triggered before the target begins writing components. * * @param map *modifiable map (markupId -> component) of components already added to the target * @param target *the target itself. Could be used to add components or to append/prepend -*javascript +*JavaScript * */ default void onBeforeRespond(Map map, AjaxRequestTarget target) {} /** -* Triggered after ajax request target is done with its response cycle. At this point only -* additional javascript can be output to the response using the provided -* {@link AjaxRequestTarget.IJavaScriptResponse} object +* Triggered after the target has written components. At this point only +* additional JavaScript can be added to the response. * -* NOTE: During this stage of processing any calls to target that manipulate the response -* (adding components, javascript) will have no effect +* NOTE: During this stage of processing any calls that manipulate components will result in +* an exception. * * @param map *read-only map:markupId->component of components already added to the target * @param response -*response object that can be used to output javascript +*response object that can be used to output Java
[wicket] branch WICKET-6902-js-after-components created (now 1f20642)
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a change to branch WICKET-6902-js-after-components in repository https://gitbox.apache.org/repos/asf/wicket.git. at 1f20642 WICKET-6902 allow prepend and append This branch includes the following new commits: new 1f20642 WICKET-6902 allow prepend and append The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
[wicket] 01/01: WICKET-6902 allow prepend and append
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch WICKET-6902-js-after-components in repository https://gitbox.apache.org/repos/asf/wicket.git commit 1f2064274c8c5385e66a71ff3445bdf84871561a Author: Sven Meier AuthorDate: Sat Jul 17 00:18:02 2021 +0200 WICKET-6902 allow prepend and append up-to including #onAfterRespond() --- pom.xml| 5 +++ .../org/apache/wicket/ajax/AjaxRequestHandler.java | 12 +- .../org/apache/wicket/ajax/AjaxRequestTarget.java | 45 -- .../org/apache/wicket/page/PartialPageUpdate.java | 22 ++- .../apache/wicket/ajax/AjaxRequestHandlerTest.java | 44 ++--- 5 files changed, 90 insertions(+), 38 deletions(-) diff --git a/pom.xml b/pom.xml index eb5088a..241d0a5 100644 --- a/pom.xml +++ b/pom.xml @@ -1153,6 +1153,11 @@ org/apache/wicket/pageStore/IPageStore void end(org.apache.wicket.pageStore.IPageContext) + + 7012 + org/apache/wicket/ajax/AjaxRequestTarget$IListener + void onAfterRespond(java.util.Map, org.apache.wicket.ajax.AjaxRequestTarget) + diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestHandler.java b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestHandler.java index 78699bf..fd54daa 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestHandler.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestHandler.java @@ -145,19 +145,9 @@ public class AjaxRequestHandler extends AbstractPartialPageRequestHandler implem final Map components = Collections .unmodifiableMap(markupIdToComponent); - // create response that will be used by listeners to append javascript - final AjaxRequestTarget.IJavaScriptResponse jsresponse = new AjaxRequestTarget.IJavaScriptResponse() - { - @Override - public void addJavaScript(String script) - { - writeEvaluations(response, Collections. singleton(script)); - } - }; - for (AjaxRequestTarget.IListener listener : listeners) { - listener.onAfterRespond(components, jsresponse); + listener.onAfterRespond(components, AjaxRequestHandler.this); } } } diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java index 6c874dc..2e1efb6 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java @@ -38,35 +38,54 @@ public interface AjaxRequestTarget extends IPartialPageRequestHandler, ILoggable interface IListener { /** -* Triggered before ajax request target begins its response cycle +* Triggered before the target begins writing components. * * @param map *modifiable map (markupId -> component) of components already added to the target * @param target *the target itself. Could be used to add components or to append/prepend -*javascript +*JavaScript * */ default void onBeforeRespond(Map map, AjaxRequestTarget target) {} /** -* Triggered after ajax request target is done with its response cycle. At this point only -* additional javascript can be output to the response using the provided -* {@l
[wicket] branch master updated: WICKET-6901 document size modifier
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/master by this push: new 2ec7b18 WICKET-6901 document size modifier 2ec7b18 is described below commit 2ec7b18def4568281289a268636761a4f5ff57ce Author: Sven Meier AuthorDate: Thu Jul 15 13:20:31 2021 +0200 WICKET-6901 document size modifier --- .../wicket/bean/validation/BeanValidationConfiguration.java | 13 - .../org/apache/wicket/bean/validation/ITagModifier.java | 5 - .../apache/wicket/bean/validation/PropertyValidator.java| 7 --- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/BeanValidationConfiguration.java b/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/BeanValidationConfiguration.java index 5399c83..747643c 100644 --- a/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/BeanValidationConfiguration.java +++ b/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/BeanValidationConfiguration.java @@ -69,7 +69,13 @@ public class BeanValidationConfiguration implements BeanValidationContext } /** -* Registeres a tag modifier for a specific constraint annotation +* Registers a tag modifier for a specific constraint annotation. +* +* By default {@link Size} constraints are automatically mapped to maxlength of text inputs, +* this can be disabled by registering a {@link ITagModifier#NoOp} instead: +* +* configuration.register(Size.class, ITagModifier.NoOp}); +* * * @param annotationType *constraint annotation such as {@link Size} @@ -88,6 +94,11 @@ public class BeanValidationConfiguration implements BeanValidationContext return this; } + /** +* Get the registered modifier for the given annotation. +* +* @see #register(Class, ITagModifier) +*/ @Override @SuppressWarnings("unchecked") public ITagModifier getTagModifier(Class annotationType) diff --git a/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/ITagModifier.java b/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/ITagModifier.java index 2daef97..958d9d6 100644 --- a/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/ITagModifier.java +++ b/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/ITagModifier.java @@ -29,4 +29,7 @@ public interface ITagModifier *constraint annotation */ void modify(FormComponent component, ComponentTag tag, T annotation); -} + + public static final ITagModifier NoOp = (component, tag, annotation) -> { + }; +} \ No newline at end of file diff --git a/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/PropertyValidator.java b/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/PropertyValidator.java index be35f36..ba40075 100644 --- a/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/PropertyValidator.java +++ b/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/PropertyValidator.java @@ -32,14 +32,15 @@ import org.apache.wicket.validation.IValidatable; * * * The validator will set the required flag on the form component it is attached to based on the - * presence of the @NotNull annotation. Notice, the required flag will only be set to {@code true}, + * presence of the @NotNull annotation, see {@link BeanValidationContext#isRequiredConstraint(ConstraintDescriptor)} + * for details. Notice, the required flag will only be set to {@code true}, * components with the required flag already set to {@code true} will not have the flag set to * {@code false} by this validator. * * * - * The validator will allow {@link ITagModifier}s configured in {@link BeanValidationConfiguration} - * to mutate the markup tag of the component it is attached to. + * The validator will allow {@link ITagModifier}s registered on {@link BeanValidationContext} + * to mutate the markup tag of the component it is attached to, e.g. add a maxlength attribute. * * *
[wicket] branch wicket-9.x updated: WICKET-6901 document size modifier
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch wicket-9.x in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/wicket-9.x by this push: new a8e5176 WICKET-6901 document size modifier a8e5176 is described below commit a8e5176a9c83ed928d82a2e05f5e0489b6939865 Author: Sven Meier AuthorDate: Thu Jul 15 13:20:31 2021 +0200 WICKET-6901 document size modifier --- .../wicket/bean/validation/BeanValidationConfiguration.java | 13 - .../org/apache/wicket/bean/validation/ITagModifier.java | 5 - .../apache/wicket/bean/validation/PropertyValidator.java| 7 --- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/BeanValidationConfiguration.java b/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/BeanValidationConfiguration.java index 7971c84..5182d69 100644 --- a/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/BeanValidationConfiguration.java +++ b/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/BeanValidationConfiguration.java @@ -69,7 +69,13 @@ public class BeanValidationConfiguration implements BeanValidationContext } /** -* Registeres a tag modifier for a specific constraint annotation +* Registers a tag modifier for a specific constraint annotation. +* +* By default {@link Size} constraints are automatically mapped to maxlength of text inputs, +* this can be disabled by registering a {@link ITagModifier#NoOp} instead: +* +* configuration.register(Size.class, ITagModifier.NoOp}); +* * * @param annotationType *constraint annotation such as {@link Size} @@ -88,6 +94,11 @@ public class BeanValidationConfiguration implements BeanValidationContext return this; } + /** +* Get the registered modifier for the given annotation. +* +* @see #register(Class, ITagModifier) +*/ @Override @SuppressWarnings("unchecked") public ITagModifier getTagModifier(Class annotationType) diff --git a/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/ITagModifier.java b/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/ITagModifier.java index 962d9b1..9e42410 100644 --- a/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/ITagModifier.java +++ b/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/ITagModifier.java @@ -29,4 +29,7 @@ public interface ITagModifier *constraint annotation */ void modify(FormComponent component, ComponentTag tag, T annotation); -} + + public static final ITagModifier NoOp = (component, tag, annotation) -> { + }; +} \ No newline at end of file diff --git a/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/PropertyValidator.java b/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/PropertyValidator.java index 437c04a..91be1ef 100644 --- a/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/PropertyValidator.java +++ b/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/PropertyValidator.java @@ -32,14 +32,15 @@ import org.apache.wicket.validation.IValidatable; * * * The validator will set the required flag on the form component it is attached to based on the - * presence of the @NotNull annotation. Notice, the required flag will only be set to {@code true}, + * presence of the @NotNull annotation, see {@link BeanValidationContext#isRequiredConstraint(ConstraintDescriptor)} + * for details. Notice, the required flag will only be set to {@code true}, * components with the required flag already set to {@code true} will not have the flag set to * {@code false} by this validator. * * * - * The validator will allow {@link ITagModifier}s configured in {@link BeanValidationConfiguration} - * to mutate the markup tag of the component it is attached to. + * The validator will allow {@link ITagModifier}s registered on {@link BeanValidationContext} + * to mutate the markup tag of the component it is attached to, e.g. add a maxlength attribute. * * *
[wicket] branch remove-queuing created (now adbf35e)
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a change to branch remove-queuing in repository https://gitbox.apache.org/repos/asf/wicket.git. at adbf35e removed queuing This branch includes the following new commits: new adbf35e removed queuing The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
[wicket] 01/01: removed queuing
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch remove-queuing in repository https://gitbox.apache.org/repos/asf/wicket.git commit adbf35e6176ea69a36e5c7eaf1f514fac99cb91e Author: Sven Meier AuthorDate: Wed Jun 2 23:06:39 2021 +0200 removed queuing --- .../java/org/apache/wicket/ChildToDequeueType.java | 49 - .../java/org/apache/wicket/DequeueContext.java | 301 -- .../java/org/apache/wicket/DequeueTagAction.java | 27 - .../main/java/org/apache/wicket/IQueueRegion.java | 61 -- .../java/org/apache/wicket/MarkupContainer.java| 340 -- .../src/main/java/org/apache/wicket/Page.java |3 +- .../apache/wicket/markup/html/border/Border.java | 147 +-- .../markup/html/form/FormComponentPanel.java |3 +- .../apache/wicket/markup/html/panel/Fragment.java | 17 +- .../org/apache/wicket/markup/html/panel/Panel.java |3 +- .../wicket/markup/repeater/AbstractRepeater.java | 32 +- .../apache/wicket/BehavioursDetachTestPage.java|2 +- .../apache/wicket/OnComponentTagListenerTest.java |5 +- .../markup/html/border/BorderWithFormPage.java | 40 - .../markup/html/border/ComponentBorderTest.java| 24 - .../markup/html/internal/AjaxEnclosurePage_4.java |8 +- .../html/internal/ListViewInContainerPage.java |4 +- .../wicket/markupFragments/MarkupFragmentTest.java |3 - .../queueing/ComponentQueueingPerformanceTest.java | 400 --- .../wicket/queueing/ComponentQueueingTest.java | 1135 .../queueing/transparentresolvers/SubPage.java |2 +- .../TransparentContainerQueuePage.java |2 +- .../ajax/builtin/modal/ModalDialogPage.java| 39 +- 23 files changed, 41 insertions(+), 2606 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/ChildToDequeueType.java b/wicket-core/src/main/java/org/apache/wicket/ChildToDequeueType.java deleted file mode 100644 index 29cfdfe..000 --- a/wicket-core/src/main/java/org/apache/wicket/ChildToDequeueType.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.wicket; - -import org.apache.wicket.markup.html.border.Border; - -public enum ChildToDequeueType -{ - NULL, GENERIC_COMPONENT, MARKUP_CONTAINER, BORDER, QUEUE_REGION; - - public static ChildToDequeueType fromChild(Component child) - { - if (child == null) - { - return NULL; - } - - if (child instanceof Border) - { - return BORDER; - } - - if (child instanceof IQueueRegion) - { - return QUEUE_REGION; - } - - if (child instanceof MarkupContainer) - { - return MARKUP_CONTAINER; - } - - return GENERIC_COMPONENT; - } -} diff --git a/wicket-core/src/main/java/org/apache/wicket/DequeueContext.java b/wicket-core/src/main/java/org/apache/wicket/DequeueContext.java deleted file mode 100644 index 9c431e9..000 --- a/wicket-core/src/main/java/org/apache/wicket/DequeueContext.java +++ /dev/null @@ -1,301 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the
[wicket] branch wicket-8.x updated (37364bb -> bf24867)
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a change to branch wicket-8.x in repository https://gitbox.apache.org/repos/asf/wicket.git. from 37364bb Add scope = col to Columnheaders (#468) new df4130a WICKET-6886 make methods interface default new bf24867 WICKET-6886 LambdaChoiceRenderer with unit tests The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../wicket/markup/html/form/ChoiceRenderer.java| 16 --- .../wicket/markup/html/form/IChoiceRenderer.java | 19 ++- .../markup/html/form/LambdaChoiceRenderer.java | 131 + .../html/form/EscapeAttributesInChoicesPage.java | 8 +- .../markup/html/form/LambdaChoiceRendererTest.java | 90 ++ .../examples/compref/DropDownChoicePage.java | 4 +- .../wicket/examples/datetime/DateTimePage.java | 3 +- .../wicket/examples/forminput/FormInput.java | 6 +- .../markup/html/form/palette/PaletteTestPage.java | 3 +- 9 files changed, 249 insertions(+), 31 deletions(-) create mode 100644 wicket-core/src/main/java/org/apache/wicket/markup/html/form/LambdaChoiceRenderer.java create mode 100644 wicket-core/src/test/java/org/apache/wicket/markup/html/form/LambdaChoiceRendererTest.java
[wicket] 02/02: WICKET-6886 LambdaChoiceRenderer with unit tests
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch wicket-8.x in repository https://gitbox.apache.org/repos/asf/wicket.git commit bf24867bd61ae3fb4ecd083d74ae736a113f0f07 Author: Roland Kurucz AuthorDate: Fri May 21 22:04:04 2021 +0200 WICKET-6886 LambdaChoiceRenderer with unit tests --- .../markup/html/form/LambdaChoiceRenderer.java | 131 + .../markup/html/form/LambdaChoiceRendererTest.java | 90 ++ 2 files changed, 221 insertions(+) diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/LambdaChoiceRenderer.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/LambdaChoiceRenderer.java new file mode 100644 index 000..79070fa --- /dev/null +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/LambdaChoiceRenderer.java @@ -0,0 +1,131 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.wicket.markup.html.form; + +import org.danekja.java.util.function.serializable.SerializableFunction; + +/** + * Renders one choice. Separates the 'id' values used for internal representation from 'display + * values' which are the values shown to the user of components that use this renderer. + * + * Usage: + * + * + * new DropDownChoice<User>("users", new Model<User>(selectedUser), listOfUsers, + * new LambdaChoiceRenderer<User>(User::getName)) + * + * + * creates a DropDownChoice of users and the display value will be looked up by function + * (User::getName) and the id the index of the object in the ListOfUsers + * + * + * + * + * new DropDownChoice<User>("users", new Model<User>(selectedUser), listOfUsers, + * new LambdaChoiceRenderer<User>(User::getName, User::getId)) + * + * + * creates a DropDownChoice of users and the display value will be looked up by function + * (User::getName) and the id will be looked up by the function (User::getId) + * + * + * @param The model object type + * @author + */ +public class LambdaChoiceRenderer implements IChoiceRenderer { +private static final long serialVersionUID = 1L; + +/** + * function for getting the display value. + */ +private final SerializableFunction displayExpression; + +/** + * function for getting the id. + */ +private final SerializableFunction idExpression; + +/** + * Constructor. + * + * When you use this constructor, the display value will be determined by calling + * toString() on the list object, and the id will be based on the list index. the id value will + * be the index + */ +public LambdaChoiceRenderer() { +this(null); +} + +/** + * Constructor. + * + * When you use this constructor, the display value will be determined by executing + * the given function on the list object, and the id will be based on the list index. + * The display value will be calculated by the given function + * + * @param displayExpression A function to get the display value + */ +public LambdaChoiceRenderer(SerializableFunction displayExpression) { +this(displayExpression, null); +} + +/** + * Constructor. + * + * When you use this constructor, both the id and the display value will be + * determined by executing the given functions on the list object. + * + * @param displayExpression A function to get the display value + * @param idExpression A function to get the id value + */ +public LambdaChoiceRenderer(SerializableFunction displayExpression, SerializableFunction idExpression) { +this.displayExpression = displayExpression; +this.idExpression = idExpression; +} + +@Override +public Object getDisplayValue(T object) { +Object returnValue = object; +if ((displayExpression != null) && (object != null)) { +returnValue = displayExpression.apply(object); +} + +if (returnValue == null) { +return ""; +} + +return returnValue; +} + +@Over
[wicket] 01/02: WICKET-6886 make methods interface default
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch wicket-8.x in repository https://gitbox.apache.org/repos/asf/wicket.git commit df4130a2eec2a32528ef0a83a061e3a9efefc69a Author: Sven Meier AuthorDate: Fri May 21 23:11:21 2021 +0200 WICKET-6886 make methods interface default --- .../wicket/markup/html/form/ChoiceRenderer.java | 16 .../wicket/markup/html/form/IChoiceRenderer.java | 19 +-- .../html/form/EscapeAttributesInChoicesPage.java | 8 .../wicket/examples/compref/DropDownChoicePage.java | 4 ++-- .../apache/wicket/examples/datetime/DateTimePage.java | 3 +-- .../apache/wicket/examples/forminput/FormInput.java | 6 +++--- .../markup/html/form/palette/PaletteTestPage.java | 3 +-- 7 files changed, 28 insertions(+), 31 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/ChoiceRenderer.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/ChoiceRenderer.java index 96e4fb2..5a52fa6 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/ChoiceRenderer.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/ChoiceRenderer.java @@ -154,20 +154,4 @@ public class ChoiceRenderer implements IChoiceRenderer, IClusterable return returnValue.toString(); } - - @Override - public T getObject(String id, IModel> choices) - { - List _choices = choices.getObject(); - for (int index = 0; index < _choices.size(); index++) - { - // Get next choice - final T choice = _choices.get(index); - if (getIdValue(choice, index).equals(id)) - { - return choice; - } - } - return null; - } } diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/IChoiceRenderer.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/IChoiceRenderer.java index 5fcc14e..3e47aaa 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/IChoiceRenderer.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/IChoiceRenderer.java @@ -55,7 +55,9 @@ public interface IChoiceRenderer extends IDetachable *The index of the object in the choices list. * @return String */ - String getIdValue(T object, int index); + default String getIdValue(T object, int index) { + return Integer.toString(index); + } /** * This method is called to get an object back from its id representation. @@ -69,7 +71,20 @@ public interface IChoiceRenderer extends IDetachable * The list of all rendered choices * @return A choice from the list that has this {@code id} */ - T getObject(String id, IModel> choices); + default T getObject(String id, IModel> choices) + { + List _choices = choices.getObject(); + for (int index = 0; index < _choices.size(); index++) + { + // Get next choice + final T choice = _choices.get(index); + if (getIdValue(choice, index).equals(id)) + { + return choice; + } + } + return null; + } /** * Override when needed. diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/form/EscapeAttributesInChoicesPage.java b/wicket-core/src/test/java/org/apache/wicket/markup/html/form/EscapeAttributesInChoicesPage.java index a6051fa..cfcd006 100644 --- a/wicket-core/src/test/java/org/apache/wicket/markup/html/form/EscapeAttributesInChoicesPage.java +++ b/wicket-core/src/test/java/org/apache/wicket/markup/html/form/EscapeAttributesInChoicesPage.java @@ -16,13 +16,13 @@ */ package org.apache.wicket.markup.html.form; -import org.apache.wicket.markup.html.WebPage; -import org.apache.wicket.request.mapper.parameter.PageParameters; - import java.util.ArrayList; import java.util.HashMap; import java.util.Map; +import org.apache.wicket.markup.html.WebPage; +import org.apache.wicket.request.mapper.parameter.PageParameters; + public class EscapeAttributesInChoicesPage extends WebPage { private static final long serialVersionUID = 1L; @@ -32,7 +32,7 @@ public class EscapeAttributesInChoicesPage extends WebPage { final Map fruits = new HashMap<>(); fruits.put("apple\" onmouseover=\"alert('hi');\" \"", "Apple"); - IChoiceRenderer iChoiceRenderer = new ChoiceRenderer() { + IChoiceRenderer iChoi
[wicket] 01/02: WICKET-6886 make methods interface default
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git commit 14e46162f3f65035e0afd026af3c8af976284085 Author: Sven Meier AuthorDate: Fri May 21 23:11:21 2021 +0200 WICKET-6886 make methods interface default --- .../wicket/markup/html/form/ChoiceRenderer.java | 16 .../wicket/markup/html/form/EnumChoiceRenderer.java | 2 +- .../wicket/markup/html/form/IChoiceRenderer.java | 19 +-- .../html/form/EscapeAttributesInChoicesPage.java | 8 .../wicket/examples/compref/DropDownChoicePage.java | 4 ++-- .../apache/wicket/examples/datetime/DateTimePage.java | 3 +-- .../apache/wicket/examples/forminput/FormInput.java | 6 +++--- .../markup/html/form/palette/PaletteTestPage.java | 3 +-- 8 files changed, 29 insertions(+), 32 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/ChoiceRenderer.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/ChoiceRenderer.java index 96e4fb2..5a52fa6 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/ChoiceRenderer.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/ChoiceRenderer.java @@ -154,20 +154,4 @@ public class ChoiceRenderer implements IChoiceRenderer, IClusterable return returnValue.toString(); } - - @Override - public T getObject(String id, IModel> choices) - { - List _choices = choices.getObject(); - for (int index = 0; index < _choices.size(); index++) - { - // Get next choice - final T choice = _choices.get(index); - if (getIdValue(choice, index).equals(id)) - { - return choice; - } - } - return null; - } } diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/EnumChoiceRenderer.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/EnumChoiceRenderer.java index b2129b9..565cbe4 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/EnumChoiceRenderer.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/EnumChoiceRenderer.java @@ -36,7 +36,7 @@ import org.apache.wicket.util.lang.Classes; * * @param */ -public class EnumChoiceRenderer> extends ChoiceRenderer +public class EnumChoiceRenderer> implements IChoiceRenderer { private static final long serialVersionUID = 1L; diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/IChoiceRenderer.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/IChoiceRenderer.java index 5fcc14e..3e47aaa 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/IChoiceRenderer.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/IChoiceRenderer.java @@ -55,7 +55,9 @@ public interface IChoiceRenderer extends IDetachable *The index of the object in the choices list. * @return String */ - String getIdValue(T object, int index); + default String getIdValue(T object, int index) { + return Integer.toString(index); + } /** * This method is called to get an object back from its id representation. @@ -69,7 +71,20 @@ public interface IChoiceRenderer extends IDetachable * The list of all rendered choices * @return A choice from the list that has this {@code id} */ - T getObject(String id, IModel> choices); + default T getObject(String id, IModel> choices) + { + List _choices = choices.getObject(); + for (int index = 0; index < _choices.size(); index++) + { + // Get next choice + final T choice = _choices.get(index); + if (getIdValue(choice, index).equals(id)) + { + return choice; + } + } + return null; + } /** * Override when needed. diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/form/EscapeAttributesInChoicesPage.java b/wicket-core/src/test/java/org/apache/wicket/markup/html/form/EscapeAttributesInChoicesPage.java index a6051fa..cfcd006 100644 --- a/wicket-core/src/test/java/org/apache/wicket/markup/html/form/EscapeAttributesInChoicesPage.java +++ b/wicket-core/src/test/java/org/apache/wicket/markup/html/form/EscapeAttributesInChoicesPage.java @@ -16,13 +16,13 @@ */ package org.apache.wicket.markup.html.form; -import org.apache.wicket.markup.html.WebPage; -import org.apache.wicket.request.mapper.par
[wicket] 02/02: WICKET-6886 LambdaChoiceRenderer with unit tests
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git commit 6a930ee1fa7e1b657a5703c11b86ee51685a9e30 Author: Roland Kurucz AuthorDate: Fri May 21 22:04:04 2021 +0200 WICKET-6886 LambdaChoiceRenderer with unit tests --- .../markup/html/form/LambdaChoiceRenderer.java | 131 + .../markup/html/form/LambdaChoiceRendererTest.java | 90 ++ 2 files changed, 221 insertions(+) diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/LambdaChoiceRenderer.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/LambdaChoiceRenderer.java new file mode 100644 index 000..79070fa --- /dev/null +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/LambdaChoiceRenderer.java @@ -0,0 +1,131 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.wicket.markup.html.form; + +import org.danekja.java.util.function.serializable.SerializableFunction; + +/** + * Renders one choice. Separates the 'id' values used for internal representation from 'display + * values' which are the values shown to the user of components that use this renderer. + * + * Usage: + * + * + * new DropDownChoice<User>("users", new Model<User>(selectedUser), listOfUsers, + * new LambdaChoiceRenderer<User>(User::getName)) + * + * + * creates a DropDownChoice of users and the display value will be looked up by function + * (User::getName) and the id the index of the object in the ListOfUsers + * + * + * + * + * new DropDownChoice<User>("users", new Model<User>(selectedUser), listOfUsers, + * new LambdaChoiceRenderer<User>(User::getName, User::getId)) + * + * + * creates a DropDownChoice of users and the display value will be looked up by function + * (User::getName) and the id will be looked up by the function (User::getId) + * + * + * @param The model object type + * @author + */ +public class LambdaChoiceRenderer implements IChoiceRenderer { +private static final long serialVersionUID = 1L; + +/** + * function for getting the display value. + */ +private final SerializableFunction displayExpression; + +/** + * function for getting the id. + */ +private final SerializableFunction idExpression; + +/** + * Constructor. + * + * When you use this constructor, the display value will be determined by calling + * toString() on the list object, and the id will be based on the list index. the id value will + * be the index + */ +public LambdaChoiceRenderer() { +this(null); +} + +/** + * Constructor. + * + * When you use this constructor, the display value will be determined by executing + * the given function on the list object, and the id will be based on the list index. + * The display value will be calculated by the given function + * + * @param displayExpression A function to get the display value + */ +public LambdaChoiceRenderer(SerializableFunction displayExpression) { +this(displayExpression, null); +} + +/** + * Constructor. + * + * When you use this constructor, both the id and the display value will be + * determined by executing the given functions on the list object. + * + * @param displayExpression A function to get the display value + * @param idExpression A function to get the id value + */ +public LambdaChoiceRenderer(SerializableFunction displayExpression, SerializableFunction idExpression) { +this.displayExpression = displayExpression; +this.idExpression = idExpression; +} + +@Override +public Object getDisplayValue(T object) { +Object returnValue = object; +if ((displayExpression != null) && (object != null)) { +returnValue = displayExpression.apply(object); +} + +if (returnValue == null) { +return ""; +} + +return returnValue; +} + +@Over
[wicket] branch master updated (8fe1667 -> 6a930ee)
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git. from 8fe1667 Update JUnit to 5.7.2, frontend-maven-plugin to 1.12.0, Node.js to 14.17.0 and NPM to 7.13.0 new 14e4616 WICKET-6886 make methods interface default new 6a930ee WICKET-6886 LambdaChoiceRenderer with unit tests The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../wicket/markup/html/form/ChoiceRenderer.java| 16 --- .../markup/html/form/EnumChoiceRenderer.java | 2 +- .../wicket/markup/html/form/IChoiceRenderer.java | 19 ++- .../markup/html/form/LambdaChoiceRenderer.java | 131 + .../html/form/EscapeAttributesInChoicesPage.java | 8 +- .../markup/html/form/LambdaChoiceRendererTest.java | 90 ++ .../examples/compref/DropDownChoicePage.java | 4 +- .../wicket/examples/datetime/DateTimePage.java | 3 +- .../wicket/examples/forminput/FormInput.java | 6 +- .../markup/html/form/palette/PaletteTestPage.java | 3 +- 10 files changed, 250 insertions(+), 32 deletions(-) create mode 100644 wicket-core/src/main/java/org/apache/wicket/markup/html/form/LambdaChoiceRenderer.java create mode 100644 wicket-core/src/test/java/org/apache/wicket/markup/html/form/LambdaChoiceRendererTest.java
[wicket] branch wicket-9.x updated (e581689 -> bf4a901)
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a change to branch wicket-9.x in repository https://gitbox.apache.org/repos/asf/wicket.git. from e581689 Update JUnit to 5.7.2, frontend-maven-plugin to 1.12.0, Node.js to 14.17.0 and NPM to 7.13.0 new 5829f86 WICKET-6886 make methods interface default new bf4a901 WICKET-6886 LambdaChoiceRenderer with unit tests The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../wicket/markup/html/form/ChoiceRenderer.java| 16 --- .../wicket/markup/html/form/IChoiceRenderer.java | 19 ++- .../markup/html/form/LambdaChoiceRenderer.java | 131 + .../html/form/EscapeAttributesInChoicesPage.java | 8 +- .../markup/html/form/LambdaChoiceRendererTest.java | 90 ++ .../examples/compref/DropDownChoicePage.java | 4 +- .../wicket/examples/datetime/DateTimePage.java | 3 +- .../wicket/examples/forminput/FormInput.java | 6 +- .../markup/html/form/palette/PaletteTestPage.java | 3 +- 9 files changed, 249 insertions(+), 31 deletions(-) create mode 100644 wicket-core/src/main/java/org/apache/wicket/markup/html/form/LambdaChoiceRenderer.java create mode 100644 wicket-core/src/test/java/org/apache/wicket/markup/html/form/LambdaChoiceRendererTest.java
[wicket] 02/02: WICKET-6886 LambdaChoiceRenderer with unit tests
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch wicket-9.x in repository https://gitbox.apache.org/repos/asf/wicket.git commit bf4a90185fb8be2ceecfaeb3fa1003c166fe7761 Author: Roland Kurucz AuthorDate: Fri May 21 22:04:04 2021 +0200 WICKET-6886 LambdaChoiceRenderer with unit tests --- .../markup/html/form/LambdaChoiceRenderer.java | 131 + .../markup/html/form/LambdaChoiceRendererTest.java | 90 ++ 2 files changed, 221 insertions(+) diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/LambdaChoiceRenderer.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/LambdaChoiceRenderer.java new file mode 100644 index 000..79070fa --- /dev/null +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/LambdaChoiceRenderer.java @@ -0,0 +1,131 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.wicket.markup.html.form; + +import org.danekja.java.util.function.serializable.SerializableFunction; + +/** + * Renders one choice. Separates the 'id' values used for internal representation from 'display + * values' which are the values shown to the user of components that use this renderer. + * + * Usage: + * + * + * new DropDownChoice<User>("users", new Model<User>(selectedUser), listOfUsers, + * new LambdaChoiceRenderer<User>(User::getName)) + * + * + * creates a DropDownChoice of users and the display value will be looked up by function + * (User::getName) and the id the index of the object in the ListOfUsers + * + * + * + * + * new DropDownChoice<User>("users", new Model<User>(selectedUser), listOfUsers, + * new LambdaChoiceRenderer<User>(User::getName, User::getId)) + * + * + * creates a DropDownChoice of users and the display value will be looked up by function + * (User::getName) and the id will be looked up by the function (User::getId) + * + * + * @param The model object type + * @author + */ +public class LambdaChoiceRenderer implements IChoiceRenderer { +private static final long serialVersionUID = 1L; + +/** + * function for getting the display value. + */ +private final SerializableFunction displayExpression; + +/** + * function for getting the id. + */ +private final SerializableFunction idExpression; + +/** + * Constructor. + * + * When you use this constructor, the display value will be determined by calling + * toString() on the list object, and the id will be based on the list index. the id value will + * be the index + */ +public LambdaChoiceRenderer() { +this(null); +} + +/** + * Constructor. + * + * When you use this constructor, the display value will be determined by executing + * the given function on the list object, and the id will be based on the list index. + * The display value will be calculated by the given function + * + * @param displayExpression A function to get the display value + */ +public LambdaChoiceRenderer(SerializableFunction displayExpression) { +this(displayExpression, null); +} + +/** + * Constructor. + * + * When you use this constructor, both the id and the display value will be + * determined by executing the given functions on the list object. + * + * @param displayExpression A function to get the display value + * @param idExpression A function to get the id value + */ +public LambdaChoiceRenderer(SerializableFunction displayExpression, SerializableFunction idExpression) { +this.displayExpression = displayExpression; +this.idExpression = idExpression; +} + +@Override +public Object getDisplayValue(T object) { +Object returnValue = object; +if ((displayExpression != null) && (object != null)) { +returnValue = displayExpression.apply(object); +} + +if (returnValue == null) { +return ""; +} + +return returnValue; +} + +@Over
[wicket] 01/02: WICKET-6886 make methods interface default
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch wicket-9.x in repository https://gitbox.apache.org/repos/asf/wicket.git commit 5829f869afa828b84417a79d62b0d30e0ea4445c Author: Sven Meier AuthorDate: Fri May 21 23:11:21 2021 +0200 WICKET-6886 make methods interface default --- .../wicket/markup/html/form/ChoiceRenderer.java | 16 .../wicket/markup/html/form/IChoiceRenderer.java | 19 +-- .../html/form/EscapeAttributesInChoicesPage.java | 8 .../wicket/examples/compref/DropDownChoicePage.java | 4 ++-- .../apache/wicket/examples/datetime/DateTimePage.java | 3 +-- .../apache/wicket/examples/forminput/FormInput.java | 6 +++--- .../markup/html/form/palette/PaletteTestPage.java | 3 +-- 7 files changed, 28 insertions(+), 31 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/ChoiceRenderer.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/ChoiceRenderer.java index 96e4fb2..5a52fa6 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/ChoiceRenderer.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/ChoiceRenderer.java @@ -154,20 +154,4 @@ public class ChoiceRenderer implements IChoiceRenderer, IClusterable return returnValue.toString(); } - - @Override - public T getObject(String id, IModel> choices) - { - List _choices = choices.getObject(); - for (int index = 0; index < _choices.size(); index++) - { - // Get next choice - final T choice = _choices.get(index); - if (getIdValue(choice, index).equals(id)) - { - return choice; - } - } - return null; - } } diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/IChoiceRenderer.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/IChoiceRenderer.java index 5fcc14e..3e47aaa 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/IChoiceRenderer.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/IChoiceRenderer.java @@ -55,7 +55,9 @@ public interface IChoiceRenderer extends IDetachable *The index of the object in the choices list. * @return String */ - String getIdValue(T object, int index); + default String getIdValue(T object, int index) { + return Integer.toString(index); + } /** * This method is called to get an object back from its id representation. @@ -69,7 +71,20 @@ public interface IChoiceRenderer extends IDetachable * The list of all rendered choices * @return A choice from the list that has this {@code id} */ - T getObject(String id, IModel> choices); + default T getObject(String id, IModel> choices) + { + List _choices = choices.getObject(); + for (int index = 0; index < _choices.size(); index++) + { + // Get next choice + final T choice = _choices.get(index); + if (getIdValue(choice, index).equals(id)) + { + return choice; + } + } + return null; + } /** * Override when needed. diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/form/EscapeAttributesInChoicesPage.java b/wicket-core/src/test/java/org/apache/wicket/markup/html/form/EscapeAttributesInChoicesPage.java index a6051fa..cfcd006 100644 --- a/wicket-core/src/test/java/org/apache/wicket/markup/html/form/EscapeAttributesInChoicesPage.java +++ b/wicket-core/src/test/java/org/apache/wicket/markup/html/form/EscapeAttributesInChoicesPage.java @@ -16,13 +16,13 @@ */ package org.apache.wicket.markup.html.form; -import org.apache.wicket.markup.html.WebPage; -import org.apache.wicket.request.mapper.parameter.PageParameters; - import java.util.ArrayList; import java.util.HashMap; import java.util.Map; +import org.apache.wicket.markup.html.WebPage; +import org.apache.wicket.request.mapper.parameter.PageParameters; + public class EscapeAttributesInChoicesPage extends WebPage { private static final long serialVersionUID = 1L; @@ -32,7 +32,7 @@ public class EscapeAttributesInChoicesPage extends WebPage { final Map fruits = new HashMap<>(); fruits.put("apple\" onmouseover=\"alert('hi');\" \"", "Apple"); - IChoiceRenderer iChoiceRenderer = new ChoiceRenderer() { + IChoiceRenderer iChoi
[wicket] branch master updated: ambiguous code
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/master by this push: new 35c86d3 ambiguous code 35c86d3 is described below commit 35c86d333b5a09922f9b2807c264a4a61ac9dc51 Author: Martin Funk AuthorDate: Tue Mar 2 18:16:17 2021 +0100 ambiguous code this closes #464 --- .../src/main/java/org/apache/wicket/behavior/AttributeAppender.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/behavior/AttributeAppender.java b/wicket-core/src/main/java/org/apache/wicket/behavior/AttributeAppender.java index 055cf62..8f08a7d 100644 --- a/wicket-core/src/main/java/org/apache/wicket/behavior/AttributeAppender.java +++ b/wicket-core/src/main/java/org/apache/wicket/behavior/AttributeAppender.java @@ -149,7 +149,7 @@ public class AttributeAppender extends AttributeModifier // Short circuit when one of the values is empty: return the other value. if (Strings.isEmpty(currentValue)) { - return appendValue != null ? appendValue : null; + return appendValue; } else if (Strings.isEmpty(appendValue)) {
[wicket] branch master updated (fa607d2 -> 9b641a3)
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git. from fa607d2 Update Mockito and Jetty new 82e4521 WICKET-6871 isLoaded() might be called before rendering new 9b641a3 WICKET-6868 ajax submit allow trigger submit on form The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../wicket/ajax/form/AjaxFormSubmitBehavior.java | 26 ++ .../wicket/ajax/markup/html/form/AjaxButton.java | 17 ++ .../ajax/markup/html/form/AjaxFallbackButton.java | 17 ++ .../examples/ajax/builtin/FileUploadPage.java | 9 .../ajax/markup/html/AjaxLazyLoadPanel.java| 3 ++- 5 files changed, 71 insertions(+), 1 deletion(-)
[wicket] 02/02: WICKET-6868 ajax submit allow trigger submit on form
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git commit 9b641a35a4827281d8863d8e0693de225f49bf64 Author: Sven Meier AuthorDate: Sat Feb 20 00:47:34 2021 +0100 WICKET-6868 ajax submit allow trigger submit on form --- .../wicket/ajax/form/AjaxFormSubmitBehavior.java | 26 ++ .../wicket/ajax/markup/html/form/AjaxButton.java | 17 ++ .../ajax/markup/html/form/AjaxFallbackButton.java | 17 ++ .../examples/ajax/builtin/FileUploadPage.java | 9 4 files changed, 69 insertions(+) diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java b/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java index 0caca83..23137b1 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java @@ -19,6 +19,7 @@ package org.apache.wicket.ajax.form; import org.apache.wicket.Component; import org.apache.wicket.ajax.AjaxEventBehavior; import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.ajax.attributes.AjaxCallListener; import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; import org.apache.wicket.ajax.attributes.AjaxRequestAttributes.Method; import org.apache.wicket.markup.html.form.Button; @@ -139,6 +140,17 @@ public abstract class AjaxFormSubmitBehavior extends AjaxEventBehavior } } + /** +* Controls whether or not a JS submit should be triggered on the submitting form. +* False by default. +* +* @return true if submit should be triggered, false otherwise +*/ + protected boolean shouldTriggerJavaScriptSubmitEvent() + { + return false; + } + @Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { @@ -165,6 +177,20 @@ public abstract class AjaxFormSubmitBehavior extends AjaxEventBehavior String submittingComponentName = submittingComponent.getInputName(); attributes.setSubmittingComponentName(submittingComponentName); } + + if (shouldTriggerJavaScriptSubmitEvent()) { + attributes.getAjaxCallListeners().add(new AjaxCallListener() { + @Override + public CharSequence getPrecondition(Component component) + { + return String.format("var p, f = jQuery('#%s'), fn = function(e) { p = e.isDefaultPrevented(); e.preventDefault(); };" // + + "f.on('submit',fn);" // + + "f.trigger('submit');" // + + "f.off('submit',fn);" // + + "return !p;", form.getMarkupId()); + } + }); + } } @Override diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java index b0b5139..1f460ac 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java @@ -135,6 +135,12 @@ public abstract class AjaxButton extends Button AjaxButton.this.updateAjaxAttributes(attributes); } + + @Override + protected boolean shouldTriggerJavaScriptSubmitEvent() + { + return AjaxButton.this.shouldTriggerJavaScriptSubmitEvent(); + } @Override public boolean getDefaultProcessing() @@ -150,6 +156,17 @@ public abstract class AjaxButton extends Button }; } + /** +* Controls whether or not a JS submit should be triggered on the submitting form. +* False by default. +* +* @return true if submit should be triggered, false otherwise +*/ + protected boolean shouldTriggerJavaScriptSubmitEvent() + { + return false; + } + protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { } diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxFallbackButton.java b/wicket-core/s
[wicket] 01/02: WICKET-6871 isLoaded() might be called before rendering
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git commit 82e4521fd3543ac65f8212c4f9171c02d570d95a Author: Sven Meier AuthorDate: Thu Feb 25 18:37:35 2021 +0100 WICKET-6871 isLoaded() might be called before rendering on nested lazy panels --- .../apache/wicket/extensions/ajax/markup/html/AjaxLazyLoadPanel.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxLazyLoadPanel.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxLazyLoadPanel.java index ff715aa..c0eeadb 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxLazyLoadPanel.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxLazyLoadPanel.java @@ -211,7 +211,8 @@ public abstract class AjaxLazyLoadPanel extends Panel T content = getLazyLoadComponent(CONTENT_ID); // replace the loading component with the new component - AjaxLazyLoadPanel.this.replace(content); + // note: use addOrReplace(), since onConfigure() might not have been called yet + AjaxLazyLoadPanel.this.addOrReplace(content); Optional target = getRequestCycle().find(AjaxRequestTarget.class);
[wicket] 01/02: WICKET-6871 isLoaded() might be called before rendering
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch wicket-8.x in repository https://gitbox.apache.org/repos/asf/wicket.git commit c6f7afda7944be6482a67b84bf31502148b7a9e6 Author: Sven Meier AuthorDate: Thu Feb 25 18:37:35 2021 +0100 WICKET-6871 isLoaded() might be called before rendering on nested lazy panels --- .../apache/wicket/extensions/ajax/markup/html/AjaxLazyLoadPanel.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxLazyLoadPanel.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxLazyLoadPanel.java index 4142ff5..0e8be9d 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxLazyLoadPanel.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxLazyLoadPanel.java @@ -244,7 +244,8 @@ public abstract class AjaxLazyLoadPanel extends Panel T content = getLazyLoadComponent(CONTENT_ID); // replace the loading component with the new component - AjaxLazyLoadPanel.this.replace(content); + // note: use addOrReplace(), since onConfigure() might not have been called yet + AjaxLazyLoadPanel.this.addOrReplace(content); Optional target = getRequestCycle().find(AjaxRequestTarget.class);
[wicket] branch wicket-8.x updated (56ba547 -> 24c67b3)
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a change to branch wicket-8.x in repository https://gitbox.apache.org/repos/asf/wicket.git. from 56ba547 WICKET-6865 check element count before UP or DOWN new c6f7afd WICKET-6871 isLoaded() might be called before rendering new 24c67b3 WICKET-6868 ajax submit allow trigger submit on form The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../wicket/ajax/form/AjaxFormSubmitBehavior.java | 26 ++ .../wicket/ajax/markup/html/form/AjaxButton.java | 17 ++ .../ajax/markup/html/form/AjaxFallbackButton.java | 17 ++ .../examples/ajax/builtin/FileUploadPage.java | 9 .../ajax/markup/html/AjaxLazyLoadPanel.java| 3 ++- 5 files changed, 71 insertions(+), 1 deletion(-)
[wicket] 02/02: WICKET-6868 ajax submit allow trigger submit on form
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch wicket-8.x in repository https://gitbox.apache.org/repos/asf/wicket.git commit 24c67b33b383147191ac9a60564da7b01ac2360e Author: Sven Meier AuthorDate: Sat Feb 20 00:47:34 2021 +0100 WICKET-6868 ajax submit allow trigger submit on form --- .../wicket/ajax/form/AjaxFormSubmitBehavior.java | 26 ++ .../wicket/ajax/markup/html/form/AjaxButton.java | 17 ++ .../ajax/markup/html/form/AjaxFallbackButton.java | 17 ++ .../examples/ajax/builtin/FileUploadPage.java | 9 4 files changed, 69 insertions(+) diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java b/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java index 0caca83..23137b1 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java @@ -19,6 +19,7 @@ package org.apache.wicket.ajax.form; import org.apache.wicket.Component; import org.apache.wicket.ajax.AjaxEventBehavior; import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.ajax.attributes.AjaxCallListener; import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; import org.apache.wicket.ajax.attributes.AjaxRequestAttributes.Method; import org.apache.wicket.markup.html.form.Button; @@ -139,6 +140,17 @@ public abstract class AjaxFormSubmitBehavior extends AjaxEventBehavior } } + /** +* Controls whether or not a JS submit should be triggered on the submitting form. +* False by default. +* +* @return true if submit should be triggered, false otherwise +*/ + protected boolean shouldTriggerJavaScriptSubmitEvent() + { + return false; + } + @Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { @@ -165,6 +177,20 @@ public abstract class AjaxFormSubmitBehavior extends AjaxEventBehavior String submittingComponentName = submittingComponent.getInputName(); attributes.setSubmittingComponentName(submittingComponentName); } + + if (shouldTriggerJavaScriptSubmitEvent()) { + attributes.getAjaxCallListeners().add(new AjaxCallListener() { + @Override + public CharSequence getPrecondition(Component component) + { + return String.format("var p, f = jQuery('#%s'), fn = function(e) { p = e.isDefaultPrevented(); e.preventDefault(); };" // + + "f.on('submit',fn);" // + + "f.trigger('submit');" // + + "f.off('submit',fn);" // + + "return !p;", form.getMarkupId()); + } + }); + } } @Override diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java index b0b5139..1f460ac 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java @@ -135,6 +135,12 @@ public abstract class AjaxButton extends Button AjaxButton.this.updateAjaxAttributes(attributes); } + + @Override + protected boolean shouldTriggerJavaScriptSubmitEvent() + { + return AjaxButton.this.shouldTriggerJavaScriptSubmitEvent(); + } @Override public boolean getDefaultProcessing() @@ -150,6 +156,17 @@ public abstract class AjaxButton extends Button }; } + /** +* Controls whether or not a JS submit should be triggered on the submitting form. +* False by default. +* +* @return true if submit should be triggered, false otherwise +*/ + protected boolean shouldTriggerJavaScriptSubmitEvent() + { + return false; + } + protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { } diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxFallbackButton.java b/wicket-core/s
[wicket] branch WICKET-6868-ajax-submit-onsubmit updated: WICKET-6868 ajax submit allow trigger submit on form
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch WICKET-6868-ajax-submit-onsubmit in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/WICKET-6868-ajax-submit-onsubmit by this push: new b0f164a WICKET-6868 ajax submit allow trigger submit on form b0f164a is described below commit b0f164a4c70791e7b8e59918d656bfbcdfe33b2d Author: Sven Meier AuthorDate: Sat Feb 20 18:46:38 2021 +0100 WICKET-6868 ajax submit allow trigger submit on form --- .../apache/wicket/ajax/form/AjaxFormSubmitBehavior.java| 14 +- .../apache/wicket/ajax/markup/html/form/AjaxButton.java| 11 ++- .../wicket/ajax/markup/html/form/AjaxFallbackButton.java | 11 ++- .../wicket/examples/ajax/builtin/FileUploadPage.java | 4 ++-- 4 files changed, 23 insertions(+), 17 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java b/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java index 7446768..96a703b 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java @@ -141,12 +141,12 @@ public abstract class AjaxFormSubmitBehavior extends AjaxEventBehavior } /** -* Controls whether or not JS onsubmit() should be called on the submitting form. +* Controls whether or not a JS submit should be triggered on the submitting form. * False by default. * -* @return true if form's onsubmit() should be called, false otherwise +* @return true if submit should be triggered, false otherwise */ - protected boolean shouldCallJavaScriptOnsubmit() + protected boolean shouldTriggerJavaScriptSubmitEvent() { return false; } @@ -178,12 +178,16 @@ public abstract class AjaxFormSubmitBehavior extends AjaxEventBehavior attributes.setSubmittingComponentName(submittingComponentName); } - if (shouldCallJavaScriptOnsubmit()) { + if (shouldTriggerJavaScriptSubmitEvent()) { attributes.getAjaxCallListeners().add(new AjaxCallListener() { @Override public CharSequence getPrecondition(Component component) { - return String.format("return (Wicket.$('%s').onsubmit || jQuery.noop)();", form.getMarkupId()); + return String.format("var p, f = jQuery('#%s'), fn = function(e) { p = !e.isDefaultPrevented(); e.preventDefault(); };" // + + "f.on('submit',fn);" // + + "f.trigger('submit');" // + + "f.off('submit',fn);" // + + "return p;", form.getMarkupId()); } }); } diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java index fd59920..1f460ac 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java @@ -137,9 +137,9 @@ public abstract class AjaxButton extends Button } @Override - protected boolean shouldCallJavaScriptOnsubmit() + protected boolean shouldTriggerJavaScriptSubmitEvent() { - return AjaxButton.this.shouldCallJavaScriptOnsubmit(); + return AjaxButton.this.shouldTriggerJavaScriptSubmitEvent(); } @Override @@ -157,12 +157,13 @@ public abstract class AjaxButton extends Button } /** -* Controls whether or not JS onsubmit() should be called on the submitting form. +* Controls whether or not a JS submit should be triggered on the submitting form. * False by default. * -* @return true if form's onsubmit() should be called, false otherwise +* @return true if submit should be triggered, false otherwise */ - protected boolean shouldCallJavaScriptOnsubmit() { + protected boolean shouldTriggerJavaScriptSubmitEvent() + { return fa
[wicket] branch WICKET-6868-ajax-submit-onsubmit created (now f043d06)
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a change to branch WICKET-6868-ajax-submit-onsubmit in repository https://gitbox.apache.org/repos/asf/wicket.git. at f043d06 WICKET-6868 ajax submit allow calling onsubmit on form This branch includes the following new commits: new f043d06 WICKET-6868 ajax submit allow calling onsubmit on form The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
[wicket] 01/01: WICKET-6868 ajax submit allow calling onsubmit on form
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch WICKET-6868-ajax-submit-onsubmit in repository https://gitbox.apache.org/repos/asf/wicket.git commit f043d0692728902e2f5f346cb37606e85c90d93c Author: Sven Meier AuthorDate: Sat Feb 20 00:47:34 2021 +0100 WICKET-6868 ajax submit allow calling onsubmit on form --- .../wicket/ajax/form/AjaxFormSubmitBehavior.java | 22 ++ .../wicket/ajax/markup/html/form/AjaxButton.java | 16 .../ajax/markup/html/form/AjaxFallbackButton.java | 16 .../examples/ajax/builtin/FileUploadPage.java | 9 + 4 files changed, 63 insertions(+) diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java b/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java index 0caca83..7446768 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java @@ -19,6 +19,7 @@ package org.apache.wicket.ajax.form; import org.apache.wicket.Component; import org.apache.wicket.ajax.AjaxEventBehavior; import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.ajax.attributes.AjaxCallListener; import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; import org.apache.wicket.ajax.attributes.AjaxRequestAttributes.Method; import org.apache.wicket.markup.html.form.Button; @@ -139,6 +140,17 @@ public abstract class AjaxFormSubmitBehavior extends AjaxEventBehavior } } + /** +* Controls whether or not JS onsubmit() should be called on the submitting form. +* False by default. +* +* @return true if form's onsubmit() should be called, false otherwise +*/ + protected boolean shouldCallJavaScriptOnsubmit() + { + return false; + } + @Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { @@ -165,6 +177,16 @@ public abstract class AjaxFormSubmitBehavior extends AjaxEventBehavior String submittingComponentName = submittingComponent.getInputName(); attributes.setSubmittingComponentName(submittingComponentName); } + + if (shouldCallJavaScriptOnsubmit()) { + attributes.getAjaxCallListeners().add(new AjaxCallListener() { + @Override + public CharSequence getPrecondition(Component component) + { + return String.format("return (Wicket.$('%s').onsubmit || jQuery.noop)();", form.getMarkupId()); + } + }); + } } @Override diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java index b0b5139..fd59920 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java @@ -135,6 +135,12 @@ public abstract class AjaxButton extends Button AjaxButton.this.updateAjaxAttributes(attributes); } + + @Override + protected boolean shouldCallJavaScriptOnsubmit() + { + return AjaxButton.this.shouldCallJavaScriptOnsubmit(); + } @Override public boolean getDefaultProcessing() @@ -150,6 +156,16 @@ public abstract class AjaxButton extends Button }; } + /** +* Controls whether or not JS onsubmit() should be called on the submitting form. +* False by default. +* +* @return true if form's onsubmit() should be called, false otherwise +*/ + protected boolean shouldCallJavaScriptOnsubmit() { + return false; + } + protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { } diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxFallbackButton.java b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxFallbackButton.java index 03ca2a2..eaed28f 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxFallbackButton.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxFallbackButton.java @@ -116,9 +116,25 @@ public abstract class Aja
[wicket] branch wicket-8.x updated: WICKET-6865 check element count before UP or DOWN
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch wicket-8.x in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/wicket-8.x by this push: new 56ba547 WICKET-6865 check element count before UP or DOWN 56ba547 is described below commit 56ba54740808694b7765f0564d82ba4793b61fd2 Author: Sven Meier AuthorDate: Mon Feb 15 10:46:19 2021 +0100 WICKET-6865 check element count before UP or DOWN --- .../html/autocomplete/wicket-autocomplete.js | 47 -- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js index 26f4b8d..c038d3d 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js @@ -116,35 +116,40 @@ Wicket.Event.add(obj, 'keydown', function (jqEvent) { switch(Wicket.Event.keyCode(jqEvent)){ case KEY_UP: - if (selected>-1) { - setSelected(selected-1); - } - - var searchTerm = Wicket.$(ajaxAttributes.c).value; - if(selected === -1 && searchTerm) { - // select the last element - setSelected(elementCount-1); - showAutoComplete(); + if (elementCount > 0) { + if (selected>-1) { + setSelected(selected-1); + } + + var searchTerm = Wicket.$(ajaxAttributes.c).value; + if(selected === -1 && searchTerm) { + // select the last element + setSelected(elementCount-1); + showAutoComplete(); + } + render(true, false); } - render(true, false); if (Wicket.Browser.isSafari()) { return jqEvent.stopPropagation(); } break; case KEY_DOWN: - if (selected < elementCount-1) { - setSelected(selected+1); - } else if (selected === elementCount-1) { - // select the first element - setSelected(0); - } - if (visible === 0) { - updateChoices(); - } else { - render(true, false); - showAutoComplete(); + if (elementCount > 0) { + if (selected < elementCount-1) { + setSelected(selected+1); + } else if (selected === elementCount-1) { + // select the first element + setSelected(0); + } + if (visible === 0) { +
[wicket] branch master updated: WICKET-6865 check element count before UP or DOWN
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/master by this push: new b65d18d WICKET-6865 check element count before UP or DOWN b65d18d is described below commit b65d18d7bc9a7f443008d1a2e7789342bdc9a884 Author: Sven Meier AuthorDate: Mon Feb 15 10:46:19 2021 +0100 WICKET-6865 check element count before UP or DOWN --- .../html/autocomplete/wicket-autocomplete.js | 47 -- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js index dc140d4..09829c8 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js @@ -116,32 +116,37 @@ Wicket.Event.add(obj, 'keydown', function (jqEvent) { switch(Wicket.Event.keyCode(jqEvent)){ case KEY_UP: - if (selected>-1) { - setSelected(selected-1); - } - - var searchTerm = Wicket.$(ajaxAttributes.c).value; - if(selected === -1 && searchTerm) { - // select the last element - setSelected(elementCount-1); - showAutoComplete(); + if (elementCount > 0) { + if (selected>-1) { + setSelected(selected-1); + } + + var searchTerm = Wicket.$(ajaxAttributes.c).value; + if(selected === -1 && searchTerm) { + // select the last element + setSelected(elementCount-1); + showAutoComplete(); + } + render(true, false); } - render(true, false); break; case KEY_DOWN: - if (selected < elementCount-1) { - setSelected(selected+1); - } else if (selected === elementCount-1) { - // select the first element - setSelected(0); - } - if (visible === 0) { - updateChoices(); - } else { - render(true, false); - showAutoComplete(); + if (elementCount > 0) { + if (selected < elementCount-1) { + setSelected(selected+1); + } else if (selected === elementCount-1) { + // select the first element + setSelected(0); + } + if (visible === 0) { + updateChoices(); + } else { + render(true, false); +
[wicket] branch WICKET-6864-crypt-enhancement updated: WICKET-6864 fixed whitespace
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch WICKET-6864-crypt-enhancement in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/WICKET-6864-crypt-enhancement by this push: new 0f1bf60 WICKET-6864 fixed whitespace 0f1bf60 is described below commit 0f1bf6091817087b610190d65ab005c21de77747 Author: Sven Meier AuthorDate: Wed Feb 10 18:21:59 2021 +0100 WICKET-6864 fixed whitespace --- wicket-util/src/main/java/org/apache/wicket/util/crypt/SunJceCrypt.java | 1 - 1 file changed, 1 deletion(-) diff --git a/wicket-util/src/main/java/org/apache/wicket/util/crypt/SunJceCrypt.java b/wicket-util/src/main/java/org/apache/wicket/util/crypt/SunJceCrypt.java index 652e024..09dce34 100644 --- a/wicket-util/src/main/java/org/apache/wicket/util/crypt/SunJceCrypt.java +++ b/wicket-util/src/main/java/org/apache/wicket/util/crypt/SunJceCrypt.java @@ -178,7 +178,6 @@ public class SunJceCrypt extends AbstractCrypt KeySpec spec = createKeySpec(); return keyFactory.generateSecret(spec); } - /** * @return the parameter spec to be used for the configured crypt method
[wicket] branch WICKET-6864-crypt-enhancement updated: WICKET-6864 updated crypt configuration
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch WICKET-6864-crypt-enhancement in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/WICKET-6864-crypt-enhancement by this push: new 57a9ab1 WICKET-6864 updated crypt configuration 57a9ab1 is described below commit 57a9ab14388dba0da5ccb9af34d9662baf0b6557 Author: Sven Meier AuthorDate: Wed Feb 10 18:13:34 2021 +0100 WICKET-6864 updated crypt configuration applied review changes --- .../strategy/DefaultAuthenticationStrategy.java | 12 ++-- .../core/util/crypt/KeyInSessionSunJceCryptFactory.java | 4 ++-- .../java/org/apache/wicket/util/crypt/SunJceCrypt.java| 15 +-- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/authentication/strategy/DefaultAuthenticationStrategy.java b/wicket-core/src/main/java/org/apache/wicket/authentication/strategy/DefaultAuthenticationStrategy.java index 6567bdd..105db6a 100644 --- a/wicket-core/src/main/java/org/apache/wicket/authentication/strategy/DefaultAuthenticationStrategy.java +++ b/wicket-core/src/main/java/org/apache/wicket/authentication/strategy/DefaultAuthenticationStrategy.java @@ -16,7 +16,6 @@ */ package org.apache.wicket.authentication.strategy; -import java.util.Random; import java.util.UUID; import org.apache.wicket.authentication.IAuthenticationStrategy; @@ -34,7 +33,7 @@ import org.slf4j.LoggerFactory; * password, encrypt it and put it into one Cookie. * * Note: To support automatic authentication across application restarts you have to use - * the constructor {@link DefaultAuthenticationStrategy#DefaultAuthenticationStrategy(String, String, byte[])}. + * the constructor {@link DefaultAuthenticationStrategy#DefaultAuthenticationStrategy(String, ICrypt)}. * * @author Juergen Donnerstag */ @@ -48,7 +47,7 @@ public class DefaultAuthenticationStrategy implements IAuthenticationStrategy /** * @deprecated no longer used TODO remove in Wicket 10 */ - @Deprecated + @Deprecated(forRemoval = true) protected final String encryptionKey = null; /** The separator used to concatenate the username and password */ @@ -68,7 +67,7 @@ public class DefaultAuthenticationStrategy implements IAuthenticationStrategy * * @deprecated supply a crypt instead TODO remove in Wicket 10 */ - @Deprecated + @Deprecated(forRemoval = true) public DefaultAuthenticationStrategy(final String cookieKey) { this(cookieKey, defaultEncryptionKey()); @@ -82,7 +81,7 @@ public class DefaultAuthenticationStrategy implements IAuthenticationStrategy /** * @deprecated supply a crypt instead TODO remove in Wicket 10 */ - @Deprecated + @Deprecated(forRemoval = true) public DefaultAuthenticationStrategy(final String cookieKey, final String encryptionKey) { this(cookieKey, defaultCrypt(encryptionKey)); @@ -98,7 +97,8 @@ public class DefaultAuthenticationStrategy implements IAuthenticationStrategy } /** -* Constructor +* This is the recommended constructor to be used, which allows automatic authentication across +* application restarts. * * @param cookieKey *The name of the cookie diff --git a/wicket-core/src/main/java/org/apache/wicket/core/util/crypt/KeyInSessionSunJceCryptFactory.java b/wicket-core/src/main/java/org/apache/wicket/core/util/crypt/KeyInSessionSunJceCryptFactory.java index 381b83f..ef25aa7 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/util/crypt/KeyInSessionSunJceCryptFactory.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/util/crypt/KeyInSessionSunJceCryptFactory.java @@ -19,7 +19,6 @@ package org.apache.wicket.core.util.crypt; import java.io.Serializable; import java.security.Provider; import java.security.Security; -import java.util.Random; import java.util.UUID; import org.apache.wicket.MetaDataKey; @@ -114,8 +113,9 @@ public class KeyInSessionSunJceCryptFactory implements ICryptFactory /** * @return the {@link org.apache.wicket.util.crypt.ICrypt} to use * -* @deprecated this method is no longer called +* @deprecated this method is no longer called TODO remove in Wicket 10 */ + @Deprecated(forRemoval = true) protected ICrypt createCrypt() { return null; diff --git a/wicket-util/src/main/java/org/apache/wicket/util/crypt/SunJceCrypt.java b/wicket-util/src/main/java/org/apache/wicket/util/crypt/SunJceCrypt.java index 32bd77d..652e024 100644 --- a/wicket-util/src/main/java/org/apache/wicket/util/crypt/SunJceCrypt.java +++ b/wicket-util/src/main/java/org/apache
[wicket] 01/01: WICKET-6864 updated crypt configuration
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch WICKET-6864-crypt-enhancement in repository https://gitbox.apache.org/repos/asf/wicket.git commit 7bc47ec03cbbf273570ae72b535fa4663024737e Author: Sven Meier AuthorDate: Sun Feb 7 11:58:34 2021 +0100 WICKET-6864 updated crypt configuration to recommended standards --- .../strategy/DefaultAuthenticationStrategy.java| 62 ++-- .../util/crypt/KeyInSessionSunJceCryptFactory.java | 41 + .../apache/wicket/settings/SecuritySettings.java | 10 +++- .../core/request/mapper/CryptoMapperTest.java | 26 ++--- .../wicket/examples/WicketExampleApplication.java | 5 +- .../src/main/asciidoc/internals/pagestoring.adoc | 8 +-- .../util/crypt/CachingSunJceCryptFactory.java | 2 + .../wicket/util/crypt/ClassCryptFactory.java | 2 + .../org/apache/wicket/util/crypt/SunJceCrypt.java | 67 +++--- .../apache/wicket/util/crypt/SunJceCryptTest.java | 2 + 10 files changed, 159 insertions(+), 66 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/authentication/strategy/DefaultAuthenticationStrategy.java b/wicket-core/src/main/java/org/apache/wicket/authentication/strategy/DefaultAuthenticationStrategy.java index d51efbc..6567bdd 100644 --- a/wicket-core/src/main/java/org/apache/wicket/authentication/strategy/DefaultAuthenticationStrategy.java +++ b/wicket-core/src/main/java/org/apache/wicket/authentication/strategy/DefaultAuthenticationStrategy.java @@ -16,12 +16,14 @@ */ package org.apache.wicket.authentication.strategy; -import org.apache.wicket.Application; +import java.util.Random; +import java.util.UUID; + import org.apache.wicket.authentication.IAuthenticationStrategy; import org.apache.wicket.util.cookies.CookieDefaults; import org.apache.wicket.util.cookies.CookieUtils; -import org.apache.wicket.util.crypt.CachingSunJceCryptFactory; import org.apache.wicket.util.crypt.ICrypt; +import org.apache.wicket.util.crypt.SunJceCrypt; import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.string.Strings; import org.slf4j.Logger; @@ -30,6 +32,9 @@ import org.slf4j.LoggerFactory; /** * Wicket's default implementation of an authentication strategy. It'll concatenate username and * password, encrypt it and put it into one Cookie. + * + * Note: To support automatic authentication across application restarts you have to use + * the constructor {@link DefaultAuthenticationStrategy#DefaultAuthenticationStrategy(String, String, byte[])}. * * @author Juergen Donnerstag */ @@ -40,8 +45,11 @@ public class DefaultAuthenticationStrategy implements IAuthenticationStrategy /** The cookie name to store the username and password */ protected final String cookieKey; - /** The key to use for encrypting/decrypting the cookie value */ - protected final String encryptionKey; + /** +* @deprecated no longer used TODO remove in Wicket 10 +*/ + @Deprecated + protected final String encryptionKey = null; /** The separator used to concatenate the username and password */ protected final String VALUE_SEPARATOR = "-sep-"; @@ -57,25 +65,50 @@ public class DefaultAuthenticationStrategy implements IAuthenticationStrategy * * @param cookieKey *The name of the cookie +* +* @deprecated supply a crypt instead TODO remove in Wicket 10 */ + @Deprecated public DefaultAuthenticationStrategy(final String cookieKey) { - this(cookieKey, defaultEncryptionKey(cookieKey)); + this(cookieKey, defaultEncryptionKey()); } - private static String defaultEncryptionKey(String cookieKey) + private static String defaultEncryptionKey() { - if (Application.exists()) - { - return Application.get().getName(); - } - return cookieKey; + return UUID.randomUUID().toString(); } + /** +* @deprecated supply a crypt instead TODO remove in Wicket 10 +*/ + @Deprecated public DefaultAuthenticationStrategy(final String cookieKey, final String encryptionKey) { + this(cookieKey, defaultCrypt(encryptionKey)); + } + + private static ICrypt defaultCrypt(String encryptionKey) + { + byte[] salt = SunJceCrypt.randomSalt(); + + SunJceCrypt crypt = new SunJceCrypt(salt, 1000); + crypt.setKey(encryptionKey); + return crypt; + } + + /** +* Constructor +* +* @param cookieKey +*The name of the cookie +* @param crypt +*the crypt +*/ + public DefaultAuthenticationS
[wicket] branch WICKET-6864-crypt-enhancement created (now 7bc47ec)
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a change to branch WICKET-6864-crypt-enhancement in repository https://gitbox.apache.org/repos/asf/wicket.git. at 7bc47ec WICKET-6864 updated crypt configuration This branch includes the following new commits: new 7bc47ec WICKET-6864 updated crypt configuration The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
[wicket] branch master updated: WICKET-6863 clear visibileInHierarchy
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/master by this push: new 11dc8f9 WICKET-6863 clear visibileInHierarchy 11dc8f9 is described below commit 11dc8f94b93216bd72c61cd5ba94946a8f89af1c Author: Sven Meier AuthorDate: Wed Jan 27 18:24:16 2021 +0100 WICKET-6863 clear visibileInHierarchy when visibilityAllowed changes --- wicket-core/src/main/java/org/apache/wicket/Component.java | 6 +- wicket-core/src/test/java/org/apache/wicket/ComponentTest.java | 6 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/Component.java b/wicket-core/src/main/java/org/apache/wicket/Component.java index 31b1baa..9d44c88 100644 --- a/wicket-core/src/main/java/org/apache/wicket/Component.java +++ b/wicket-core/src/main/java/org/apache/wicket/Component.java @@ -4328,7 +4328,11 @@ public abstract class Component */ public final Component setVisibilityAllowed(boolean allowed) { - setFlag(FLAG_VISIBILITY_ALLOWED, allowed); + if (allowed != getFlag(FLAG_VISIBILITY_ALLOWED)) + { + setFlag(FLAG_VISIBILITY_ALLOWED, allowed); + onVisibleStateChanged(); + } return this; } diff --git a/wicket-core/src/test/java/org/apache/wicket/ComponentTest.java b/wicket-core/src/test/java/org/apache/wicket/ComponentTest.java index 2095090..601c5c4 100644 --- a/wicket-core/src/test/java/org/apache/wicket/ComponentTest.java +++ b/wicket-core/src/test/java/org/apache/wicket/ComponentTest.java @@ -278,6 +278,12 @@ class ComponentTest extends WicketTestCase c.isVisibleInHierarchy(); c.isVisibleInHierarchy(); assertEquals(2, c.isVisibleCallCount); + + c.setVisibilityAllowed(false); + + c.isVisibleInHierarchy(); + c.isVisibleInHierarchy(); + assertEquals(3, c.isVisibleCallCount); } /**
[wicket] branch wicket-8.x updated: WICKET-6863 clear visibileInHierarchy
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch wicket-8.x in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/wicket-8.x by this push: new bb5900d WICKET-6863 clear visibileInHierarchy bb5900d is described below commit bb5900dcafe639c55e90f3341c99352a3632b6c0 Author: Sven Meier AuthorDate: Wed Jan 27 18:24:16 2021 +0100 WICKET-6863 clear visibileInHierarchy when visibilityAllowed changes --- wicket-core/src/main/java/org/apache/wicket/Component.java | 6 +- wicket-core/src/test/java/org/apache/wicket/ComponentTest.java | 6 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/Component.java b/wicket-core/src/main/java/org/apache/wicket/Component.java index 05f30dd..c1ae312 100644 --- a/wicket-core/src/main/java/org/apache/wicket/Component.java +++ b/wicket-core/src/main/java/org/apache/wicket/Component.java @@ -4319,7 +4319,11 @@ public abstract class Component */ public final Component setVisibilityAllowed(boolean allowed) { - setFlag(FLAG_VISIBILITY_ALLOWED, allowed); + if (allowed != getFlag(FLAG_VISIBILITY_ALLOWED)) + { + setFlag(FLAG_VISIBILITY_ALLOWED, allowed); + onVisibleStateChanged(); + } return this; } diff --git a/wicket-core/src/test/java/org/apache/wicket/ComponentTest.java b/wicket-core/src/test/java/org/apache/wicket/ComponentTest.java index 587cb21..912382f 100644 --- a/wicket-core/src/test/java/org/apache/wicket/ComponentTest.java +++ b/wicket-core/src/test/java/org/apache/wicket/ComponentTest.java @@ -273,6 +273,12 @@ public class ComponentTest extends WicketTestCase c.isVisibleInHierarchy(); c.isVisibleInHierarchy(); assertEquals(2, c.isVisibleCallCount); + + c.setVisibilityAllowed(false); + + c.isVisibleInHierarchy(); + c.isVisibleInHierarchy(); + assertEquals(3, c.isVisibleCallCount); } /**
[wicket-site] branch asf-site updated: generated jekyll html
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch asf-site in repository https://gitbox.apache.org/repos/asf/wicket-site.git The following commit(s) were added to refs/heads/asf-site by this push: new 3b8f33b generated jekyll html 3b8f33b is described below commit 3b8f33b3fa332bfc20a7da8e6649077c1331fd36 Author: Sven Meier AuthorDate: Tue Dec 15 23:09:50 2020 +0100 generated jekyll html --- content/contribute/patch.html | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/content/contribute/patch.html b/content/contribute/patch.html index 4cab0c4..3a657ca 100644 --- a/content/contribute/patch.html +++ b/content/contribute/patch.html @@ -167,7 +167,7 @@ prototyping the feature or demonstrating the bug. Time for some coding -Wicket uses Get http://git-scm.com/";>Git as versioning system, so you +Wicket uses http://git-scm.com/";>Git as versioning system, so you need to have it properly installed and configured to start work on Wicket code base. The main git repository is hosted on https://git-wip-us.apache.org/repos/asf/wicket.git";>Apache git server but is @@ -192,6 +192,10 @@ the format rules. you have finished to work on you pull request, send us an email using mailto:d...@wicket.apache.org";>devs mailing list. +All Pull Requests are automatically tested at +https://github.com/apache/wicket/actions";>Github Actions on AMD64 and +at https://travis-ci.com/github/apache/wicket/";>TravisCI on ARM64 platform. + Create a patch If you prefer to work on our main repository, clone it with
[wicket] branch master updated: WICKET-6847 comment for clirr configuration
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/master by this push: new 1409d26 WICKET-6847 comment for clirr configuration 1409d26 is described below commit 1409d269e2c93bff83f8a5b57bbac5ecf238487f Author: Sven Meier AuthorDate: Sun Nov 15 12:32:54 2020 +0100 WICKET-6847 comment for clirr configuration clirr does not support adding default methods to interfaces --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index 9d9e356..7fbce92 100644 --- a/pom.xml +++ b/pom.xml @@ -1134,6 +1134,7 @@ true true + 7012 org/apache/wicket/page/IPageManager
[wicket] branch master updated (a459a53 -> 65e5cea)
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git. from a459a53 Update Spring to 5.3.1 and Jetty to 9.4.34 new b4e4658 WICKET-6847 onEndRequest before flush new 0c81a88 WICKET-6848 sessionInvalidation before flush new 0cb3d67 WICKET-6847: swap listeners and RequestCycle onEndRequest new 2feed89 WICKET-6847 clear pages in invalidateNow() new 65e5cea WICKET-6847 small optimization The 5 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: pom.xml| 12 ++ .../main/java/org/apache/wicket/Application.java | 6 +++ .../src/main/java/org/apache/wicket/Session.java | 45 +- .../java/org/apache/wicket/page/IPageManager.java | 6 +++ .../java/org/apache/wicket/page/PageManager.java | 6 +++ .../wicket/pageStore/DelegatingPageStore.java | 6 +++ .../org/apache/wicket/pageStore/IPageStore.java| 9 + .../apache/wicket/pageStore/RequestPageStore.java | 22 --- .../apache/wicket/protocol/http/WicketFilter.java | 8 +--- .../apache/wicket/request/cycle/RequestCycle.java | 24 +++- .../wicket/protocol/http/SessionDestroyTest.java | 12 +++--- 11 files changed, 101 insertions(+), 55 deletions(-)
[wicket] 03/05: WICKET-6847: swap listeners and RequestCycle onEndRequest
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git commit 0cb3d6798f4056352c8214ade49fe5fd5947e5c9 Author: Emond Papegaaij AuthorDate: Wed Nov 11 16:21:19 2020 +0100 WICKET-6847: swap listeners and RequestCycle onEndRequest This makes sure the session is destroyed (when needed) after the page store handles the touched pages. This latter action can create a new session if it was destroyed before, causing logout to fail. --- .../src/main/java/org/apache/wicket/request/cycle/RequestCycle.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java b/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java index 2c0a8c7..33d1335 100644 --- a/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java +++ b/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java @@ -263,8 +263,8 @@ public class RequestCycle implements IRequestCycle, IEventSink, IMetadataContext { try { - onEndRequest(); listeners.onEndRequest(this); + onEndRequest(); } catch (RuntimeException e) {
[wicket] 04/05: WICKET-6847 clear pages in invalidateNow()
This is an automated email from the ASF dual-hosted git repository. svenmeier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git commit 2feed893069031f5d6e2a9353e73dae06f61864c Author: Sven Meier AuthorDate: Wed Nov 11 18:58:43 2020 +0100 WICKET-6847 clear pages in invalidateNow() otherwise they will be stored on detach when no session is available and response already committed --- wicket-core/src/main/java/org/apache/wicket/Session.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wicket-core/src/main/java/org/apache/wicket/Session.java b/wicket-core/src/main/java/org/apache/wicket/Session.java index 76f339c..9906da1 100644 --- a/wicket-core/src/main/java/org/apache/wicket/Session.java +++ b/wicket-core/src/main/java/org/apache/wicket/Session.java @@ -526,6 +526,9 @@ public abstract class Session implements IClusterable, IEventSink, IMetadataCont invalidate(); } + // clear all pages possibly pending in the request + getPageManager().clear(); + destroy(); feedbackMessages.clear(); setStyle(null);