git commit: Reverts returned values to match logic and checks if protocol is not null
Repository: struts Updated Branches: refs/heads/feature/WW-4187-correctly-identify-protocols 1ca55b8a7 -> d59fb2b9e Reverts returned values to match logic and checks if protocol is not null Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/d59fb2b9 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/d59fb2b9 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/d59fb2b9 Branch: refs/heads/feature/WW-4187-correctly-identify-protocols Commit: d59fb2b9ecd6e43a9029583f720002a072d965fb Parents: 1ca55b8 Author: Lukasz Lenart Authored: Wed Mar 19 08:50:56 2014 +0100 Committer: Lukasz Lenart Committed: Wed Mar 19 08:50:56 2014 +0100 -- .../apache/struts2/dispatcher/ServletRedirectResult.java | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/struts/blob/d59fb2b9/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java -- diff --git a/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java b/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java index 9820295..e4347b0 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java @@ -39,6 +39,7 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.net.MalformedURLException; import java.net.URI; +import java.net.URL; import java.util.*; import static javax.servlet.http.HttpServletResponse.SC_FOUND; @@ -274,27 +275,27 @@ public class ServletRedirectResult extends StrutsResultSupport implements Reflec try { URI uri = URI.create(url); if (uri.isAbsolute()) { -uri.toURL(); +URL validUrl = uri.toURL(); if (LOG.isDebugEnabled()) { LOG.debug("[#0] is full url, not a path", url); } -return true; +return validUrl.getProtocol() == null; } else { if (LOG.isDebugEnabled()) { LOG.debug("[#0] isn't absolute URI, assuming it's a path", url); } -return false; +return true; } } catch (IllegalArgumentException e) { if (LOG.isDebugEnabled()) { LOG.debug("[#0] isn't a valid URL, assuming it's a path", e, url); } -return false; +return true; } catch (MalformedURLException e) { if (LOG.isDebugEnabled()) { LOG.debug("[#0] isn't a valid URL, assuming it's a path", e, url); } -return false; +return true; } }
[06/14] git commit: WW-4198 Merges changes to develop
WW-4198 Merges changes to develop Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/aa744b81 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/aa744b81 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/aa744b81 Branch: refs/heads/feature/WW-4187-correctly-identify-protocols Commit: aa744b811f9c41b80cc30ad6cf41ccaa75da5323 Parents: bcd61a0 e585490 Author: Lukasz Lenart Authored: Thu Mar 13 18:39:15 2014 +0100 Committer: Lukasz Lenart Committed: Thu Mar 13 18:39:15 2014 +0100 -- .../template/xhtml/form-close-validate.ftl | 2 +- .../com/opensymphony/xwork2/util/URLUtil.java | 1 + ...nnotationValidationConfigurationBuilder.java | 6 ++ .../validator/annotations/UrlValidator.java | 76 +++- .../validator/validators/URLValidator.java | 66 +++-- .../xwork2/validator/URLValidatorTest.java | 50 + 6 files changed, 112 insertions(+), 89 deletions(-) --
[10/14] git commit: WW-4297 finishes feature: improves hidden tag to properly support xhtml theme
WW-4297 finishes feature: improves hidden tag to properly support xhtml theme Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/d63deb97 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/d63deb97 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/d63deb97 Branch: refs/heads/feature/WW-4187-correctly-identify-protocols Commit: d63deb9750a3d409be30414faaf76f5481a4417d Parents: aa744b8 924531c Author: Lukasz Lenart Authored: Thu Mar 13 20:21:50 2014 +0100 Committer: Lukasz Lenart Committed: Thu Mar 13 20:21:50 2014 +0100 -- .../org/apache/struts2/components/Hidden.java | 7 ++ .../main/resources/template/xhtml/hidden.ftl| 25 .../apache/struts2/StrutsInternalTestCase.java | 9 --- .../struts2/views/jsp/AbstractTagTest.java | 4 +--- .../apache/struts2/views/jsp/ui/Hidden-1.txt| 8 ++- .../apache/struts2/views/jsp/ui/Hidden-2.txt| 8 ++- 6 files changed, 51 insertions(+), 10 deletions(-) --
[01/14] git commit: Extends validator to allow set predefined regex used to validate URLs
Repository: struts Updated Branches: refs/heads/feature/WW-4187-correctly-identify-protocols d59fb2b9e -> 3c1d25c04 Extends validator to allow set predefined regex used to validate URLs Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/31be88af Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/31be88af Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/31be88af Branch: refs/heads/feature/WW-4187-correctly-identify-protocols Commit: 31be88afa28fb9b1e9854d0d7673ab9b979cf9be Parents: bcd61a0 Author: Lukasz Lenart Authored: Sun Mar 9 21:01:15 2014 +0100 Committer: Lukasz Lenart Committed: Sun Mar 9 21:01:15 2014 +0100 -- .../validator/validators/URLValidator.java | 46 ++ .../xwork2/validator/URLValidatorTest.java | 50 2 files changed, 96 insertions(+) -- http://git-wip-us.apache.org/repos/asf/struts/blob/31be88af/xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/URLValidator.java -- diff --git a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/URLValidator.java b/xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/URLValidator.java index b4a1287..4f63961 100644 --- a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/URLValidator.java +++ b/xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/URLValidator.java @@ -17,6 +17,7 @@ package com.opensymphony.xwork2.validator.validators; import com.opensymphony.xwork2.validator.ValidationException; import com.opensymphony.xwork2.util.URLUtil; +import org.apache.commons.lang3.StringUtils; /** * @@ -31,6 +32,8 @@ import com.opensymphony.xwork2.util.URLUtil; * * * fieldName - The field name this validator is validating. Required if using Plain-Validator Syntax otherwise not required + * urlRegexExpression - The regex defined as expression used to validate url. If not defined 'urlRegex' will be used instead + * urlRegex - The regex used to validate url. If not defined default regex will be used * * * @@ -62,6 +65,9 @@ import com.opensymphony.xwork2.util.URLUtil; */ public class URLValidator extends FieldValidatorSupport { +private String urlRegex; +private String urlRegexExpression; + public void validate(Object object) throws ValidationException { String fieldName = getFieldName(); Object value = this.getFieldValue(fieldName, object); @@ -72,8 +78,48 @@ public class URLValidator extends FieldValidatorSupport { return; } +// FIXME deprecated! the same regex below should be used instead +// replace logic with next major release if (!(value.getClass().equals(String.class)) || !URLUtil.verifyUrl((String) value)) { addFieldError(fieldName, object); } } + +/** + * This is used to support client-side validation, it's based on + * http://stackoverflow.com/questions/161738/what-is-the-best-regular-expression-to-check-if-a-string-is-a-valid-url + * + * @return regex to validate URLs + */ +public String getUrlRegex() { +if (StringUtils.isNotEmpty(urlRegexExpression)) { +return (String) parse(urlRegexExpression, String.class); +} else if (StringUtils.isNotEmpty(urlRegex)) { +return urlRegex; +} else { +return "^(https?|ftp):\\/\\/" + +"(([a-z0-9$_\\.\\+!\\*\\'\\(\\),;\\?&=-]|%[0-9a-f]{2})+" + + "(:([a-z0-9$_\\.\\+!\\*\\'\\(\\),;\\?&=-]|%[0-9a-f]{2})+)?" + +"@)?(#?" + +")((([a-z0-9]\\.|[a-z0-9][a-z0-9-]*[a-z0-9]\\.)*" + +"[a-z][a-z0-9-]*[a-z0-9]" + +"|((\\d|[1-9]\\d|1\\d{2}|2[0-4][0-9]|25[0-5])\\.){3}" + +"(\\d|[1-9]\\d|1\\d{2}|2[0-4][0-9]|25[0-5])" + +")(:\\d+)?" + + ")(((\\/+([a-z0-9$_\\.\\+!\\*\\'\\(\\),;:@&=-]|%[0-9a-f]{2})*)*" + + "(\\?([a-z0-9$_\\.\\+!\\*\\'\\(\\),;:@&=-]|%[0-9a-f]{2})*)" + +"?)?)?" + +"(#([a-z0-9$_\\.\\+!\\*\\'\\(\\),;:@&=-]|%[0-9a-f]{2})*)?" + +"$"; +} +} + +public void setUrlRegex(String urlRegex) { +this.urlRegex = urlRegex; +} + +public void setUrlRegexExpression(String urlRegexExpression) { +this.urlRegexExpression = urlRegexExpression; +} + } http://git-wip-us.apache.org/repos/asf/struts/blob/31be88af/xwork-core/src/test/java/com/opensymphony/xwork2/validator/URLValidatorTest.java
[02/14] git commit: Marks method as deprecated
Marks method as deprecated Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/3457a656 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/3457a656 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/3457a656 Branch: refs/heads/feature/WW-4187-correctly-identify-protocols Commit: 3457a656ba95539145ef3b19d254fe0129b4d187 Parents: 31be88a Author: Lukasz Lenart Authored: Sun Mar 9 21:01:44 2014 +0100 Committer: Lukasz Lenart Committed: Sun Mar 9 21:01:44 2014 +0100 -- xwork-core/src/main/java/com/opensymphony/xwork2/util/URLUtil.java | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/struts/blob/3457a656/xwork-core/src/main/java/com/opensymphony/xwork2/util/URLUtil.java -- diff --git a/xwork-core/src/main/java/com/opensymphony/xwork2/util/URLUtil.java b/xwork-core/src/main/java/com/opensymphony/xwork2/util/URLUtil.java index b9aaee7..160a5b9 100644 --- a/xwork-core/src/main/java/com/opensymphony/xwork2/util/URLUtil.java +++ b/xwork-core/src/main/java/com/opensymphony/xwork2/util/URLUtil.java @@ -33,6 +33,7 @@ public class URLUtil { * @param url The url string to verify. * @return a boolean indicating whether the URL seems to be incorrect. */ +@Deprecated public static boolean verifyUrl(String url) { if (LOG.isDebugEnabled()) { LOG.debug("Checking if url [#0] is valid", url);
[05/14] git commit: Moves snippets to wiki
Moves snippets to wiki Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/e5854906 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/e5854906 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/e5854906 Branch: refs/heads/feature/WW-4187-correctly-identify-protocols Commit: e585490656225f88dc28300b722ec38dcffbb6ba Parents: e66a306 Author: Lukasz Lenart Authored: Sun Mar 9 21:22:28 2014 +0100 Committer: Lukasz Lenart Committed: Sun Mar 9 21:22:28 2014 +0100 -- .../validator/annotations/UrlValidator.java | 2 -- .../validator/validators/URLValidator.java | 24 2 files changed, 26 deletions(-) -- http://git-wip-us.apache.org/repos/asf/struts/blob/e5854906/xwork-core/src/main/java/com/opensymphony/xwork2/validator/annotations/UrlValidator.java -- diff --git a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/annotations/UrlValidator.java b/xwork-core/src/main/java/com/opensymphony/xwork2/validator/annotations/UrlValidator.java index a06db12..9ad9223 100644 --- a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/annotations/UrlValidator.java +++ b/xwork-core/src/main/java/com/opensymphony/xwork2/validator/annotations/UrlValidator.java @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.opensymphony.xwork2.validator.annotations; import java.lang.annotation.ElementType; @@ -27,7 +26,6 @@ import java.lang.annotation.Target; * * @UrlValidator(message = "Default message", key = "i18n.key", shortCircuit = true) * - * */ @Target({ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) http://git-wip-us.apache.org/repos/asf/struts/blob/e5854906/xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/URLValidator.java -- diff --git a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/URLValidator.java b/xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/URLValidator.java index 4f63961..767416d 100644 --- a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/URLValidator.java +++ b/xwork-core/src/main/java/com/opensymphony/xwork2/validator/validators/URLValidator.java @@ -20,28 +20,9 @@ import com.opensymphony.xwork2.util.URLUtil; import org.apache.commons.lang3.StringUtils; /** - * - * * URLValidator checks that a given field is a String and a valid URL - * - * - * - * - * - * - * - * - * fieldName - The field name this validator is validating. Required if using Plain-Validator Syntax otherwise not required - * urlRegexExpression - The regex defined as expression used to validate url. If not defined 'urlRegex' will be used instead - * urlRegex - The regex used to validate url. If not defined default regex will be used - * - * - * - * - * * * - * ** * - * * - * - * - * @author $Author$ - * @version $Date$ $Revision$ */ public class URLValidator extends FieldValidatorSupport {@@ -56,12 +37,7 @@ import org.apache.commons.lang3.StringUtils; * * *
[07/14] git commit: Extends Hidden to support xhtml theme properly
Extends Hidden to support xhtml theme properly Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/cdf3c5cb Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/cdf3c5cb Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/cdf3c5cb Branch: refs/heads/feature/WW-4187-correctly-identify-protocols Commit: cdf3c5cbf120d984049bb6d292193d8620d52639 Parents: aa744b8 Author: Lukasz Lenart Authored: Thu Mar 13 20:17:01 2014 +0100 Committer: Lukasz Lenart Committed: Thu Mar 13 20:17:01 2014 +0100 -- .../org/apache/struts2/components/Hidden.java | 7 ++ .../main/resources/template/xhtml/hidden.ftl| 25 2 files changed, 32 insertions(+) -- http://git-wip-us.apache.org/repos/asf/struts/blob/cdf3c5cb/core/src/main/java/org/apache/struts2/components/Hidden.java -- diff --git a/core/src/main/java/org/apache/struts2/components/Hidden.java b/core/src/main/java/org/apache/struts2/components/Hidden.java index 62efc44..36b03d1 100644 --- a/core/src/main/java/org/apache/struts2/components/Hidden.java +++ b/core/src/main/java/org/apache/struts2/components/Hidden.java @@ -65,4 +65,11 @@ public class Hidden extends UIBean { protected String getDefaultTemplate() { return TEMPLATE; } + +@Override +public void evaluateParams() { +super.evaluateParams(); +label = null; +addParameter("label", null); +} } http://git-wip-us.apache.org/repos/asf/struts/blob/cdf3c5cb/core/src/main/resources/template/xhtml/hidden.ftl -- diff --git a/core/src/main/resources/template/xhtml/hidden.ftl b/core/src/main/resources/template/xhtml/hidden.ftl new file mode 100644 index 000..3ff0f05 --- /dev/null +++ b/core/src/main/resources/template/xhtml/hidden.ftl @@ -0,0 +1,25 @@ +<#-- +/* + * $Id$ + * + * 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. + */ +--> +<#include "/${parameters.templateDir}/${parameters.expandTheme}/controlheader.ftl" /> +<#include "/${parameters.templateDir}/simple/hidden.ftl" /> +<#include "/${parameters.templateDir}/${parameters.expandTheme}/controlfooter.ftl" />
[09/14] git commit: Improves tests to reuse the same ServletContext
Improves tests to reuse the same ServletContext Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/924531c5 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/924531c5 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/924531c5 Branch: refs/heads/feature/WW-4187-correctly-identify-protocols Commit: 924531c54400882d1781ba3067d7af63825850c3 Parents: 43e86d7 Author: Lukasz Lenart Authored: Thu Mar 13 20:20:25 2014 +0100 Committer: Lukasz Lenart Committed: Thu Mar 13 20:20:25 2014 +0100 -- .../java/org/apache/struts2/StrutsInternalTestCase.java | 9 - .../java/org/apache/struts2/views/jsp/AbstractTagTest.java | 4 +--- 2 files changed, 5 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/struts/blob/924531c5/core/src/test/java/org/apache/struts2/StrutsInternalTestCase.java -- diff --git a/core/src/test/java/org/apache/struts2/StrutsInternalTestCase.java b/core/src/test/java/org/apache/struts2/StrutsInternalTestCase.java index 0b9d1c4..6816481 100644 --- a/core/src/test/java/org/apache/struts2/StrutsInternalTestCase.java +++ b/core/src/test/java/org/apache/struts2/StrutsInternalTestCase.java @@ -21,15 +21,12 @@ package org.apache.struts2; -import com.opensymphony.xwork2.ActionProxyFactory; import com.opensymphony.xwork2.XWorkTestCase; -import com.opensymphony.xwork2.config.ConfigurationProvider; -import com.opensymphony.xwork2.util.XWorkTestCaseHelper; import com.opensymphony.xwork2.util.logging.LoggerFactory; import com.opensymphony.xwork2.util.logging.jdk.JdkLoggerFactory; import org.apache.struts2.dispatcher.Dispatcher; import org.apache.struts2.util.StrutsTestCaseHelper; -import org.springframework.mock.web.MockServletContext; +import org.apache.struts2.views.jsp.StrutsMockServletContext; import java.text.SimpleDateFormat; import java.util.Date; @@ -75,6 +72,7 @@ public abstract class StrutsInternalTestCase extends XWorkTestCase { LoggerFactory.setLoggerFactory(new JdkLoggerFactory()); } +protected StrutsMockServletContext servletContext; protected Dispatcher dispatcher; /** @@ -87,7 +85,8 @@ public abstract class StrutsInternalTestCase extends XWorkTestCase { } protected Dispatcher initDispatcher(Map params) { -dispatcher = StrutsTestCaseHelper.initDispatcher(new MockServletContext(), params); +servletContext = new StrutsMockServletContext(); +dispatcher = StrutsTestCaseHelper.initDispatcher(servletContext, params); configurationManager = dispatcher.getConfigurationManager(); configuration = configurationManager.getConfiguration(); container = configuration.getContainer(); http://git-wip-us.apache.org/repos/asf/struts/blob/924531c5/core/src/test/java/org/apache/struts2/views/jsp/AbstractTagTest.java -- diff --git a/core/src/test/java/org/apache/struts2/views/jsp/AbstractTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/AbstractTagTest.java index 36b04fa..60eb170 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/AbstractTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/AbstractTagTest.java @@ -61,7 +61,6 @@ public abstract class AbstractTagTest extends StrutsInternalTestCase { protected StrutsMockHttpServletRequest request; protected StrutsMockPageContext pageContext; protected HttpServletResponse response; -protected StrutsMockServletContext servletContext; protected Mock mockContainer; @@ -83,7 +82,7 @@ public abstract class AbstractTagTest extends StrutsInternalTestCase { createMocks(); } -protected void createMocks() { +protected void createMocks() throws Exception { action = this.getAction(); stack = ActionContext.getContext().getValueStack(); context = stack.getContext(); @@ -99,7 +98,6 @@ public abstract class AbstractTagTest extends StrutsInternalTestCase { JspWriter jspWriter = new StrutsMockJspWriter(writer); -servletContext = new StrutsMockServletContext(); servletContext.setRealPath(new File("nosuchfile.properties").getAbsolutePath()); servletContext.setServletInfo("Resin");
[04/14] git commit: Extends annotation to support new URL regex parameters
Extends annotation to support new URL regex parameters Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/e66a3062 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/e66a3062 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/e66a3062 Branch: refs/heads/feature/WW-4187-correctly-identify-protocols Commit: e66a3062992fac588cf3f570a224bbe7d9ce5ef5 Parents: 3f6ce65 Author: Lukasz Lenart Authored: Sun Mar 9 21:04:11 2014 +0100 Committer: Lukasz Lenart Committed: Sun Mar 9 21:04:11 2014 +0100 -- ...nnotationValidationConfigurationBuilder.java | 6 ++ .../validator/annotations/UrlValidator.java | 74 +++- 2 files changed, 16 insertions(+), 64 deletions(-) -- http://git-wip-us.apache.org/repos/asf/struts/blob/e66a3062/xwork-core/src/main/java/com/opensymphony/xwork2/validator/AnnotationValidationConfigurationBuilder.java -- diff --git a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/AnnotationValidationConfigurationBuilder.java b/xwork-core/src/main/java/com/opensymphony/xwork2/validator/AnnotationValidationConfigurationBuilder.java index 6ab06a9..dbd8975 100644 --- a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/AnnotationValidationConfigurationBuilder.java +++ b/xwork-core/src/main/java/com/opensymphony/xwork2/validator/AnnotationValidationConfigurationBuilder.java @@ -528,6 +528,12 @@ public class AnnotationValidationConfigurationBuilder { } else if (v.fieldName() != null && v.fieldName().length() > 0) { params.put("fieldName", v.fieldName()); } +if (StringUtils.isNotEmpty(v.urlRegex())) { +params.put("urlRegex", v.urlRegex()); +} +if (StringUtils.isNotEmpty(v.urlRegexExpression())) { +params.put("urlRegexExpression", v.urlRegexExpression()); +} validatorFactory.lookupRegisteredValidatorType(validatorType); return new ValidatorConfig.Builder(validatorType) http://git-wip-us.apache.org/repos/asf/struts/blob/e66a3062/xwork-core/src/main/java/com/opensymphony/xwork2/validator/annotations/UrlValidator.java -- diff --git a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/annotations/UrlValidator.java b/xwork-core/src/main/java/com/opensymphony/xwork2/validator/annotations/UrlValidator.java index fb6fa3c..a06db12 100644 --- a/xwork-core/src/main/java/com/opensymphony/xwork2/validator/annotations/UrlValidator.java +++ b/xwork-core/src/main/java/com/opensymphony/xwork2/validator/annotations/UrlValidator.java @@ -22,75 +22,12 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** - * * This validator checks that a field is a valid URL. - * - * - * Annotation usage: - * - * - * The annotation must be applied at method level. - * - * - * Annotation parameters: - * - * - * - * - * Parameter - * Required - * Default - * Notes - * - * - * message - * yes - * - * field error message - * - * - * key - * no - * - * i18n key from language specific properties file. - * - * - * messageParams - * no - * - * Additional params to be used to customize message - will be evaluated against the Value Stack - * - * - * fieldName - * no - * - * - * - * - * shortCircuit - * no - * false - * If this validator should be used as shortCircuit. - * - * - * type - * yes - * ValidatorType.FIELD - * Enum value from ValidatorType. Either FIELD or SIMPLE can be used here. - * - * - * - * - * Example code: * * - * * @UrlValidator(message = "Default message", key = "i18n.key", shortCircuit = true) - * * * - * @author Rainer Hermanns - * @version $Id$ */ @Target({ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @@ -121,7 +58,6 @@ public @interface UrlValidator { * If this is activated, the validator will be used as short-circuit. * * Adds the short-circuit="true" attribute value if true. - * */ boolean shortCircuit() default false; @@ -130,4 +66,14 @@ public @interface UrlValidator { */ ValidatorType type() default ValidatorType.FIELD; +/** + * Defines regex to use to validate url + */ +String urlRegex() default ""; + +/** + * Defines regex as an expression which will be evaluated to string and used to validate url + */ +String urlRegexExpression() default ""; + }
[12/14] git commit: https://issues.apache.org/jira/browse/WW-4299 - do not assign value to id parameter if tryId value is null this prevents overwriting a parameter with a name of id used with the com
https://issues.apache.org/jira/browse/WW-4299 - do not assign value to id parameter if tryId value is null this prevents overwriting a parameter with a name of id used with the component tag Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/cb9f0f56 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/cb9f0f56 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/cb9f0f56 Branch: refs/heads/feature/WW-4187-correctly-identify-protocols Commit: cb9f0f5645d05b2f1c7c66640716acff61c4425f Parents: 3ceb3b9 Author: phillips1021 Authored: Tue Mar 18 09:46:36 2014 -0500 Committer: phillips1021 Committed: Tue Mar 18 09:46:36 2014 -0500 -- .../src/main/java/org/apache/struts2/components/UIBean.java | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/struts/blob/cb9f0f56/core/src/main/java/org/apache/struts2/components/UIBean.java -- diff --git a/core/src/main/java/org/apache/struts2/components/UIBean.java b/core/src/main/java/org/apache/struts2/components/UIBean.java index 9418a6e..51b7e79 100644 --- a/core/src/main/java/org/apache/struts2/components/UIBean.java +++ b/core/src/main/java/org/apache/struts2/components/UIBean.java @@ -1024,8 +1024,13 @@ public abstract class UIBean extends Component { } else { tryId = generatedId; } -addParameter("id", tryId); -addParameter("escapedId", escape(tryId)); + +//fix for https://issues.apache.org/jira/browse/WW-4299 +//do not assign value to id if tryId is null +if (tryId != null) { + addParameter("id", tryId); + addParameter("escapedId", escape(tryId)); +} } /**
[13/14] git commit: No JIRA - edit JavaDoc for class to make it clearer how to assign a value to a parameter when that value is a literal string
No JIRA - edit JavaDoc for class to make it clearer how to assign a value to a parameter when that value is a literal string Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/561063a4 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/561063a4 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/561063a4 Branch: refs/heads/feature/WW-4187-correctly-identify-protocols Commit: 561063a4227dd609ccba83880b2d0c6ec2d1e4aa Parents: cb9f0f5 Author: phillips1021 Authored: Tue Mar 18 09:48:18 2014 -0500 Committer: phillips1021 Committed: Tue Mar 18 09:48:18 2014 -0500 -- .../main/java/org/apache/struts2/components/GenericUIBean.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/struts/blob/561063a4/core/src/main/java/org/apache/struts2/components/GenericUIBean.java -- diff --git a/core/src/main/java/org/apache/struts2/components/GenericUIBean.java b/core/src/main/java/org/apache/struts2/components/GenericUIBean.java index 64dfabe..9521e1f 100644 --- a/core/src/main/java/org/apache/struts2/components/GenericUIBean.java +++ b/core/src/main/java/org/apache/struts2/components/GenericUIBean.java @@ -56,9 +56,8 @@ import com.opensymphony.xwork2.util.ValueStack; * engine will be found based on file extension. * * Remember: the value params will always be resolved against the ValueStack so if you mean to pass a - * string literal to your component, make sure to wrap it in quotes i.e. value="'value1'" otherwise, the the value - * stack will search for an Object on the stack with a method of getValue1(). (now that i've written this, i'm not - * entirely sure this is the case. i should verify this manana) + * string literal to your component, make sure to wrap it in single quotes i.e. value="'value1'" (note the opening "' and closing '" otherwise, the the value + * stack will search for an Object on the stack with a method of getValue1(). * * *
[11/14] git commit: Uses simplest approach to inline s:hidden tag to xhtml theme
Uses simplest approach to inline s:hidden tag to xhtml theme Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/3ceb3b97 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/3ceb3b97 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/3ceb3b97 Branch: refs/heads/feature/WW-4187-correctly-identify-protocols Commit: 3ceb3b973ea53a5e0f8f2c3b772eb50daee6aec0 Parents: d63deb9 Author: Lukasz Lenart Authored: Thu Mar 13 21:49:54 2014 +0100 Committer: Lukasz Lenart Committed: Thu Mar 13 21:49:54 2014 +0100 -- core/src/main/resources/template/xhtml/hidden.ftl| 8 +--- .../resources/org/apache/struts2/views/jsp/ui/Hidden-1.txt | 6 ++ .../resources/org/apache/struts2/views/jsp/ui/Hidden-2.txt | 6 ++ 3 files changed, 9 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/struts/blob/3ceb3b97/core/src/main/resources/template/xhtml/hidden.ftl -- diff --git a/core/src/main/resources/template/xhtml/hidden.ftl b/core/src/main/resources/template/xhtml/hidden.ftl index 3ff0f05..92881ab 100644 --- a/core/src/main/resources/template/xhtml/hidden.ftl +++ b/core/src/main/resources/template/xhtml/hidden.ftl @@ -20,6 +20,8 @@ * under the License. */ --> -<#include "/${parameters.templateDir}/${parameters.expandTheme}/controlheader.ftl" /> -<#include "/${parameters.templateDir}/simple/hidden.ftl" /> -<#include "/${parameters.templateDir}/${parameters.expandTheme}/controlfooter.ftl" /> + + +<#include "/${parameters.templateDir}/simple/hidden.ftl" /> + + http://git-wip-us.apache.org/repos/asf/struts/blob/3ceb3b97/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-1.txt -- diff --git a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-1.txt b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-1.txt index fafc7ba..875ee46 100644 --- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-1.txt +++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-1.txt @@ -1,7 +1,5 @@ - - - - + + http://git-wip-us.apache.org/repos/asf/struts/blob/3ceb3b97/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-2.txt -- diff --git a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-2.txt b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-2.txt index df7e11b..a5376ff 100644 --- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-2.txt +++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-2.txt @@ -1,7 +1,5 @@ - - - - + +
[14/14] git commit: Merge branch 'develop' into feature/WW-4187-correctly-identify-protocols
Merge branch 'develop' into feature/WW-4187-correctly-identify-protocols Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/3c1d25c0 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/3c1d25c0 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/3c1d25c0 Branch: refs/heads/feature/WW-4187-correctly-identify-protocols Commit: 3c1d25c04f1d1a65fca15d1c2de062dd1ae54f34 Parents: d59fb2b 561063a Author: Lukasz Lenart Authored: Wed Mar 19 08:52:14 2014 +0100 Committer: Lukasz Lenart Committed: Wed Mar 19 08:52:14 2014 +0100 -- .../struts2/components/GenericUIBean.java | 5 +- .../org/apache/struts2/components/Hidden.java | 7 ++ .../org/apache/struts2/components/UIBean.java | 9 ++- .../template/xhtml/form-close-validate.ftl | 2 +- .../main/resources/template/xhtml/hidden.ftl| 27 +++ .../apache/struts2/StrutsInternalTestCase.java | 9 ++- .../struts2/views/jsp/AbstractTagTest.java | 4 +- .../apache/struts2/views/jsp/ui/Hidden-1.txt| 6 +- .../apache/struts2/views/jsp/ui/Hidden-2.txt| 6 +- .../com/opensymphony/xwork2/util/URLUtil.java | 1 + ...nnotationValidationConfigurationBuilder.java | 6 ++ .../validator/annotations/UrlValidator.java | 76 +++- .../validator/validators/URLValidator.java | 66 +++-- .../xwork2/validator/URLValidatorTest.java | 50 + 14 files changed, 170 insertions(+), 104 deletions(-) --
[03/14] git commit: Adds usage of new urlRegex field in client side validation
Adds usage of new urlRegex field in client side validation Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/3f6ce657 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/3f6ce657 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/3f6ce657 Branch: refs/heads/feature/WW-4187-correctly-identify-protocols Commit: 3f6ce657da3ac6c133939bfcebb4e4e5f6bd2bc1 Parents: 3457a65 Author: Lukasz Lenart Authored: Sun Mar 9 21:02:27 2014 +0100 Committer: Lukasz Lenart Committed: Sun Mar 9 21:02:27 2014 +0100 -- core/src/main/resources/template/xhtml/form-close-validate.ftl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/struts/blob/3f6ce657/core/src/main/resources/template/xhtml/form-close-validate.ftl -- diff --git a/core/src/main/resources/template/xhtml/form-close-validate.ftl b/core/src/main/resources/template/xhtml/form-close-validate.ftl index 81a17e1..f129156 100644 --- a/core/src/main/resources/template/xhtml/form-close-validate.ftl +++ b/core/src/main/resources/template/xhtml/form-close-validate.ftl @@ -120,7 +120,7 @@ END SNIPPET: supported-validators <#if validator.shortCircuit>continueValidation = false; } <#elseif validator.validatorType = "url"> -if (continueValidation && fieldValue != null && fieldValue.length > 0 && fieldValue.match("${validator.regex?js_string}")==null) { +if (continueValidation && fieldValue != null && fieldValue.length > 0 && fieldValue.match("/${validator.urlRegex?js_string}/i")==null) { addError(field, error); errors = true; <#if validator.shortCircuit>continueValidation = false;
[08/14] git commit: Extends Hidden tests results to match new xhtml theme
Extends Hidden tests results to match new xhtml theme Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/43e86d76 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/43e86d76 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/43e86d76 Branch: refs/heads/feature/WW-4187-correctly-identify-protocols Commit: 43e86d76d5dc6bc7b6261e91eaddcee2cc009a6b Parents: cdf3c5c Author: Lukasz Lenart Authored: Thu Mar 13 20:19:59 2014 +0100 Committer: Lukasz Lenart Committed: Thu Mar 13 20:19:59 2014 +0100 -- .../resources/org/apache/struts2/views/jsp/ui/Hidden-1.txt | 8 +++- .../resources/org/apache/struts2/views/jsp/ui/Hidden-2.txt | 8 +++- 2 files changed, 14 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/struts/blob/43e86d76/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-1.txt -- diff --git a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-1.txt b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-1.txt index 4d6c927..fafc7ba 100644 --- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-1.txt +++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-1.txt @@ -1 +1,7 @@ - + + + + + + + http://git-wip-us.apache.org/repos/asf/struts/blob/43e86d76/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-2.txt -- diff --git a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-2.txt b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-2.txt index 2cc5ab6..df7e11b 100644 --- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-2.txt +++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-2.txt @@ -1 +1,7 @@ - + + + + + + +
[4/5] git commit: Merge branch 'develop' into feature/WW-4187-correctly-identify-protocols
Merge branch 'develop' into feature/WW-4187-correctly-identify-protocols Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/3c1d25c0 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/3c1d25c0 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/3c1d25c0 Branch: refs/heads/develop Commit: 3c1d25c04f1d1a65fca15d1c2de062dd1ae54f34 Parents: d59fb2b 561063a Author: Lukasz Lenart Authored: Wed Mar 19 08:52:14 2014 +0100 Committer: Lukasz Lenart Committed: Wed Mar 19 08:52:14 2014 +0100 -- .../struts2/components/GenericUIBean.java | 5 +- .../org/apache/struts2/components/Hidden.java | 7 ++ .../org/apache/struts2/components/UIBean.java | 9 ++- .../template/xhtml/form-close-validate.ftl | 2 +- .../main/resources/template/xhtml/hidden.ftl| 27 +++ .../apache/struts2/StrutsInternalTestCase.java | 9 ++- .../struts2/views/jsp/AbstractTagTest.java | 4 +- .../apache/struts2/views/jsp/ui/Hidden-1.txt| 6 +- .../apache/struts2/views/jsp/ui/Hidden-2.txt| 6 +- .../com/opensymphony/xwork2/util/URLUtil.java | 1 + ...nnotationValidationConfigurationBuilder.java | 6 ++ .../validator/annotations/UrlValidator.java | 76 +++- .../validator/validators/URLValidator.java | 66 +++-- .../xwork2/validator/URLValidatorTest.java | 50 + 14 files changed, 170 insertions(+), 104 deletions(-) --
[2/5] git commit: Extends logic how protocol part of url is extracted
Extends logic how protocol part of url is extracted Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/1ca55b8a Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/1ca55b8a Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/1ca55b8a Branch: refs/heads/develop Commit: 1ca55b8a79cc118128391bddd3b776024def79f8 Parents: 4b7d2e3 Author: Lukasz Lenart Authored: Sun Mar 9 21:57:58 2014 +0100 Committer: Lukasz Lenart Committed: Sun Mar 9 21:57:58 2014 +0100 -- .../dispatcher/ServletRedirectResult.java | 26 +--- 1 file changed, 22 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/struts/blob/1ca55b8a/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java -- diff --git a/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java b/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java index 038d8c3..9820295 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java @@ -37,9 +37,8 @@ import org.apache.struts2.views.util.UrlHelper; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; -import java.net.HttpURLConnection; +import java.net.MalformedURLException; import java.net.URI; -import java.net.URLConnection; import java.util.*; import static javax.servlet.http.HttpServletResponse.SC_FOUND; @@ -273,9 +272,28 @@ public class ServletRedirectResult extends StrutsResultSupport implements Reflec */ protected boolean isPathUrl(String url) { try { -return URI.create(url).getScheme() == null; +URI uri = URI.create(url); +if (uri.isAbsolute()) { +uri.toURL(); +if (LOG.isDebugEnabled()) { +LOG.debug("[#0] is full url, not a path", url); +} +return true; +} else { +if (LOG.isDebugEnabled()) { +LOG.debug("[#0] isn't absolute URI, assuming it's a path", url); +} +return false; +} } catch (IllegalArgumentException e) { -LOG.debug("[#0] isn't a valid URL", e, url); +if (LOG.isDebugEnabled()) { +LOG.debug("[#0] isn't a valid URL, assuming it's a path", e, url); +} +return false; +} catch (MalformedURLException e) { +if (LOG.isDebugEnabled()) { +LOG.debug("[#0] isn't a valid URL, assuming it's a path", e, url); +} return false; } }
[3/5] git commit: Reverts returned values to match logic and checks if protocol is not null
Reverts returned values to match logic and checks if protocol is not null Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/d59fb2b9 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/d59fb2b9 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/d59fb2b9 Branch: refs/heads/develop Commit: d59fb2b9ecd6e43a9029583f720002a072d965fb Parents: 1ca55b8 Author: Lukasz Lenart Authored: Wed Mar 19 08:50:56 2014 +0100 Committer: Lukasz Lenart Committed: Wed Mar 19 08:50:56 2014 +0100 -- .../apache/struts2/dispatcher/ServletRedirectResult.java | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/struts/blob/d59fb2b9/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java -- diff --git a/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java b/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java index 9820295..e4347b0 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java @@ -39,6 +39,7 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.net.MalformedURLException; import java.net.URI; +import java.net.URL; import java.util.*; import static javax.servlet.http.HttpServletResponse.SC_FOUND; @@ -274,27 +275,27 @@ public class ServletRedirectResult extends StrutsResultSupport implements Reflec try { URI uri = URI.create(url); if (uri.isAbsolute()) { -uri.toURL(); +URL validUrl = uri.toURL(); if (LOG.isDebugEnabled()) { LOG.debug("[#0] is full url, not a path", url); } -return true; +return validUrl.getProtocol() == null; } else { if (LOG.isDebugEnabled()) { LOG.debug("[#0] isn't absolute URI, assuming it's a path", url); } -return false; +return true; } } catch (IllegalArgumentException e) { if (LOG.isDebugEnabled()) { LOG.debug("[#0] isn't a valid URL, assuming it's a path", e, url); } -return false; +return true; } catch (MalformedURLException e) { if (LOG.isDebugEnabled()) { LOG.debug("[#0] isn't a valid URL, assuming it's a path", e, url); } -return false; +return true; } }
[5/5] git commit: WW-4187 finshes work: protocols are identified based on URL class
WW-4187 finshes work: protocols are identified based on URL class Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/ae12bd76 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/ae12bd76 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/ae12bd76 Branch: refs/heads/develop Commit: ae12bd76551baab3ab9e3df7655fe579e526c5d7 Parents: 561063a 3c1d25c Author: Lukasz Lenart Authored: Wed Mar 19 09:38:10 2014 +0100 Committer: Lukasz Lenart Committed: Wed Mar 19 09:38:10 2014 +0100 -- .../dispatcher/ServletRedirectResult.java | 42 1 file changed, 35 insertions(+), 7 deletions(-) --
[1/5] git commit: Uses URL class to check if location is path or full url
Repository: struts Updated Branches: refs/heads/develop 561063a42 -> ae12bd765 Uses URL class to check if location is path or full url Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/4b7d2e35 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/4b7d2e35 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/4b7d2e35 Branch: refs/heads/develop Commit: 4b7d2e35d09225a7c8b3b410588131b692b2730f Parents: bcd61a0 Author: Lukasz Lenart Authored: Sun Mar 9 21:46:33 2014 +0100 Committer: Lukasz Lenart Committed: Sun Mar 9 21:46:33 2014 +0100 -- .../dispatcher/ServletRedirectResult.java | 23 ++-- 1 file changed, 16 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/struts/blob/4b7d2e35/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java -- diff --git a/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java b/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java index abc69eb..038d8c3 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java @@ -37,6 +37,9 @@ import org.apache.struts2.views.util.UrlHelper; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URI; +import java.net.URLConnection; import java.util.*; import static javax.servlet.http.HttpServletResponse.SC_FOUND; @@ -262,13 +265,19 @@ public class ServletRedirectResult extends StrutsResultSupport implements Reflec } -private boolean isPathUrl(String url) { -// filter out "http:", "https:", "mailto:";, "file:", "ftp:" -return !url.startsWith("http:") -&& !url.startsWith("https:") -&& !url.startsWith("mailto:";) -&& !url.startsWith("file:") -&& !url.startsWith("ftp:"); +/** + * Checks if url is simple path or either full url + * + * @param url string + * @return true if it's just a path not a full url + */ +protected boolean isPathUrl(String url) { +try { +return URI.create(url).getScheme() == null; +} catch (IllegalArgumentException e) { +LOG.debug("[#0] isn't a valid URL", e, url); +return false; +} } /**
Git Push Summary
Repository: struts Updated Branches: refs/heads/feature/WW-4187-correctly-identify-protocols [deleted] 3c1d25c04
[05/16] git commit: Extends Hidden tests results to match new xhtml theme
Extends Hidden tests results to match new xhtml theme Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/43e86d76 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/43e86d76 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/43e86d76 Branch: refs/heads/feature/WW-4267-removes-defaults Commit: 43e86d76d5dc6bc7b6261e91eaddcee2cc009a6b Parents: cdf3c5c Author: Lukasz Lenart Authored: Thu Mar 13 20:19:59 2014 +0100 Committer: Lukasz Lenart Committed: Thu Mar 13 20:19:59 2014 +0100 -- .../resources/org/apache/struts2/views/jsp/ui/Hidden-1.txt | 8 +++- .../resources/org/apache/struts2/views/jsp/ui/Hidden-2.txt | 8 +++- 2 files changed, 14 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/struts/blob/43e86d76/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-1.txt -- diff --git a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-1.txt b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-1.txt index 4d6c927..fafc7ba 100644 --- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-1.txt +++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-1.txt @@ -1 +1,7 @@ - + + + + + + + http://git-wip-us.apache.org/repos/asf/struts/blob/43e86d76/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-2.txt -- diff --git a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-2.txt b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-2.txt index 2cc5ab6..df7e11b 100644 --- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-2.txt +++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-2.txt @@ -1 +1,7 @@ - + + + + + + +
[02/16] git commit: Extends logic how protocol part of url is extracted
Extends logic how protocol part of url is extracted Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/1ca55b8a Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/1ca55b8a Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/1ca55b8a Branch: refs/heads/feature/WW-4267-removes-defaults Commit: 1ca55b8a79cc118128391bddd3b776024def79f8 Parents: 4b7d2e3 Author: Lukasz Lenart Authored: Sun Mar 9 21:57:58 2014 +0100 Committer: Lukasz Lenart Committed: Sun Mar 9 21:57:58 2014 +0100 -- .../dispatcher/ServletRedirectResult.java | 26 +--- 1 file changed, 22 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/struts/blob/1ca55b8a/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java -- diff --git a/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java b/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java index 038d8c3..9820295 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java @@ -37,9 +37,8 @@ import org.apache.struts2.views.util.UrlHelper; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; -import java.net.HttpURLConnection; +import java.net.MalformedURLException; import java.net.URI; -import java.net.URLConnection; import java.util.*; import static javax.servlet.http.HttpServletResponse.SC_FOUND; @@ -273,9 +272,28 @@ public class ServletRedirectResult extends StrutsResultSupport implements Reflec */ protected boolean isPathUrl(String url) { try { -return URI.create(url).getScheme() == null; +URI uri = URI.create(url); +if (uri.isAbsolute()) { +uri.toURL(); +if (LOG.isDebugEnabled()) { +LOG.debug("[#0] is full url, not a path", url); +} +return true; +} else { +if (LOG.isDebugEnabled()) { +LOG.debug("[#0] isn't absolute URI, assuming it's a path", url); +} +return false; +} } catch (IllegalArgumentException e) { -LOG.debug("[#0] isn't a valid URL", e, url); +if (LOG.isDebugEnabled()) { +LOG.debug("[#0] isn't a valid URL, assuming it's a path", e, url); +} +return false; +} catch (MalformedURLException e) { +if (LOG.isDebugEnabled()) { +LOG.debug("[#0] isn't a valid URL, assuming it's a path", e, url); +} return false; } }
[13/16] git commit: WW-4187 finshes work: protocols are identified based on URL class
WW-4187 finshes work: protocols are identified based on URL class Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/ae12bd76 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/ae12bd76 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/ae12bd76 Branch: refs/heads/feature/WW-4267-removes-defaults Commit: ae12bd76551baab3ab9e3df7655fe579e526c5d7 Parents: 561063a 3c1d25c Author: Lukasz Lenart Authored: Wed Mar 19 09:38:10 2014 +0100 Committer: Lukasz Lenart Committed: Wed Mar 19 09:38:10 2014 +0100 -- .../dispatcher/ServletRedirectResult.java | 42 1 file changed, 35 insertions(+), 7 deletions(-) --
[11/16] git commit: Reverts returned values to match logic and checks if protocol is not null
Reverts returned values to match logic and checks if protocol is not null Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/d59fb2b9 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/d59fb2b9 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/d59fb2b9 Branch: refs/heads/feature/WW-4267-removes-defaults Commit: d59fb2b9ecd6e43a9029583f720002a072d965fb Parents: 1ca55b8 Author: Lukasz Lenart Authored: Wed Mar 19 08:50:56 2014 +0100 Committer: Lukasz Lenart Committed: Wed Mar 19 08:50:56 2014 +0100 -- .../apache/struts2/dispatcher/ServletRedirectResult.java | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/struts/blob/d59fb2b9/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java -- diff --git a/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java b/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java index 9820295..e4347b0 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java @@ -39,6 +39,7 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.net.MalformedURLException; import java.net.URI; +import java.net.URL; import java.util.*; import static javax.servlet.http.HttpServletResponse.SC_FOUND; @@ -274,27 +275,27 @@ public class ServletRedirectResult extends StrutsResultSupport implements Reflec try { URI uri = URI.create(url); if (uri.isAbsolute()) { -uri.toURL(); +URL validUrl = uri.toURL(); if (LOG.isDebugEnabled()) { LOG.debug("[#0] is full url, not a path", url); } -return true; +return validUrl.getProtocol() == null; } else { if (LOG.isDebugEnabled()) { LOG.debug("[#0] isn't absolute URI, assuming it's a path", url); } -return false; +return true; } } catch (IllegalArgumentException e) { if (LOG.isDebugEnabled()) { LOG.debug("[#0] isn't a valid URL, assuming it's a path", e, url); } -return false; +return true; } catch (MalformedURLException e) { if (LOG.isDebugEnabled()) { LOG.debug("[#0] isn't a valid URL, assuming it's a path", e, url); } -return false; +return true; } }
[01/16] git commit: Uses URL class to check if location is path or full url
Repository: struts Updated Branches: refs/heads/develop ae12bd765 -> 4fbfa3b8b refs/heads/feature/WW-4267-removes-defaults f2b52612b -> bd2a5ea8d Uses URL class to check if location is path or full url Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/4b7d2e35 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/4b7d2e35 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/4b7d2e35 Branch: refs/heads/feature/WW-4267-removes-defaults Commit: 4b7d2e35d09225a7c8b3b410588131b692b2730f Parents: bcd61a0 Author: Lukasz Lenart Authored: Sun Mar 9 21:46:33 2014 +0100 Committer: Lukasz Lenart Committed: Sun Mar 9 21:46:33 2014 +0100 -- .../dispatcher/ServletRedirectResult.java | 23 ++-- 1 file changed, 16 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/struts/blob/4b7d2e35/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java -- diff --git a/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java b/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java index abc69eb..038d8c3 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java @@ -37,6 +37,9 @@ import org.apache.struts2.views.util.UrlHelper; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URI; +import java.net.URLConnection; import java.util.*; import static javax.servlet.http.HttpServletResponse.SC_FOUND; @@ -262,13 +265,19 @@ public class ServletRedirectResult extends StrutsResultSupport implements Reflec } -private boolean isPathUrl(String url) { -// filter out "http:", "https:", "mailto:";, "file:", "ftp:" -return !url.startsWith("http:") -&& !url.startsWith("https:") -&& !url.startsWith("mailto:";) -&& !url.startsWith("file:") -&& !url.startsWith("ftp:"); +/** + * Checks if url is simple path or either full url + * + * @param url string + * @return true if it's just a path not a full url + */ +protected boolean isPathUrl(String url) { +try { +return URI.create(url).getScheme() == null; +} catch (IllegalArgumentException e) { +LOG.debug("[#0] isn't a valid URL", e, url); +return false; +} } /**
[07/16] git commit: WW-4297 finishes feature: improves hidden tag to properly support xhtml theme
WW-4297 finishes feature: improves hidden tag to properly support xhtml theme Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/d63deb97 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/d63deb97 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/d63deb97 Branch: refs/heads/feature/WW-4267-removes-defaults Commit: d63deb9750a3d409be30414faaf76f5481a4417d Parents: aa744b8 924531c Author: Lukasz Lenart Authored: Thu Mar 13 20:21:50 2014 +0100 Committer: Lukasz Lenart Committed: Thu Mar 13 20:21:50 2014 +0100 -- .../org/apache/struts2/components/Hidden.java | 7 ++ .../main/resources/template/xhtml/hidden.ftl| 25 .../apache/struts2/StrutsInternalTestCase.java | 9 --- .../struts2/views/jsp/AbstractTagTest.java | 4 +--- .../apache/struts2/views/jsp/ui/Hidden-1.txt| 8 ++- .../apache/struts2/views/jsp/ui/Hidden-2.txt| 8 ++- 6 files changed, 51 insertions(+), 10 deletions(-) --
[14/16] git commit: Merge branch 'develop' into feature/WW-4267-removes-defaults
Merge branch 'develop' into feature/WW-4267-removes-defaults Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/bd2a5ea8 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/bd2a5ea8 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/bd2a5ea8 Branch: refs/heads/develop Commit: bd2a5ea8d5f5dc6468f4883c0768066f4e721fe1 Parents: f2b5261 ae12bd7 Author: Lukasz Lenart Authored: Wed Mar 19 20:41:16 2014 +0100 Committer: Lukasz Lenart Committed: Wed Mar 19 20:41:16 2014 +0100 -- .../struts2/components/GenericUIBean.java | 5 +-- .../org/apache/struts2/components/Hidden.java | 7 .../org/apache/struts2/components/UIBean.java | 9 - .../dispatcher/ServletRedirectResult.java | 42 .../main/resources/template/xhtml/hidden.ftl| 27 + .../apache/struts2/StrutsInternalTestCase.java | 9 ++--- .../struts2/views/jsp/AbstractTagTest.java | 4 +- .../apache/struts2/views/jsp/ui/Hidden-1.txt| 6 ++- .../apache/struts2/views/jsp/ui/Hidden-2.txt| 6 ++- 9 files changed, 93 insertions(+), 22 deletions(-) --
[09/16] git commit: https://issues.apache.org/jira/browse/WW-4299 - do not assign value to id parameter if tryId value is null this prevents overwriting a parameter with a name of id used with the com
https://issues.apache.org/jira/browse/WW-4299 - do not assign value to id parameter if tryId value is null this prevents overwriting a parameter with a name of id used with the component tag Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/cb9f0f56 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/cb9f0f56 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/cb9f0f56 Branch: refs/heads/feature/WW-4267-removes-defaults Commit: cb9f0f5645d05b2f1c7c66640716acff61c4425f Parents: 3ceb3b9 Author: phillips1021 Authored: Tue Mar 18 09:46:36 2014 -0500 Committer: phillips1021 Committed: Tue Mar 18 09:46:36 2014 -0500 -- .../src/main/java/org/apache/struts2/components/UIBean.java | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/struts/blob/cb9f0f56/core/src/main/java/org/apache/struts2/components/UIBean.java -- diff --git a/core/src/main/java/org/apache/struts2/components/UIBean.java b/core/src/main/java/org/apache/struts2/components/UIBean.java index 9418a6e..51b7e79 100644 --- a/core/src/main/java/org/apache/struts2/components/UIBean.java +++ b/core/src/main/java/org/apache/struts2/components/UIBean.java @@ -1024,8 +1024,13 @@ public abstract class UIBean extends Component { } else { tryId = generatedId; } -addParameter("id", tryId); -addParameter("escapedId", escape(tryId)); + +//fix for https://issues.apache.org/jira/browse/WW-4299 +//do not assign value to id if tryId is null +if (tryId != null) { + addParameter("id", tryId); + addParameter("escapedId", escape(tryId)); +} } /**
[10/16] git commit: No JIRA - edit JavaDoc for class to make it clearer how to assign a value to a parameter when that value is a literal string
No JIRA - edit JavaDoc for class to make it clearer how to assign a value to a parameter when that value is a literal string Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/561063a4 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/561063a4 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/561063a4 Branch: refs/heads/feature/WW-4267-removes-defaults Commit: 561063a4227dd609ccba83880b2d0c6ec2d1e4aa Parents: cb9f0f5 Author: phillips1021 Authored: Tue Mar 18 09:48:18 2014 -0500 Committer: phillips1021 Committed: Tue Mar 18 09:48:18 2014 -0500 -- .../main/java/org/apache/struts2/components/GenericUIBean.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/struts/blob/561063a4/core/src/main/java/org/apache/struts2/components/GenericUIBean.java -- diff --git a/core/src/main/java/org/apache/struts2/components/GenericUIBean.java b/core/src/main/java/org/apache/struts2/components/GenericUIBean.java index 64dfabe..9521e1f 100644 --- a/core/src/main/java/org/apache/struts2/components/GenericUIBean.java +++ b/core/src/main/java/org/apache/struts2/components/GenericUIBean.java @@ -56,9 +56,8 @@ import com.opensymphony.xwork2.util.ValueStack; * engine will be found based on file extension. * * Remember: the value params will always be resolved against the ValueStack so if you mean to pass a - * string literal to your component, make sure to wrap it in quotes i.e. value="'value1'" otherwise, the the value - * stack will search for an Object on the stack with a method of getValue1(). (now that i've written this, i'm not - * entirely sure this is the case. i should verify this manana) + * string literal to your component, make sure to wrap it in single quotes i.e. value="'value1'" (note the opening "' and closing '" otherwise, the the value + * stack will search for an Object on the stack with a method of getValue1(). * * *
[06/16] git commit: Improves tests to reuse the same ServletContext
Improves tests to reuse the same ServletContext Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/924531c5 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/924531c5 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/924531c5 Branch: refs/heads/feature/WW-4267-removes-defaults Commit: 924531c54400882d1781ba3067d7af63825850c3 Parents: 43e86d7 Author: Lukasz Lenart Authored: Thu Mar 13 20:20:25 2014 +0100 Committer: Lukasz Lenart Committed: Thu Mar 13 20:20:25 2014 +0100 -- .../java/org/apache/struts2/StrutsInternalTestCase.java | 9 - .../java/org/apache/struts2/views/jsp/AbstractTagTest.java | 4 +--- 2 files changed, 5 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/struts/blob/924531c5/core/src/test/java/org/apache/struts2/StrutsInternalTestCase.java -- diff --git a/core/src/test/java/org/apache/struts2/StrutsInternalTestCase.java b/core/src/test/java/org/apache/struts2/StrutsInternalTestCase.java index 0b9d1c4..6816481 100644 --- a/core/src/test/java/org/apache/struts2/StrutsInternalTestCase.java +++ b/core/src/test/java/org/apache/struts2/StrutsInternalTestCase.java @@ -21,15 +21,12 @@ package org.apache.struts2; -import com.opensymphony.xwork2.ActionProxyFactory; import com.opensymphony.xwork2.XWorkTestCase; -import com.opensymphony.xwork2.config.ConfigurationProvider; -import com.opensymphony.xwork2.util.XWorkTestCaseHelper; import com.opensymphony.xwork2.util.logging.LoggerFactory; import com.opensymphony.xwork2.util.logging.jdk.JdkLoggerFactory; import org.apache.struts2.dispatcher.Dispatcher; import org.apache.struts2.util.StrutsTestCaseHelper; -import org.springframework.mock.web.MockServletContext; +import org.apache.struts2.views.jsp.StrutsMockServletContext; import java.text.SimpleDateFormat; import java.util.Date; @@ -75,6 +72,7 @@ public abstract class StrutsInternalTestCase extends XWorkTestCase { LoggerFactory.setLoggerFactory(new JdkLoggerFactory()); } +protected StrutsMockServletContext servletContext; protected Dispatcher dispatcher; /** @@ -87,7 +85,8 @@ public abstract class StrutsInternalTestCase extends XWorkTestCase { } protected Dispatcher initDispatcher(Map params) { -dispatcher = StrutsTestCaseHelper.initDispatcher(new MockServletContext(), params); +servletContext = new StrutsMockServletContext(); +dispatcher = StrutsTestCaseHelper.initDispatcher(servletContext, params); configurationManager = dispatcher.getConfigurationManager(); configuration = configurationManager.getConfiguration(); container = configuration.getContainer(); http://git-wip-us.apache.org/repos/asf/struts/blob/924531c5/core/src/test/java/org/apache/struts2/views/jsp/AbstractTagTest.java -- diff --git a/core/src/test/java/org/apache/struts2/views/jsp/AbstractTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/AbstractTagTest.java index 36b04fa..60eb170 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/AbstractTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/AbstractTagTest.java @@ -61,7 +61,6 @@ public abstract class AbstractTagTest extends StrutsInternalTestCase { protected StrutsMockHttpServletRequest request; protected StrutsMockPageContext pageContext; protected HttpServletResponse response; -protected StrutsMockServletContext servletContext; protected Mock mockContainer; @@ -83,7 +82,7 @@ public abstract class AbstractTagTest extends StrutsInternalTestCase { createMocks(); } -protected void createMocks() { +protected void createMocks() throws Exception { action = this.getAction(); stack = ActionContext.getContext().getValueStack(); context = stack.getContext(); @@ -99,7 +98,6 @@ public abstract class AbstractTagTest extends StrutsInternalTestCase { JspWriter jspWriter = new StrutsMockJspWriter(writer); -servletContext = new StrutsMockServletContext(); servletContext.setRealPath(new File("nosuchfile.properties").getAbsolutePath()); servletContext.setServletInfo("Resin");
[15/16] git commit: Merge branch 'develop' into feature/WW-4267-removes-defaults
Merge branch 'develop' into feature/WW-4267-removes-defaults Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/bd2a5ea8 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/bd2a5ea8 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/bd2a5ea8 Branch: refs/heads/feature/WW-4267-removes-defaults Commit: bd2a5ea8d5f5dc6468f4883c0768066f4e721fe1 Parents: f2b5261 ae12bd7 Author: Lukasz Lenart Authored: Wed Mar 19 20:41:16 2014 +0100 Committer: Lukasz Lenart Committed: Wed Mar 19 20:41:16 2014 +0100 -- .../struts2/components/GenericUIBean.java | 5 +-- .../org/apache/struts2/components/Hidden.java | 7 .../org/apache/struts2/components/UIBean.java | 9 - .../dispatcher/ServletRedirectResult.java | 42 .../main/resources/template/xhtml/hidden.ftl| 27 + .../apache/struts2/StrutsInternalTestCase.java | 9 ++--- .../struts2/views/jsp/AbstractTagTest.java | 4 +- .../apache/struts2/views/jsp/ui/Hidden-1.txt| 6 ++- .../apache/struts2/views/jsp/ui/Hidden-2.txt| 6 ++- 9 files changed, 93 insertions(+), 22 deletions(-) --
[04/16] git commit: Extends Hidden to support xhtml theme properly
Extends Hidden to support xhtml theme properly Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/cdf3c5cb Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/cdf3c5cb Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/cdf3c5cb Branch: refs/heads/feature/WW-4267-removes-defaults Commit: cdf3c5cbf120d984049bb6d292193d8620d52639 Parents: aa744b8 Author: Lukasz Lenart Authored: Thu Mar 13 20:17:01 2014 +0100 Committer: Lukasz Lenart Committed: Thu Mar 13 20:17:01 2014 +0100 -- .../org/apache/struts2/components/Hidden.java | 7 ++ .../main/resources/template/xhtml/hidden.ftl| 25 2 files changed, 32 insertions(+) -- http://git-wip-us.apache.org/repos/asf/struts/blob/cdf3c5cb/core/src/main/java/org/apache/struts2/components/Hidden.java -- diff --git a/core/src/main/java/org/apache/struts2/components/Hidden.java b/core/src/main/java/org/apache/struts2/components/Hidden.java index 62efc44..36b03d1 100644 --- a/core/src/main/java/org/apache/struts2/components/Hidden.java +++ b/core/src/main/java/org/apache/struts2/components/Hidden.java @@ -65,4 +65,11 @@ public class Hidden extends UIBean { protected String getDefaultTemplate() { return TEMPLATE; } + +@Override +public void evaluateParams() { +super.evaluateParams(); +label = null; +addParameter("label", null); +} } http://git-wip-us.apache.org/repos/asf/struts/blob/cdf3c5cb/core/src/main/resources/template/xhtml/hidden.ftl -- diff --git a/core/src/main/resources/template/xhtml/hidden.ftl b/core/src/main/resources/template/xhtml/hidden.ftl new file mode 100644 index 000..3ff0f05 --- /dev/null +++ b/core/src/main/resources/template/xhtml/hidden.ftl @@ -0,0 +1,25 @@ +<#-- +/* + * $Id$ + * + * 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. + */ +--> +<#include "/${parameters.templateDir}/${parameters.expandTheme}/controlheader.ftl" /> +<#include "/${parameters.templateDir}/simple/hidden.ftl" /> +<#include "/${parameters.templateDir}/${parameters.expandTheme}/controlfooter.ftl" />
[03/16] git commit: Comments out defaults which are already defined in Java classes
Comments out defaults which are already defined in Java classes Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/f2b52612 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/f2b52612 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/f2b52612 Branch: refs/heads/develop Commit: f2b52612b8d3cf3cd6a01cc8246769c5ec4fc789 Parents: aa744b8 Author: Lukasz Lenart Authored: Thu Mar 13 19:16:13 2014 +0100 Committer: Lukasz Lenart Committed: Thu Mar 13 19:16:13 2014 +0100 -- core/src/main/resources/org/apache/struts2/default.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/struts/blob/f2b52612/core/src/main/resources/org/apache/struts2/default.properties -- diff --git a/core/src/main/resources/org/apache/struts2/default.properties b/core/src/main/resources/org/apache/struts2/default.properties index ea3bc0c..5d49802 100644 --- a/core/src/main/resources/org/apache/struts2/default.properties +++ b/core/src/main/resources/org/apache/struts2/default.properties @@ -135,7 +135,7 @@ struts.devMode = false ### when set to true, resource bundles will be reloaded on _every_ request. ### this is good during development, but should never be used in production -struts.i18n.reload=false +### struts.i18n.reload=false ### Standard UI theme ### Change this to reflect which path should be used for JSP control tag templates by default @@ -148,7 +148,7 @@ struts.ui.templateSuffix=ftl ### Configuration reloading ### This will cause the configuration to reload struts.xml when it is changed -struts.configuration.xml.reload=false +### struts.configuration.xml.reload=false ### Location of velocity.properties file. defaults to velocity.properties struts.velocity.configfile = velocity.properties @@ -179,7 +179,7 @@ struts.dispatcher.parametersWorkaround = false ### Enables caching of FreeMarker templates ### Has the same effect as copying the templates under WEB_APP/templates -struts.freemarker.templatesCache=false +### struts.freemarker.templatesCache=false ### Enables caching of models on the BeanWrapper struts.freemarker.beanwrapperCache=false
[16/16] git commit: WW-4267 finishes merging changes to develop
WW-4267 finishes merging changes to develop Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/4fbfa3b8 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/4fbfa3b8 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/4fbfa3b8 Branch: refs/heads/develop Commit: 4fbfa3b8b2a71a36a55fec0a25dbc00939e3fdf9 Parents: ae12bd7 bd2a5ea Author: Lukasz Lenart Authored: Wed Mar 19 20:46:12 2014 +0100 Committer: Lukasz Lenart Committed: Wed Mar 19 20:46:12 2014 +0100 -- core/src/main/resources/org/apache/struts2/default.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --
[08/16] git commit: Uses simplest approach to inline s:hidden tag to xhtml theme
Uses simplest approach to inline s:hidden tag to xhtml theme Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/3ceb3b97 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/3ceb3b97 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/3ceb3b97 Branch: refs/heads/feature/WW-4267-removes-defaults Commit: 3ceb3b973ea53a5e0f8f2c3b772eb50daee6aec0 Parents: d63deb9 Author: Lukasz Lenart Authored: Thu Mar 13 21:49:54 2014 +0100 Committer: Lukasz Lenart Committed: Thu Mar 13 21:49:54 2014 +0100 -- core/src/main/resources/template/xhtml/hidden.ftl| 8 +--- .../resources/org/apache/struts2/views/jsp/ui/Hidden-1.txt | 6 ++ .../resources/org/apache/struts2/views/jsp/ui/Hidden-2.txt | 6 ++ 3 files changed, 9 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/struts/blob/3ceb3b97/core/src/main/resources/template/xhtml/hidden.ftl -- diff --git a/core/src/main/resources/template/xhtml/hidden.ftl b/core/src/main/resources/template/xhtml/hidden.ftl index 3ff0f05..92881ab 100644 --- a/core/src/main/resources/template/xhtml/hidden.ftl +++ b/core/src/main/resources/template/xhtml/hidden.ftl @@ -20,6 +20,8 @@ * under the License. */ --> -<#include "/${parameters.templateDir}/${parameters.expandTheme}/controlheader.ftl" /> -<#include "/${parameters.templateDir}/simple/hidden.ftl" /> -<#include "/${parameters.templateDir}/${parameters.expandTheme}/controlfooter.ftl" /> + + +<#include "/${parameters.templateDir}/simple/hidden.ftl" /> + + http://git-wip-us.apache.org/repos/asf/struts/blob/3ceb3b97/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-1.txt -- diff --git a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-1.txt b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-1.txt index fafc7ba..875ee46 100644 --- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-1.txt +++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-1.txt @@ -1,7 +1,5 @@ - - - - + + http://git-wip-us.apache.org/repos/asf/struts/blob/3ceb3b97/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-2.txt -- diff --git a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-2.txt b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-2.txt index df7e11b..a5376ff 100644 --- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-2.txt +++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Hidden-2.txt @@ -1,7 +1,5 @@ - - - - + +
[12/16] git commit: Merge branch 'develop' into feature/WW-4187-correctly-identify-protocols
Merge branch 'develop' into feature/WW-4187-correctly-identify-protocols Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/3c1d25c0 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/3c1d25c0 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/3c1d25c0 Branch: refs/heads/feature/WW-4267-removes-defaults Commit: 3c1d25c04f1d1a65fca15d1c2de062dd1ae54f34 Parents: d59fb2b 561063a Author: Lukasz Lenart Authored: Wed Mar 19 08:52:14 2014 +0100 Committer: Lukasz Lenart Committed: Wed Mar 19 08:52:14 2014 +0100 -- .../struts2/components/GenericUIBean.java | 5 +- .../org/apache/struts2/components/Hidden.java | 7 ++ .../org/apache/struts2/components/UIBean.java | 9 ++- .../template/xhtml/form-close-validate.ftl | 2 +- .../main/resources/template/xhtml/hidden.ftl| 27 +++ .../apache/struts2/StrutsInternalTestCase.java | 9 ++- .../struts2/views/jsp/AbstractTagTest.java | 4 +- .../apache/struts2/views/jsp/ui/Hidden-1.txt| 6 +- .../apache/struts2/views/jsp/ui/Hidden-2.txt| 6 +- .../com/opensymphony/xwork2/util/URLUtil.java | 1 + ...nnotationValidationConfigurationBuilder.java | 6 ++ .../validator/annotations/UrlValidator.java | 76 +++- .../validator/validators/URLValidator.java | 66 +++-- .../xwork2/validator/URLValidatorTest.java | 50 + 14 files changed, 170 insertions(+), 104 deletions(-) --
Git Push Summary
Repository: struts Updated Branches: refs/heads/feature/WW-4267-removes-defaults [deleted] bd2a5ea8d