This is an automated email from the ASF dual-hosted git repository.
jleroux pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git The following commit(s) were added to refs/heads/trunk by this push: new b936814 Fixed: SeoContextFilter.java is not able to handle query strings (OFBIZ-11278) new ee8e959 Merge branch 'trunk' of https://gitbox.apache.org/repos/asf/ofbiz-framework into trunk Git merge to be able to amend my last commit missing info in message b936814 is described below commit b936814c00c747a6b6d59f2ab9b0c465168c0b04 Author: Jacques Le Roux <[hidden email]> AuthorDate: Sat Nov 9 14:25:00 2019 +0100 Fixed: SeoContextFilter.java is not able to handle query strings (OFBIZ-11278) While working on OFBIZ-9804 (verification email for Newsletter) I was confronted with misc. issues. One of them was that SeoContextFilter.java was not handling query strings. This fixes it --- .../ofbiz/product/category/SeoContextFilter.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoContextFilter.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoContextFilter.java index 17ab0ae..b7cab04 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoContextFilter.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoContextFilter.java @@ -20,6 +20,7 @@ package org.apache.ofbiz.product.category; import java.io.IOException; import java.net.URL; +import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; @@ -41,6 +42,8 @@ import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.apache.http.client.utils.URLEncodedUtils; +import org.apache.http.message.BasicNameValuePair; import org.apache.ofbiz.base.util.Debug; import org.apache.ofbiz.base.util.StringUtil; import org.apache.ofbiz.base.util.UtilHttp; @@ -96,6 +99,19 @@ public class SeoContextFilter implements Filter { HttpServletResponse httpResponse = (HttpServletResponse) response; String uri = httpRequest.getRequestURI(); + + Map<String, String[]> parameterMap =request.getParameterMap(); + if (parameterMap != null) { + List<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>(); + request.getParameterMap().forEach((name, values) -> { + for(String value : values) { + params.add(new BasicNameValuePair(name, value)); + } + }); + String queryString = URLEncodedUtils.format(params, Charset.forName("UTF-8")); + uri = uri + "?" + queryString; + } + boolean forwarded = forwardUri(httpResponse, uri); if (forwarded) { return; @@ -218,7 +234,7 @@ public class SeoContextFilter implements Filter { * @param uri String to reverse transform * @return String */ - protected static boolean forwardUri(HttpServletResponse response, String uri) { + private static boolean forwardUri(HttpServletResponse response, String uri) { Perl5Matcher matcher = new Perl5Matcher(); boolean foundMatch = false; Integer responseCodeInt = null; |
Free forum by Nabble | Edit this page |