diff --git a/pom.xml b/pom.xml index a30aa241b3..70d029595a 100644 --- a/pom.xml +++ b/pom.xml @@ -326,7 +326,6 @@ serializer-fast serializer-fast2 serializer-ui - stateless-parent shiro-security wicket-facebook-parent wicket-html5-parent diff --git a/stateless-parent/.gitignore b/stateless-parent/.gitignore deleted file mode 100644 index 49c81d8751..0000000000 --- a/stateless-parent/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -.classpath -.project -target -.settings -bin -MANIFEST.MF -CVS -.svn -.cvsignore -*.log diff --git a/stateless-parent/LICENSE b/stateless-parent/LICENSE deleted file mode 100644 index d645695673..0000000000 --- a/stateless-parent/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/stateless-parent/README.md b/stateless-parent/README.md deleted file mode 100644 index 7bb7dd9f49..0000000000 --- a/stateless-parent/README.md +++ /dev/null @@ -1,34 +0,0 @@ -WicketStuff Stateless -===================================================== - -Sometimes it is good to be stateless. As the core of Wicket is focused on managing stateful behavior there is sometimes a lack of support for stateless pages. The goal of this package is to add a few components that provide more comprehensive stateless features for Apache Wicket. - -These components currently include a ``StatelessLink``,a ``StatelessAjaxSubmitLink`` and a ``StatelessAjaxFallbackLink``. They are backed by stateless behaviors: ``StatelessAjaxEventBehavior``, ``StatelessAjaxFormSubmitBehavior`` and ``StatelessAjaxFormComponentUpdatingBehavior``. - -## Usage - -Stateless components and behaviors follows the same rules and convetions of their standard stateful version shipped with Wicket. Therefore you will find different handler methods like ``onSubmit`` or ``onClick`` that provide an instance of ``AjaxRequestTarget`` to refresh components markup. Such components must have a markup id in order to be manipulated via JavaScript. - -However in this case calling ``setOutputMarkupId`` on a component is not enough. Since we are working with a stateless page, the id of the component to refresh must be unique but also *static*, meaning that it should not depend on page instance. In other words, the id should be constant through different instances of the same page. - -By default Wicket generates markup ids using a session-level counter and this make them not static. Hence, to refresh component in a stateless page we must provide them with static ids, either setting them in Java code (with ``Component.setMarkupId``) or simply writing them directly in the markup: - -````html - -```` - -See home page from example module for more examples. - -##### Maven - -This component is part of WicketStuff project and is regularly released at Maven Central repository. Simply add the following lines of configuration to our `pom.xml`: - -````xml - - - org.wicketstuff - wicketstuff-stateless - 6.8.0 - - -```` diff --git a/stateless-parent/header.txt b/stateless-parent/header.txt deleted file mode 100644 index f31b5896a9..0000000000 --- a/stateless-parent/header.txt +++ /dev/null @@ -1,15 +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. - diff --git a/stateless-parent/pom.xml b/stateless-parent/pom.xml deleted file mode 100644 index 6000358b87..0000000000 --- a/stateless-parent/pom.xml +++ /dev/null @@ -1,57 +0,0 @@ - - 4.0.0 - - - org.wicketstuff - wicketstuff-core - 8.0.0-SNAPSHOT - - - wicketstuff-stateless-parent - pom - WicketStuff Stateless Parent - Components for Apache Wicket useful for Stateless Applications - - - The Apache Software License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - - - - stateless - stateless-examples - - - - - - true - com.mycila.maven-license-plugin - maven-license-plugin - -
./header.txt
- true - true - - LICENSE.txt - **/src/test/resources/** - **/src/test/data/** - **/jquery* - **/*.csv - -
- - - check-headers - verify - - check - - - -
-
-
-
-
diff --git a/stateless-parent/stateless-examples/pom.xml b/stateless-parent/stateless-examples/pom.xml deleted file mode 100644 index c7a64927c5..0000000000 --- a/stateless-parent/stateless-examples/pom.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - 4.0.0 - - - org.wicketstuff - wicketstuff-stateless-parent - 8.0.0-SNAPSHOT - - - wicketstuff-stateless-examples - war - WicketStuff Stateless Examples - - - true - true - true - - - - - - - org.apache.wicket - wicket-core - - - org.apache.wicket - wicket-devutils - - - org.wicketstuff - wicketstuff-stateless - ${project.version} - - - junit - junit - - - - - org.slf4j - slf4j-simple - - - - org.eclipse.jetty.aggregate - jetty-all - uber - - - - diff --git a/stateless-parent/stateless-examples/src/main/java/org/wicketstuff/stateless/demo/HomePage.html b/stateless-parent/stateless-examples/src/main/java/org/wicketstuff/stateless/demo/HomePage.html deleted file mode 100644 index 45270b3c3f..0000000000 --- a/stateless-parent/stateless-examples/src/main/java/org/wicketstuff/stateless/demo/HomePage.html +++ /dev/null @@ -1,70 +0,0 @@ - - - -Stateless Wicket - - - -

Statless ajax fallback link.

-
-This link uses ajax when it is available, -and a regular wicket roundtrip when ajax or javascript are not available -and the page should be stateless. -
-
- -Counter: - -increment -
-
- -

Submit form via AJAX. Each field is required.

-
- -
- -
- - -
-
- - -
- -
- -

The select component submits its value via AJAX on 'change' event.

- - - -
-

AJAX indicator link and button which show their indicator for 5 seconds.

-link -
- -
-
- - - - diff --git a/stateless-parent/stateless-examples/src/main/java/org/wicketstuff/stateless/demo/HomePage.java b/stateless-parent/stateless-examples/src/main/java/org/wicketstuff/stateless/demo/HomePage.java deleted file mode 100644 index 3549569501..0000000000 --- a/stateless-parent/stateless-examples/src/main/java/org/wicketstuff/stateless/demo/HomePage.java +++ /dev/null @@ -1,192 +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.wicketstuff.stateless.demo; - -import java.util.Arrays; - -import org.apache.wicket.Component; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.devutils.stateless.StatelessComponent; -import org.apache.wicket.markup.html.WebPage; -import org.apache.wicket.markup.html.basic.Label; -import org.apache.wicket.markup.html.form.DropDownChoice; -import org.apache.wicket.markup.html.form.Form; -import org.apache.wicket.markup.html.form.StatelessForm; -import org.apache.wicket.markup.html.form.TextField; -import org.apache.wicket.markup.html.link.Link; -import org.apache.wicket.markup.html.panel.FeedbackPanel; -import org.apache.wicket.model.AbstractReadOnlyModel; -import org.apache.wicket.model.Model; -import org.apache.wicket.request.mapper.parameter.PageParameters; -import org.apache.wicket.util.string.StringValue; -import org.wicketstuff.stateless.behaviors.StatelessAjaxFormComponentUpdatingBehavior; -import org.wicketstuff.stateless.components.StatelessAjaxFallbackLink; -import org.wicketstuff.stateless.components.StatelessAjaxSubmitLink; -import org.wicketstuff.stateless.components.StatelessIndicatingAjaxButton; -import org.wicketstuff.stateless.components.StatelessIndicatingAjaxFallbackLink; - -/** - * For testing only - */ -@StatelessComponent -public class HomePage extends WebPage { - - private static final String COUNTER_PARAM = "counter"; - - /** - * Constructor that is invoked when page is invoked without a session. - * - * @param parameters - * Page parameters - */ - public HomePage(final PageParameters parameters) { - super(parameters); - - final Label c2 = new Label("c2", new AbstractReadOnlyModel() { - private static final long serialVersionUID = 1L; - - @Override - public Integer getObject() { - final String counter = getParameter(parameters, COUNTER_PARAM); - return counter != null ? Integer.parseInt(counter) : 0; - } - - }); - final Link c2Link = new StatelessAjaxFallbackLink("c2-link") { - - @Override - public void onClick(final AjaxRequestTarget target) { - if (target != null) { - Integer counter = (Integer) c2.getDefaultModelObject(); - updateParams(getPageParameters(), counter); - target.add(c2); - } - } - }; - - add(c2Link); - add(c2.setOutputMarkupId(true)); - - final String _a = getParameter(parameters, "a"); - final String _b = getParameter(parameters, "b"); - - final TextField a = new TextField("name", - new Model(_a)); - final TextField b = new TextField("surname", - new Model(_b)); - - final Form form = new StatelessForm("inputForm") { - - @Override - protected void onSubmit() { - - } - - }; - final DropDownChoice select = new DropDownChoice("select", - new Model("2"), Arrays.asList(new String[] { "1", "2", - "3" })); - final Label selectedValue = new Label("selectedValue", ""); - add(selectedValue.setOutputMarkupId(true)); - - select.add(new StatelessAjaxFormComponentUpdatingBehavior("change") - { - - @Override - protected void onUpdate(final AjaxRequestTarget target) { - final String value = select.getModelObject(); - selectedValue.setDefaultModelObject("Selected value: " + value); - target.add(selectedValue); - } - }); - - form.add(a.setRequired(true)); - form.add(b.setRequired(true)); - - final Component feedback = new FeedbackPanel("feedback"); - final Label submittedValues = new Label("submittedValues", ""); - - form.add(feedback.setOutputMarkupId(true)); - form.add(submittedValues.setOutputMarkupId(true)); - - form.add(new StatelessAjaxSubmitLink("submit"){ - @Override - protected void onError(AjaxRequestTarget target) - { - super.onError(target); - target.add(feedback); - } - @Override - protected void onSubmit(AjaxRequestTarget target) - { - super.onSubmit(target); - String values = "Your name is: " + a.getModelObject() + - " " + b.getModelObject(); - submittedValues.setDefaultModelObject(values); - target.add(feedback, submittedValues); - } - }); - - add(form); - - add(select); - - - add(new StatelessIndicatingAjaxFallbackLink("indicatingLink"){ - @Override - public void onClick(AjaxRequestTarget target) - { - try { - Thread.sleep(5000); //1000 milliseconds is one second. - } catch(InterruptedException ex) { - Thread.currentThread().interrupt(); - } - } - }); - - StatelessForm indicatingForm = new StatelessForm("indicatingForm"); - - add(indicatingForm); - add(new StatelessIndicatingAjaxButton("indicatingButton", indicatingForm){ - @Override - protected void onSubmit(AjaxRequestTarget target, Form form) - { - try { - Thread.sleep(5000); //1000 milliseconds is one second. - } catch(InterruptedException ex) { - Thread.currentThread().interrupt(); - } - } - }); - - } - - private String getParameter(final PageParameters parameters, - final String key) { - final StringValue value = parameters.get(key); - - if (value.isNull() || value.isEmpty()) { - return null; - } - - return value.toString(); - } - - protected final void updateParams(final PageParameters pageParameters, final int counter) { - pageParameters.set(COUNTER_PARAM, Integer.toString(counter + 1)); - } -} diff --git a/stateless-parent/stateless-examples/src/main/java/org/wicketstuff/stateless/demo/WicketApplication.java b/stateless-parent/stateless-examples/src/main/java/org/wicketstuff/stateless/demo/WicketApplication.java deleted file mode 100644 index 5d160aef1a..0000000000 --- a/stateless-parent/stateless-examples/src/main/java/org/wicketstuff/stateless/demo/WicketApplication.java +++ /dev/null @@ -1,46 +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.wicketstuff.stateless.demo; - -import org.apache.wicket.RuntimeConfigurationType; -import org.apache.wicket.devutils.stateless.StatelessChecker; -import org.apache.wicket.protocol.http.WebApplication; - -/** - * Application object for your web application. If you want to run this - * application without deploying, run the Start class. - */ -public class WicketApplication extends WebApplication { - - @Override - public Class getHomePage() { - return HomePage.class; - } - - @Override - protected void init() { - mountPage("home", HomePage.class); - - getDebugSettings().setDevelopmentUtilitiesEnabled(true); - getComponentPreOnBeforeRenderListeners().add(new StatelessChecker()); - } - - @Override - public RuntimeConfigurationType getConfigurationType() { - return RuntimeConfigurationType.DEVELOPMENT; - } -} \ No newline at end of file diff --git a/stateless-parent/stateless-examples/src/main/resources/log4j.properties b/stateless-parent/stateless-examples/src/main/resources/log4j.properties deleted file mode 100644 index e078ed3fee..0000000000 --- a/stateless-parent/stateless-examples/src/main/resources/log4j.properties +++ /dev/null @@ -1,29 +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. -# - -log4j.appender.Stdout=org.apache.log4j.ConsoleAppender -log4j.appender.Stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.Stdout.layout.conversionPattern=%-5p - %-26.26c{1} - %m\n - -log4j.rootLogger=INFO,Stdout - -log4j.logger.org.apache.wicket=INFO -log4j.logger.org.apache.wicket.protocol.http.HttpSessionStore=INFO -log4j.logger.org.apache.wicket.version=INFO -log4j.logger.org.apache.wicket.RequestCycle=INFO - - diff --git a/stateless-parent/stateless-examples/src/main/webapp/WEB-INF/web.xml b/stateless-parent/stateless-examples/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 40ae4fdd36..0000000000 --- a/stateless-parent/stateless-examples/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - demo - - - - - wicket.demo - org.apache.wicket.protocol.http.WicketFilter - - applicationClassName - org.wicketstuff.stateless.demo.WicketApplication - - - - - wicket.demo - /* - - - - diff --git a/stateless-parent/stateless-examples/src/test/java/org/wickststuff/stateless/demo/Start.java b/stateless-parent/stateless-examples/src/test/java/org/wickststuff/stateless/demo/Start.java deleted file mode 100644 index c6e9ff3edb..0000000000 --- a/stateless-parent/stateless-examples/src/test/java/org/wickststuff/stateless/demo/Start.java +++ /dev/null @@ -1,91 +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.wickststuff.stateless.demo; - -import org.apache.wicket.util.file.File; -import org.apache.wicket.util.time.Duration; -import org.eclipse.jetty.http.HttpVersion; -import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.server.ServerConnector; -import org.eclipse.jetty.server.SslConnectionFactory; -import org.eclipse.jetty.util.resource.Resource; -import org.eclipse.jetty.util.ssl.SslContextFactory; -import org.eclipse.jetty.webapp.WebAppContext; - -public class Start { - public static void main(String[] args) throws Exception { - int timeout = (int) Duration.ONE_HOUR.getMilliseconds(); - - Server server = new Server(); - ServerConnector http = new ServerConnector(server); - - // Set some timeout options to make debugging easier. - http.setIdleTimeout(timeout); - http.setSoLingerTime(-1); - http.setPort(8080); - server.addConnector(http); - - Resource keystore = Resource.newClassPathResource("/keystore"); - if (keystore != null && keystore.exists()) { - // if a keystore for a SSL certificate is available, start a SSL - // connector on port 8443. - // By default, the quickstart comes with a Apache Wicket Quickstart - // Certificate that expires about half way september 2021. Do not - // use this certificate anywhere important as the passwords are - // available in the source. - SslContextFactory factory = new SslContextFactory(); - factory.setKeyStoreResource(keystore); - factory.setKeyStorePassword("wicket"); - factory.setTrustStoreResource(keystore); - factory.setKeyManagerPassword("wicket"); - - ServerConnector sslConnector = new ServerConnector(server, new SslConnectionFactory(factory, HttpVersion.HTTP_1_1.asString())); - sslConnector.setIdleTimeout(timeout); - sslConnector.setPort(8443); - sslConnector.setAcceptQueueSize(4); - server.addConnector(sslConnector); - - System.out.println("SSL access to the quickstart has been enabled on port 8443"); - System.out.println("You can access the application using SSL on https://localhost:8443"); - System.out.println(); - } - - WebAppContext bb = new WebAppContext(); - bb.setContextPath("/"); - bb.setWar(new File("src/main/webapp").getAbsolutePath()); - - // START JMX SERVER - // MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer(); - // MBeanContainer mBeanContainer = new MBeanContainer(mBeanServer); - // server.getContainer().addEventListener(mBeanContainer); - // mBeanContainer.start(); - - server.setHandler(bb); - - try { - System.out.println(">>> STARTING EMBEDDED JETTY SERVER, PRESS ANY KEY TO STOP"); - server.start(); - System.in.read(); - System.out.println(">>> STOPPING EMBEDDED JETTY SERVER"); - server.stop(); - server.join(); - } catch (Exception e) { - e.printStackTrace(); - System.exit(1); - } - } -} diff --git a/stateless-parent/stateless-examples/src/test/java/org/wickststuff/stateless/demo/TestHomePage.java b/stateless-parent/stateless-examples/src/test/java/org/wickststuff/stateless/demo/TestHomePage.java deleted file mode 100644 index 4b39532bde..0000000000 --- a/stateless-parent/stateless-examples/src/test/java/org/wickststuff/stateless/demo/TestHomePage.java +++ /dev/null @@ -1,42 +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.wickststuff.stateless.demo; - -import junit.framework.TestCase; -import org.apache.wicket.util.tester.WicketTester; -import org.wicketstuff.stateless.demo.HomePage; -import org.wicketstuff.stateless.demo.WicketApplication; - -/** - * Simple test using the WicketTester - */ -public class TestHomePage extends TestCase { - private WicketTester tester; - - @Override - public void setUp() { - tester = new WicketTester(new WicketApplication()); - } - - public void testRenderMyPage() { - // start and render the test page - tester.startPage(HomePage.class); - - // assert rendered page class - tester.assertRenderedPage(HomePage.class); - } -} diff --git a/stateless-parent/stateless/pom.xml b/stateless-parent/stateless/pom.xml deleted file mode 100644 index 2b6f00f1d8..0000000000 --- a/stateless-parent/stateless/pom.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - 4.0.0 - - - org.wicketstuff - wicketstuff-stateless-parent - 8.0.0-SNAPSHOT - - - wicketstuff-stateless - jar - WicketStuff Stateless - Stateless Apache Wicket Components - - - org.apache.wicket - wicket-extensions - ${wicket.version} - - - junit - junit - - - org.slf4j - slf4j-simple - - - javax.servlet - javax.servlet-api - - - diff --git a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/StatelessEncoder.java b/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/StatelessEncoder.java deleted file mode 100644 index 9d584d92d3..0000000000 --- a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/StatelessEncoder.java +++ /dev/null @@ -1,104 +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.wicketstuff.stateless; - -import java.nio.charset.Charset; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.apache.wicket.request.Url; -import org.apache.wicket.request.mapper.parameter.INamedParameters; -import org.apache.wicket.request.mapper.parameter.PageParameters; -import org.apache.wicket.util.encoding.UrlEncoder; - -/** - * Centralize algorithms that are shared. - * - * @author jfk - */ -public class StatelessEncoder -{ - /** - * Merges the query parameters of the url with the named parameters - * from the {@link PageParameters}. The page parameters override the query - * parameters. - * - * @param url the url with the original parameters - * @param params the page parameters to merge - * @return an Url with merged parameters - */ - public static Url mergeParameters(final Url url, final PageParameters params) - { - if (params == null) - { - return url; - } - - Charset charset = url.getCharset(); - - Url mergedUrl = Url.parse(url.toString(), charset); - - UrlEncoder urlEncoder = UrlEncoder.QUERY_INSTANCE; - - Set setParameters = new HashSet(); - - int indexedCount = params.getIndexedCount(); - if (indexedCount > 0) - { - String jsessionidString = null; - List segments = mergedUrl.getSegments(); - if (segments.size() > 0) - { - String lastSegment = segments.get(segments.size() - 1); - int jsessionidIndex = lastSegment.indexOf(";jsessionid="); - if (jsessionidIndex != -1) - { - segments.set(segments.size() - 1, lastSegment.substring(0, jsessionidIndex)); - jsessionidString = lastSegment.substring(jsessionidIndex); - } - } - for (int i = 0; i < indexedCount; i++) - { - segments.add(params.get(i).toString()); - } - if (jsessionidString != null) - { - segments.set(segments.size() - 1, segments.get(segments.size() - 1).concat(jsessionidString)); - } - } - - for (INamedParameters.NamedPair pair : params.getAllNamed()) - { - String key = urlEncoder.encode(pair.getKey(), charset); - String value = urlEncoder.encode(pair.getValue(), charset); - - if (setParameters.contains(key)) { - mergedUrl.addQueryParameter(key, value); - } else { - mergedUrl.setQueryParameter(key, value); - setParameters.add(key); - } - } - - return mergedUrl; - } - - private StatelessEncoder() - {// forbid instantiation - } -} diff --git a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/behaviors/StatelessAjaxEventBehavior.java b/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/behaviors/StatelessAjaxEventBehavior.java deleted file mode 100644 index 364795d800..0000000000 --- a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/behaviors/StatelessAjaxEventBehavior.java +++ /dev/null @@ -1,68 +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.wicketstuff.stateless.behaviors; - -import org.apache.wicket.Component; -import org.apache.wicket.ajax.AjaxEventBehavior; -import org.apache.wicket.request.Url; -import org.apache.wicket.request.mapper.parameter.PageParameters; -import org.wicketstuff.stateless.StatelessEncoder; - -/** - * Stateless version of AjaxEventBehavior - * - * @author Andrea Del Bene - * - */ -public abstract class StatelessAjaxEventBehavior extends AjaxEventBehavior -{ - private static final long serialVersionUID = 2387070289758596955L; - - public StatelessAjaxEventBehavior(final String event) - { - super(event); - } - - @Override - protected void onBind() - { - super.onBind(); - - //generate behavior id - getComponent().getBehaviorId(this); - } - - @Override - public CharSequence getCallbackUrl() - { - final Url url = Url.parse(super.getCallbackUrl().toString()); - final PageParameters params = getPageParameters(); - - return StatelessEncoder.mergeParameters(url, params).toString(); - } - - protected abstract PageParameters getPageParameters(); - - /** - * @return always {@literal true} - */ - @Override - public boolean getStatelessHint(final Component component) - { - return true; - } -} diff --git a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/behaviors/StatelessAjaxFormComponentUpdatingBehavior.java b/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/behaviors/StatelessAjaxFormComponentUpdatingBehavior.java deleted file mode 100644 index b249a548ee..0000000000 --- a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/behaviors/StatelessAjaxFormComponentUpdatingBehavior.java +++ /dev/null @@ -1,75 +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.wicketstuff.stateless.behaviors; - -import org.apache.wicket.Component; -import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior; -import org.apache.wicket.request.Url; -import org.apache.wicket.request.mapper.parameter.PageParameters; -import org.wicketstuff.stateless.StatelessEncoder; - -/** - * Stateless version of AjaxFormComponentUpdatingBehavior. - * - * @author jfk - * - */ -public abstract class StatelessAjaxFormComponentUpdatingBehavior - extends AjaxFormComponentUpdatingBehavior -{ - - private static final long serialVersionUID = -286307141298283926L; - - /** - * @param event - */ - public StatelessAjaxFormComponentUpdatingBehavior(final String event) - { - super(event); - } - - @Override - protected void onBind() - { - super.onBind(); - - getComponent().getBehaviorId(this); - } - - @Override - public CharSequence getCallbackUrl() - { - final Url url = Url.parse(super.getCallbackUrl().toString()); - final PageParameters params = getPageParameters(); - - return StatelessEncoder.mergeParameters(url, params).toString(); - } - - protected PageParameters getPageParameters() - { - return null; - } - - /** - * @return always {@literal true} - */ - @Override - public boolean getStatelessHint(final Component component) - { - return true; - } -} diff --git a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/behaviors/StatelessAjaxFormSubmitBehavior.java b/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/behaviors/StatelessAjaxFormSubmitBehavior.java deleted file mode 100644 index 3903ce5683..0000000000 --- a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/behaviors/StatelessAjaxFormSubmitBehavior.java +++ /dev/null @@ -1,205 +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.wicketstuff.stateless.behaviors; - -import org.apache.wicket.Component; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; -import org.apache.wicket.ajax.attributes.AjaxRequestAttributes.Method; -import org.apache.wicket.markup.html.form.Form; -import org.apache.wicket.markup.html.form.IFormSubmitter; -import org.apache.wicket.request.mapper.parameter.PageParameters; - -/** - * Stateless version of AjaxFormSubmitBehavior. - */ -public class StatelessAjaxFormSubmitBehavior extends StatelessAjaxEventBehavior -{ - - /** The default form processing flag. */ - private boolean defaultFormProcessing = true; - - /** - * Instantiates a new stateless ajax form submit behavior. - * - * @param event the event - */ - public StatelessAjaxFormSubmitBehavior(String event) - { - super(event); - } - - @Override - protected PageParameters getPageParameters() - { - return null; - } - - @Override - protected void updateAjaxAttributes(AjaxRequestAttributes attributes) - { - super.updateAjaxAttributes(attributes); - - Form form = findForm(); - attributes.setFormId(form.getMarkupId()); - - String formMethod = form.getMarkupAttributes().getString("method"); - if (formMethod == null || "POST".equalsIgnoreCase(formMethod)) - { - attributes.setMethod(Method.POST); - } - - if (form.getRootForm().isMultiPart()) - { - attributes.setMultipart(true); - attributes.setMethod(Method.POST); - } - - attributes.setPreventDefault(true); - } - - /** - * Finds form that will be submitted. - * - * @return form to submit or {@code null} if none found - */ - protected Form findForm() - { - // try to find form in the hierarchy of owning component - Component component = getComponent(); - if (component instanceof Form) - { - return (Form)component; - } - else - { - return component.findParent(Form.class); - } - } - - @Override - protected void onEvent(AjaxRequestTarget target) - { - findForm().getRootForm().onFormSubmitted(new AjaxFormSubmitter(this, target)); - } - - /** - * The Class AjaxFormSubmitter. - */ - class AjaxFormSubmitter implements IFormSubmitter - { - - /** The submit behavior. */ - private final StatelessAjaxFormSubmitBehavior submitBehavior; - - /** The target. */ - private final AjaxRequestTarget target; - - /** - * Instantiates a new ajax form submitter. - * - * @param submitBehavior the submit behavior - * @param target the target - */ - public AjaxFormSubmitter(StatelessAjaxFormSubmitBehavior submitBehavior, - AjaxRequestTarget target) - { - this.submitBehavior = submitBehavior; - this.target = target; - } - - @Override - public Form getForm() - { - return StatelessAjaxFormSubmitBehavior.this.findForm(); - } - - @Override - public boolean getDefaultFormProcessing() - { - return StatelessAjaxFormSubmitBehavior.this.getDefaultFormProcessing(); - } - - @Override - public void onSubmit() - { - StatelessAjaxFormSubmitBehavior.this.onSubmit(target); - } - - @Override - public void onAfterSubmit() - { - StatelessAjaxFormSubmitBehavior.this.onAfterSubmit(target); - } - - @Override - public void onError() - { - StatelessAjaxFormSubmitBehavior.this.onError(target); - } - - } - - /** - * Override this method to provide special submit handling in a multi-button form. This method - * will be called after the form's onSubmit method. - * - * @param target the target - */ - protected void onAfterSubmit(AjaxRequestTarget target) - { - } - - /** - * Override this method to provide special submit handling in a multi-button form. This method - * will be called before the form's onSubmit method. - * - * @param target the target - */ - protected void onSubmit(AjaxRequestTarget target) - { - } - - /** - * Listener method invoked when the form has been processed and errors occurred. - * - * @param target the target - */ - protected void onError(AjaxRequestTarget target) - { - } - - /** - * Gets the default form processing. - * - * @return the default form processing - */ - public boolean getDefaultFormProcessing() - { - return defaultFormProcessing ; - } - - /** - * Sets the default form processing. - * - * @param defaultFormProcessing the new default form processing - */ - public void setDefaultFormProcessing(boolean defaultFormProcessing) - { - this.defaultFormProcessing = defaultFormProcessing; - } -} diff --git a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/behaviors/StatelessOnChangeAjaxBehavior.java b/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/behaviors/StatelessOnChangeAjaxBehavior.java deleted file mode 100644 index 233577c1ef..0000000000 --- a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/behaviors/StatelessOnChangeAjaxBehavior.java +++ /dev/null @@ -1,75 +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.wicketstuff.stateless.behaviors; - -import org.apache.wicket.Component; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; -import org.apache.wicket.markup.html.form.TextArea; -import org.apache.wicket.markup.html.form.TextField; - -/** - * Stateless version of OnChangeAjaxBehavior. - * - *

- * This behavior uses best available method to track changes on different types of form components. - * To accomplish this for text input form components it uses a custom event, named 'inputchange', - * that is handled in the best way for the specific browser. For other form component types the - * 'change' event is used. - *

- * - * @author Andrea Del Bene - * - */ -public class StatelessOnChangeAjaxBehavior extends StatelessAjaxFormComponentUpdatingBehavior -{ - private static final long serialVersionUID = 1L; - - /** - * 'inputchange' event delegates to 'input', 'keyup', 'cut' and 'paste' events - * for text input form component depending on the browser. - * 'change' is used as a fallback for all other form component types. - */ - public static final String EVENT_NAME = "inputchange change"; - - public static final String EVENT_CHANGE = "change"; - - public StatelessOnChangeAjaxBehavior() - { - super(EVENT_NAME); - } - - @Override - protected void updateAjaxAttributes(AjaxRequestAttributes attributes) - { - super.updateAjaxAttributes(attributes); - - Component component = getComponent(); - - // textfiels and textareas will trigger this behavior with either 'inputchange' or 'change' events - // all the other components will use just 'change' - if (!(component instanceof TextField || component instanceof TextArea)) - { - attributes.setEventNames(EVENT_CHANGE); - }; - } - - @Override - protected void onUpdate(AjaxRequestTarget target) - { - } -} diff --git a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/components/StatelessAjaxButton.java b/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/components/StatelessAjaxButton.java deleted file mode 100644 index 69ad633333..0000000000 --- a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/components/StatelessAjaxButton.java +++ /dev/null @@ -1,241 +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.wicketstuff.stateless.components; - -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; -import org.apache.wicket.markup.ComponentTag; -import org.apache.wicket.markup.html.form.Button; -import org.apache.wicket.markup.html.form.Form; -import org.apache.wicket.model.IModel; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.wicketstuff.stateless.behaviors.StatelessAjaxFormSubmitBehavior; - - -/** - * Stateless version of AjaxButton - * - * @since 1.3 - * - * @author Igor Vaynberg (ivaynberg) - */ -public abstract class StatelessAjaxButton extends Button -{ - private static final long serialVersionUID = 1L; - - private static final Logger logger = LoggerFactory.getLogger(StatelessAjaxButton.class); - - private final Form form; - - /** - * Construct. - * - * @param id - */ - public StatelessAjaxButton(String id) - { - this(id, null, null); - } - - /** - * - * Construct. - * - * @param id - * @param model - * model used to set value markup attribute - */ - public StatelessAjaxButton(String id, IModel model) - { - this(id, model, null); - } - - /** - * - * Construct. - * - * @param id - * @param form - */ - public StatelessAjaxButton(String id, Form form) - { - this(id, null, form); - } - - - /** - * Construct. - * - * @param id - * @param model - * model used to set value markup attribute - * @param form - */ - public StatelessAjaxButton(String id, IModel model, final Form form) - { - super(id, model); - this.form = form; - } - - @Override - protected void onInitialize() - { - super.onInitialize(); - - add(newAjaxFormSubmitBehavior("click")); - } - - protected StatelessAjaxFormSubmitBehavior newAjaxFormSubmitBehavior(String event) - { - return new StatelessAjaxFormSubmitBehavior(event) - { - private static final long serialVersionUID = 1L; - - @Override - protected void onSubmit(AjaxRequestTarget target) - { - StatelessAjaxButton.this.onSubmit(target, StatelessAjaxButton.this.getForm()); - } - - @Override - protected void onAfterSubmit(AjaxRequestTarget target) - { - StatelessAjaxButton.this.onAfterSubmit(target, StatelessAjaxButton.this.getForm()); - } - - @Override - protected void onError(AjaxRequestTarget target) - { - StatelessAjaxButton.this.onError(target, StatelessAjaxButton.this.getForm()); - } - - @Override - protected void updateAjaxAttributes(AjaxRequestAttributes attributes) - { - super.updateAjaxAttributes(attributes); - - // do not allow normal form submit to happen - attributes.setPreventDefault(true); - - StatelessAjaxButton.this.updateAjaxAttributes(attributes); - } - - @Override - protected Form findForm() - { - return StatelessAjaxButton.this.getForm(); - } - }; - } - - protected void updateAjaxAttributes(AjaxRequestAttributes attributes) - { - } - - /** - * Returns the form if it was set in constructor, otherwise returns the form nearest in parent - * hierarchy. - * - * @see org.apache.wicket.markup.html.form.FormComponent#getForm() - */ - @Override - public Form getForm() - { - if (form != null) - { - return form; - } - else - { - return super.getForm(); - } - } - - @Override - protected void onComponentTag(ComponentTag tag) - { - // WICKET-5594 prevent non-Ajax submit - tag.put("type", "button"); - - super.onComponentTag(tag); - } - - /** - * This method is never called. - * - * @see #onSubmit(AjaxRequestTarget, Form) - */ - @Override - public final void onSubmit() - { - logger.warn("unexpected invocation of #onSubmit() on {}", this); - } - - @Override - public final void onAfterSubmit() - { - logger.warn("unexpected invocation of #onAfterSubmit() on {}", this); - } - - /** - * This method is never called. - * - * @see #onError(AjaxRequestTarget, Form) - */ - @Override - public final void onError() - { - logger.warn("unexpected invocation of #onError() on {}", this); - } - - /** - * Listener method invoked on form submit with no errors, before {@link Form#onSubmit()}. - * - * @param target - * @param form - */ - protected void onSubmit(AjaxRequestTarget target, Form form) - { - } - - /** - * Listener method invoked on form submit with no errors, after {@link Form#onSubmit()}. - * - * @param target - * @param form - */ - protected void onAfterSubmit(AjaxRequestTarget target, Form form) - { - } - - /** - * Listener method invoked on form submit with errors - * - * @param target - * @param form - */ - protected void onError(AjaxRequestTarget target, Form form) - { - } - - @Override - protected boolean getStatelessHint() - { - return true; - }; -} diff --git a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/components/StatelessAjaxFallbackLink.java b/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/components/StatelessAjaxFallbackLink.java deleted file mode 100644 index efbd71efa7..0000000000 --- a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/components/StatelessAjaxFallbackLink.java +++ /dev/null @@ -1,115 +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.wicketstuff.stateless.components; - -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; -import org.apache.wicket.ajax.markup.html.AjaxFallbackLink; -import org.apache.wicket.ajax.markup.html.IAjaxLink; -import org.apache.wicket.markup.ComponentTag; -import org.apache.wicket.markup.html.link.Link; -import org.apache.wicket.markup.html.link.StatelessLink; -import org.apache.wicket.request.mapper.parameter.PageParameters; -import org.wicketstuff.stateless.behaviors.StatelessAjaxEventBehavior; - -/** - * Just like {@link AjaxFallbackLink}, but stateless. - * - * @author jfk - */ -public abstract class StatelessAjaxFallbackLink extends StatelessLink - implements IAjaxLink -{ - - private static final long serialVersionUID = -133600842398684777L; - - public StatelessAjaxFallbackLink(final String id) - { - super(id); - - add(new StatelessAjaxEventBehavior("click") - { - private static final long serialVersionUID = -8445395501430605953L; - - @Override - protected void updateAjaxAttributes(AjaxRequestAttributes attributes) - { - super.updateAjaxAttributes(attributes); - attributes.setPreventDefault(true); - StatelessAjaxFallbackLink.this.updateAjaxAttributes(attributes); - } - - @Override - protected void onComponentTag(final ComponentTag tag) - { - // only render handler if link is enabled - if (isEnabledInHierarchy()) - { - super.onComponentTag(tag); - } - } - - @Override - protected void onEvent(final AjaxRequestTarget target) - { - onClick(target); - target.add(StatelessAjaxFallbackLink.this); - } - - @Override - protected PageParameters getPageParameters() - { - return getPage().getPageParameters(); - } - }); - } - - /** - * - * @return call decorator to use or null if none - */ - protected void updateAjaxAttributes(AjaxRequestAttributes attributes) - { - } - - /** - * @see Link#onClick() - */ - @Override - public final void onClick() - { - onClick(null); - } - - @Override - protected void onComponentTag(ComponentTag tag) - { - super.onComponentTag(tag); - - tag.remove("onclick"); - } - - /** - * Callback for the onClick event. If ajax failed and this event was - * generated via a normal link the target argument will be null - * - * @param target - * ajax target if this linked was invoked using ajax, null - * otherwise - */ - public abstract void onClick(final AjaxRequestTarget target); -} diff --git a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/components/StatelessAjaxSubmitLink.java b/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/components/StatelessAjaxSubmitLink.java deleted file mode 100644 index 294f8a34bd..0000000000 --- a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/components/StatelessAjaxSubmitLink.java +++ /dev/null @@ -1,104 +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.wicketstuff.stateless.components; - -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.markup.html.link.AbstractLink; -import org.wicketstuff.stateless.behaviors.StatelessAjaxFormSubmitBehavior; - -/** - * Stateless version of AjaxSubmitLink. - * - * @author Andrea Del Bene - * - */ -public class StatelessAjaxSubmitLink extends AbstractLink -{ - - public StatelessAjaxSubmitLink(String id) - { - super(id); - setOutputMarkupId(true); - - add(new StatelessAjaxSubmittingLinkBehavior("click")); - } - - @Override - protected boolean getStatelessHint() - { - return true; - } - - /** - * AJAX submit behavior for this component. Its main purpose is to invoke component's - * submit processing handlers. - */ - class StatelessAjaxSubmittingLinkBehavior extends StatelessAjaxFormSubmitBehavior - { - - public StatelessAjaxSubmittingLinkBehavior(String event) - { - super(event); - } - - @Override - protected void onAfterSubmit(AjaxRequestTarget target) - { - StatelessAjaxSubmitLink.this.onAfterSubmit(target); - } - - @Override - protected void onSubmit(AjaxRequestTarget target) - { - StatelessAjaxSubmitLink.this.onSubmit(target); - } - - @Override - protected void onError(AjaxRequestTarget target) - { - StatelessAjaxSubmitLink.this.onError(target); - } - } - - /** - * Override this method to provide special submit handling in a multi-button form. This method - * will be called after the form's onSubmit method. - */ - protected void onAfterSubmit(AjaxRequestTarget target) - { - - } - - /** - * Override this method to provide special submit handling in a multi-button form. This method - * will be called before the form's onSubmit method. - */ - protected void onSubmit(AjaxRequestTarget target) - { - - } - - /** - * Listener method invoked when the form has been processed and errors occurred - * - * @param target - */ - protected void onError(AjaxRequestTarget target) - { - - } -} diff --git a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/components/StatelessIndicatingAjaxButton.java b/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/components/StatelessIndicatingAjaxButton.java deleted file mode 100644 index ab2dae5c6a..0000000000 --- a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/components/StatelessIndicatingAjaxButton.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.wicketstuff.stateless.components; - -import org.apache.wicket.Component; -import org.apache.wicket.ajax.IAjaxIndicatorAware; -import org.apache.wicket.extensions.ajax.markup.html.AjaxIndicatorAppender; -import org.apache.wicket.markup.html.form.Form; -import org.apache.wicket.model.IModel; - -public class StatelessIndicatingAjaxButton extends StatelessAjaxButton implements IAjaxIndicatorAware -{ - private static final long serialVersionUID = 1L; - private final AjaxIndicatorAppender indicatorAppender = new AjaxIndicatorAppender() - { - /** - * - */ - private static final long serialVersionUID = 1L; - - public boolean getStatelessHint(Component component) - { - return true; - } - }; - - public StatelessIndicatingAjaxButton(String id) - { - super(id); - } - - @Override - protected void onInitialize() - { - super.onInitialize(); - add(indicatorAppender); - } - - public StatelessIndicatingAjaxButton(String id, Form form) - { - super(id, form); - } - - - public StatelessIndicatingAjaxButton(String id, IModel model, Form form) - { - super(id, model, form); - } - - public StatelessIndicatingAjaxButton(String id, IModel model) - { - super(id, model); - } - - @Override - public String getAjaxIndicatorMarkupId() - { - return indicatorAppender.getMarkupId(); - } -} diff --git a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/components/StatelessIndicatingAjaxFallbackLink.java b/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/components/StatelessIndicatingAjaxFallbackLink.java deleted file mode 100644 index 33ec92a3d7..0000000000 --- a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/components/StatelessIndicatingAjaxFallbackLink.java +++ /dev/null @@ -1,56 +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.wicketstuff.stateless.components; - -import org.apache.wicket.Component; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.ajax.IAjaxIndicatorAware; -import org.apache.wicket.extensions.ajax.markup.html.AjaxIndicatorAppender; - -public class StatelessIndicatingAjaxFallbackLink extends StatelessAjaxFallbackLink implements IAjaxIndicatorAware -{ - private static final long serialVersionUID = 1L; - private final AjaxIndicatorAppender indicatorAppender = new AjaxIndicatorAppender() - { - /** - * - */ - private static final long serialVersionUID = 1L; - - public boolean getStatelessHint(Component component) - { - return true; - } - }; - - public StatelessIndicatingAjaxFallbackLink(String id) - { - super(id); - add(indicatorAppender); - } - - @Override - public String getAjaxIndicatorMarkupId() - { - return indicatorAppender.getMarkupId(); - } - - @Override - public void onClick(AjaxRequestTarget target) - { - } -} diff --git a/stateless-parent/stateless/src/test/java/org/wicketstuff/stateless/HomePage.html b/stateless-parent/stateless/src/test/java/org/wicketstuff/stateless/HomePage.html deleted file mode 100644 index 2ab9df22bf..0000000000 --- a/stateless-parent/stateless/src/test/java/org/wicketstuff/stateless/HomePage.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - Wicket Quickstart Archetype Homepage - - -
    -
  • Item 1
  • -
-
- More Data - Home - -
- -
- -
- -
-
- - diff --git a/stateless-parent/stateless/src/test/java/org/wicketstuff/stateless/HomePage.java b/stateless-parent/stateless/src/test/java/org/wicketstuff/stateless/HomePage.java deleted file mode 100644 index 7327aa8a45..0000000000 --- a/stateless-parent/stateless/src/test/java/org/wicketstuff/stateless/HomePage.java +++ /dev/null @@ -1,139 +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.wicketstuff.stateless; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.wicket.MarkupContainer; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.markup.html.WebMarkupContainer; -import org.apache.wicket.markup.html.WebPage; -import org.apache.wicket.markup.html.basic.Label; -import org.apache.wicket.markup.html.form.Form; -import org.apache.wicket.markup.html.form.StatelessForm; -import org.apache.wicket.markup.html.form.TextField; -import org.apache.wicket.markup.html.link.BookmarkablePageLink; -import org.apache.wicket.markup.html.link.Link; -import org.apache.wicket.markup.html.list.ListItem; -import org.apache.wicket.markup.html.list.ListView; -import org.apache.wicket.markup.html.panel.FeedbackPanel; -import org.apache.wicket.model.Model; -import org.apache.wicket.request.mapper.parameter.PageParameters; -import org.wicketstuff.stateless.components.StatelessAjaxFallbackLink; -import org.wicketstuff.stateless.components.StatelessAjaxSubmitLink; - -/** - * Homepage - */ -public class HomePage extends WebPage { - public static final String AJAX_SUBMIT = "AJAX submit"; - - public static final String FORM_SUBMIT = "form submit"; - - static int itemCount = 0; - - private static final long serialVersionUID = 1L; - - static List getList() { - final ArrayList list = new ArrayList(itemCount); - final int count = ++itemCount; - - for (int idx = 1; idx <= count; idx++) { - list.add(Integer.toString(idx)); - } - - return list; - } - - /** - * Constructor that is invoked when page is invoked without a session. - * - * @param parameters - * Page parameters - */ - public HomePage(final PageParameters parameters) { - super(parameters); - - final MarkupContainer list = new WebMarkupContainer("list"); - final List data = getList(); - final ListView listView = new ListView("item", data) { - private static final long serialVersionUID = 200478523599165606L; - - @Override - protected void populateItem(final ListItem item) { - final String _item = item.getModelObject(); - - item.add(new Label("value", _item)); - } - }; - final Link moreLink = new StatelessAjaxFallbackLink( - "more") { - private static final long serialVersionUID = -1023445535126577565L; - - @Override - public void onClick(final AjaxRequestTarget target) { - final List _data = getList(); - - System.out.println(_data); - - listView.setModelObject(_data); - - if (target != null) { - target.add(list, "new"); - } - } - }; - final Link homeLink = new BookmarkablePageLink("home", - HomePage.class); - - add(homeLink); - list.add(listView); - add(list); - add(moreLink); - - //add form - TextField name = new TextField("name", - new Model("name")); - TextField surname = new TextField("surname", - new Model("surname")); - - Form form = new StatelessForm("inputForm") { - @Override - protected void onSubmit() { - super.onSubmit(); - info(FORM_SUBMIT); - } - }; - - form.add(name, surname); - - final FeedbackPanel feedback; - form.add(feedback = new FeedbackPanel("feedback")); - feedback.setOutputMarkupId(true); - - form.add(new StatelessAjaxSubmitLink("submit") { - @Override - protected void onSubmit(AjaxRequestTarget target) { - super.onSubmit(target); - info(AJAX_SUBMIT); - target.add(feedback); - } - }); - add(form); - } -} diff --git a/stateless-parent/stateless/src/test/java/org/wicketstuff/stateless/StatelessAjaxComponentsBehaviorsTest.java b/stateless-parent/stateless/src/test/java/org/wicketstuff/stateless/StatelessAjaxComponentsBehaviorsTest.java deleted file mode 100644 index 614f454329..0000000000 --- a/stateless-parent/stateless/src/test/java/org/wicketstuff/stateless/StatelessAjaxComponentsBehaviorsTest.java +++ /dev/null @@ -1,116 +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.wicketstuff.stateless; - -import static org.junit.Assert.assertTrue; - -import java.util.List; - -import org.apache.wicket.Session; -import org.apache.wicket.ajax.AjaxEventBehavior; -import org.apache.wicket.behavior.Behavior; -import org.apache.wicket.page.XmlPartialPageUpdate; -import org.apache.wicket.util.tester.FormTester; -import org.apache.wicket.util.tester.WicketTester; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.wicketstuff.stateless.components.StatelessAjaxFallbackLink; - -/** - * @author jfk - * - */ -public class StatelessAjaxComponentsBehaviorsTest { - protected WicketTester tester; - - @Before - public void setUp() { - tester = new WicketTester(new WicketApplication()); - - } - - @After - public void teardown() { - final boolean dump = Boolean.getBoolean("dumpHtml"); - - if (dump) { - tester.dumpPage(); - } - //things must stay stateless - assertTrue(Session.get().isTemporary()); - } - - /** - * Test method for {@link org.wicketstuff.stateless.components.StatelessAjaxFallbackLink#getStatelessHint()}. - */ - @SuppressWarnings("unchecked") - @Test - public void testGetStatelessHint() { - tester.startPage(HomePage.class); - - final HomePage page = (HomePage) tester.getLastRenderedPage(); - final StatelessAjaxFallbackLink l1 = (StatelessAjaxFallbackLink) page - .get("more"); - - assertTrue(l1.isStateless()); - - l1.onClick(); - - final List behaviors = l1.getBehaviors(); - final AjaxEventBehavior behavior = (AjaxEventBehavior) behaviors.get(0); - - behavior.onRequest(); - } - - @Test - public void testSubmitForm() throws Exception { - tester.startPage(HomePage.class); - - FormTester formTester = tester.newFormTester("inputForm"); - formTester.setValue("name", "myname"); - formTester.setValue("surname", "mysurname"); - - tester.executeAjaxEvent("inputForm:submit", "click"); - - String response = tester.getLastResponseAsString(); - - boolean isAjaxResponse = response.contains(XmlPartialPageUpdate.START_ROOT_ELEMENT) - && response.contains(XmlPartialPageUpdate.END_ROOT_ELEMENT); - - assertTrue(isAjaxResponse); - - boolean formAjaxSubmit = response.contains(HomePage.FORM_SUBMIT) && - response.contains(HomePage.AJAX_SUBMIT); - - assertTrue(formAjaxSubmit); - } - - /** - * Test method for {@link StatelessAjaxFallbackLink#getStatelessHint()}. - */ - @Test - public void testHomePage() { - // start and render the test page - tester.startPage(HomePage.class); - - // assert rendered page class - tester.assertRenderedPage(HomePage.class); - - tester.clickLink("more"); - } -} diff --git a/stateless-parent/stateless/src/test/java/org/wicketstuff/stateless/StatelessEncoderTest.java b/stateless-parent/stateless/src/test/java/org/wicketstuff/stateless/StatelessEncoderTest.java deleted file mode 100644 index 2e4329caa1..0000000000 --- a/stateless-parent/stateless/src/test/java/org/wicketstuff/stateless/StatelessEncoderTest.java +++ /dev/null @@ -1,112 +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.wicketstuff.stateless; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -import org.apache.wicket.request.Url; -import org.apache.wicket.request.mapper.parameter.PageParameters; -import org.junit.Test; - -/** - * @author jfk - * - */ -public class StatelessEncoderTest { - - /** - * Test method for - * {@link org.wicketstuff.stateless.StatelessEncoder#mergeParameters(Url, PageParameters)}. - */ - @Test - public void testAppendnULLParameters() { - final Url encoded = StatelessEncoder.mergeParameters(null, null); - - assertNull(encoded); - } - - /** - * Test method for - * {@link StatelessEncoder#mergeParameters(Url, PageParameters)}. - */ - @Test - public void testAppendParameters() { - final PageParameters params = new PageParameters(); - - params.add("test1", "val1"); - params.add("test2", new String[] { "val2", "val3" }); - - StatelessEncoder.mergeParameters(null, null); - final Url originalUrl = Url.parse(""); - final Url encoded = StatelessEncoder.mergeParameters(originalUrl, params); - - // XXX compares Map content vs. its toString(). Improve the assertion! - assertEquals(Url.parse("?test1=val1&test2=val2&test2=val3"), encoded); - } - - @Test - public void overrideOriginalParameter() { - - Url originalUrl = Url.parse("./home?0-1.ILinkListener-c2--link&test2=original"); - - final PageParameters params = new PageParameters(); - params.add("test1", "value1"); - params.add("test2", new String[] { "val2", "val3" }); - - Url mergedParameters = StatelessEncoder.mergeParameters(originalUrl, params); - - assertEquals(Url.parse("./home?0-1.ILinkListener-c2--link&test1=value1&test2=val2&test2=val3"), mergedParameters); - } - - /** - * https://github.com/wicketstuff/core/issues/223 - */ - @Test - public void mergeIndexedParameters() - { - final PageParameters params = new PageParameters(); - - params.set(0, "val1"); - params.set(1, "val2"); - params.add("test2", new String[] { "val3", "val4" }); - - final Url originalUrl = Url.parse(""); - final Url encoded = StatelessEncoder.mergeParameters(originalUrl, params); - - // XXX compares Map content vs. its toString(). Improve the assertion! - assertEquals(Url.parse("val1/val2?test2=val3&test2=val4"), encoded); - } - - @Test - public void putIndexedParametersBeforeJsessionId() - { - Url originalUrl = Url.parse("/wicket/page;jsessionid=1255ckl9n31uj1baf4wv9yqv7r?0-1.ILinkListener-link"); - final PageParameters params = new PageParameters(); - - params.set(0, "val1"); - params.set(1, "val2"); - params.add("test2", new String[] { "val3", "val4" }); - - final Url encoded = StatelessEncoder.mergeParameters(originalUrl, params); - - assertEquals(Url.parse("/wicket/page/val1/val2;jsessionid=1255ckl9n31uj1baf4wv9yqv7r?0-1.ILinkListener-link&test2=val3&test2=val4"), encoded); - } -} diff --git a/stateless-parent/stateless/src/test/java/org/wicketstuff/stateless/WicketApplication.java b/stateless-parent/stateless/src/test/java/org/wicketstuff/stateless/WicketApplication.java deleted file mode 100644 index b7e3b12e31..0000000000 --- a/stateless-parent/stateless/src/test/java/org/wicketstuff/stateless/WicketApplication.java +++ /dev/null @@ -1,32 +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.wicketstuff.stateless; - -import org.apache.wicket.Page; -import org.apache.wicket.protocol.http.WebApplication; - -/** - * The Class WicketApplication. - */ -class WicketApplication extends WebApplication -{ - @Override - public Class getHomePage() - { - return HomePage.class; - } -} \ No newline at end of file