Re: svn commit: r1760528 - /ofbiz/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control /ContextFilter.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1760528 - /ofbiz/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control /ContextFilter.java

Jacques Le Roux
Administrator
You have got a small issue

https://ci.apache.org/builders/ofbiz-trunk/builds/1415

https://ci.apache.org/projects/ofbiz/logs/trunk/html/

Jacques


Le 13/09/2016 à 12:55, [hidden email] a écrit :

> Author: jacopoc
> Date: Tue Sep 13 10:55:12 2016
> New Revision: 1760528
>
> URL: http://svn.apache.org/viewvc?rev=1760528&view=rev
> Log:
> Improved: set the character encoding to the system default (UTF-8) if and only
> if it is not set already by the client.
>
> Before this change the filter used to override the character encoding, even if
> it was specified in the http request.
> Also removed some unused imports and comments.
>
>
> Modified:
>      ofbiz/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ContextFilter.java
>
> Modified: ofbiz/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ContextFilter.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ContextFilter.java?rev=1760528&r1=1760527&r2=1760528&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ContextFilter.java (original)
> +++ ofbiz/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ContextFilter.java Tue Sep 13 10:55:12 2016
> @@ -21,16 +21,13 @@ package org.apache.ofbiz.webapp.control;
>   import static org.apache.ofbiz.base.util.UtilGenerics.checkMap;
>  
>   import java.io.IOException;
> -import java.io.UnsupportedEncodingException;
>   import java.util.Enumeration;
>   import java.util.List;
>   import java.util.Map;
> -import java.util.Set;
>  
>   import javax.servlet.Filter;
>   import javax.servlet.FilterChain;
>   import javax.servlet.FilterConfig;
> -import javax.servlet.ServletContext;
>   import javax.servlet.ServletException;
>   import javax.servlet.ServletRequest;
>   import javax.servlet.ServletResponse;
> @@ -50,12 +47,8 @@ import org.apache.ofbiz.entity.GenericVa
>   import org.apache.ofbiz.entity.util.EntityQuery;
>   import org.apache.ofbiz.entity.util.EntityUtil;
>   import org.apache.ofbiz.security.Security;
> -import org.apache.ofbiz.security.SecurityConfigurationException;
> -import org.apache.ofbiz.security.SecurityFactory;
>   import org.apache.ofbiz.service.LocalDispatcher;
> -import org.apache.ofbiz.service.ServiceContainer;
>   import org.apache.ofbiz.webapp.WebAppUtil;
> -import org.apache.ofbiz.webapp.event.RequestBodyMapHandlerFactory;
>   import org.apache.ofbiz.webapp.website.WebSiteWorker;
>  
>   /**
> @@ -69,6 +62,9 @@ public class ContextFilter implements Fi
>       protected FilterConfig config = null;
>       protected boolean debug = false;
>  
> +    // default charset used to decode requests body data if no encoding is specified in the request
> +    private String defaultCharacterEncoding;
> +
>       /**
>        * @see javax.servlet.Filter#init(javax.servlet.FilterConfig)
>        */
> @@ -84,6 +80,10 @@ public class ContextFilter implements Fi
>               debug = Debug.verboseOn();
>           }
>  
> +        defaultCharacterEncoding = config.getServletContext().getInitParameter("charset");
> +        if (UtilValidate.isEmpty(defaultCharacterEncoding)) {
> +            defaultCharacterEncoding = "UTF-8";
> +        }
>           // check the serverId
>           getServerId();
>           // initialize the delegator
> @@ -104,7 +104,6 @@ public class ContextFilter implements Fi
>           HttpServletRequest httpRequest = (HttpServletRequest) request;
>           HttpServletResponse httpResponse = (HttpServletResponse) response;
>  
> -        // Debug.logInfo("Running ContextFilter.doFilter", module);
>  
>           // ----- Servlet Object Setup -----
>  
> @@ -250,10 +249,13 @@ public class ContextFilter implements Fi
>               }
>           }
>  
> +        if (request.getCharacterEncoding() == null) {
> +            request.setCharacterEncoding(defaultCharacterEncoding);
> +        }
> +        WebAppUtil.setAttributesFromRequestBody(request);
> +
>           // check if multi tenant is enabled
>           boolean useMultitenant = EntityUtil.isMultiTenantEnabled();
> -        WebAppUtil.setCharacterEncoding(request);
> -        WebAppUtil.setAttributesFromRequestBody(request);
>           if (useMultitenant) {
>               // get tenant delegator by domain name
>               String serverName = httpRequest.getServerName();
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1760528 - /ofbiz/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control /ContextFilter.java

Jacopo Cappellato-5
Yeah, thanks for the notification, I also saw the automatic build failure
email.
Weird, local tests are successful and that service doesn't seem to be
related to my last commit... but I am looking into it.

Jacopo

On Tue, Sep 13, 2016 at 1:15 PM, Jacques Le Roux <
[hidden email]> wrote:

> You have got a small issue
>
> https://ci.apache.org/builders/ofbiz-trunk/builds/1415
>
> https://ci.apache.org/projects/ofbiz/logs/trunk/html/
>
> Jacques
>
>
>
> Le 13/09/2016 à 12:55, [hidden email] a écrit :
>
>> Author: jacopoc
>> Date: Tue Sep 13 10:55:12 2016
>> New Revision: 1760528
>>
>> URL: http://svn.apache.org/viewvc?rev=1760528&view=rev
>> Log:
>> Improved: set the character encoding to the system default (UTF-8) if and
>> only
>> if it is not set already by the client.
>>
>> Before this change the filter used to override the character encoding,
>> even if
>> it was specified in the http request.
>> Also removed some unused imports and comments.
>>
>>
>> Modified:
>>      ofbiz/trunk/framework/webapp/src/main/java/org/apache/ofbiz
>> /webapp/control/ContextFilter.java
>>
>> Modified: ofbiz/trunk/framework/webapp/src/main/java/org/apache/ofbiz/
>> webapp/control/ContextFilter.java
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/sr
>> c/main/java/org/apache/ofbiz/webapp/control/ContextFilter.
>> java?rev=1760528&r1=1760527&r2=1760528&view=diff
>> ============================================================
>> ==================
>> --- ofbiz/trunk/framework/webapp/src/main/java/org/apache/ofbiz/
>> webapp/control/ContextFilter.java (original)
>> +++ ofbiz/trunk/framework/webapp/src/main/java/org/apache/ofbiz/
>> webapp/control/ContextFilter.java Tue Sep 13 10:55:12 2016
>> @@ -21,16 +21,13 @@ package org.apache.ofbiz.webapp.control;
>>   import static org.apache.ofbiz.base.util.UtilGenerics.checkMap;
>>     import java.io.IOException;
>> -import java.io.UnsupportedEncodingException;
>>   import java.util.Enumeration;
>>   import java.util.List;
>>   import java.util.Map;
>> -import java.util.Set;
>>     import javax.servlet.Filter;
>>   import javax.servlet.FilterChain;
>>   import javax.servlet.FilterConfig;
>> -import javax.servlet.ServletContext;
>>   import javax.servlet.ServletException;
>>   import javax.servlet.ServletRequest;
>>   import javax.servlet.ServletResponse;
>> @@ -50,12 +47,8 @@ import org.apache.ofbiz.entity.GenericVa
>>   import org.apache.ofbiz.entity.util.EntityQuery;
>>   import org.apache.ofbiz.entity.util.EntityUtil;
>>   import org.apache.ofbiz.security.Security;
>> -import org.apache.ofbiz.security.SecurityConfigurationException;
>> -import org.apache.ofbiz.security.SecurityFactory;
>>   import org.apache.ofbiz.service.LocalDispatcher;
>> -import org.apache.ofbiz.service.ServiceContainer;
>>   import org.apache.ofbiz.webapp.WebAppUtil;
>> -import org.apache.ofbiz.webapp.event.RequestBodyMapHandlerFactory;
>>   import org.apache.ofbiz.webapp.website.WebSiteWorker;
>>     /**
>> @@ -69,6 +62,9 @@ public class ContextFilter implements Fi
>>       protected FilterConfig config = null;
>>       protected boolean debug = false;
>>   +    // default charset used to decode requests body data if no
>> encoding is specified in the request
>> +    private String defaultCharacterEncoding;
>> +
>>       /**
>>        * @see javax.servlet.Filter#init(javax.servlet.FilterConfig)
>>        */
>> @@ -84,6 +80,10 @@ public class ContextFilter implements Fi
>>               debug = Debug.verboseOn();
>>           }
>>   +        defaultCharacterEncoding = config.getServletContext().get
>> InitParameter("charset");
>> +        if (UtilValidate.isEmpty(defaultCharacterEncoding)) {
>> +            defaultCharacterEncoding = "UTF-8";
>> +        }
>>           // check the serverId
>>           getServerId();
>>           // initialize the delegator
>> @@ -104,7 +104,6 @@ public class ContextFilter implements Fi
>>           HttpServletRequest httpRequest = (HttpServletRequest) request;
>>           HttpServletResponse httpResponse = (HttpServletResponse)
>> response;
>>   -        // Debug.logInfo("Running ContextFilter.doFilter", module);
>>             // ----- Servlet Object Setup -----
>>   @@ -250,10 +249,13 @@ public class ContextFilter implements Fi
>>               }
>>           }
>>   +        if (request.getCharacterEncoding() == null) {
>> +            request.setCharacterEncoding(defaultCharacterEncoding);
>> +        }
>> +        WebAppUtil.setAttributesFromRequestBody(request);
>> +
>>           // check if multi tenant is enabled
>>           boolean useMultitenant = EntityUtil.isMultiTenantEnabled();
>> -        WebAppUtil.setCharacterEncoding(request);
>> -        WebAppUtil.setAttributesFromRequestBody(request);
>>           if (useMultitenant) {
>>               // get tenant delegator by domain name
>>               String serverName = httpRequest.getServerName();
>>
>>
>>
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1760528 - /ofbiz/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control /ContextFilter.java

Jacques Le Roux
Administrator
Works also locally here, I have forced a new build on BuildBot, could be a temporary error, happens rarely but happens.

Jacques


Le 13/09/2016 à 13:43, Jacopo Cappellato a écrit :

> Yeah, thanks for the notification, I also saw the automatic build failure
> email.
> Weird, local tests are successful and that service doesn't seem to be
> related to my last commit... but I am looking into it.
>
> Jacopo
>
> On Tue, Sep 13, 2016 at 1:15 PM, Jacques Le Roux <
> [hidden email]> wrote:
>
>> You have got a small issue
>>
>> https://ci.apache.org/builders/ofbiz-trunk/builds/1415
>>
>> https://ci.apache.org/projects/ofbiz/logs/trunk/html/
>>
>> Jacques
>>
>>
>>
>> Le 13/09/2016 à 12:55, [hidden email] a écrit :
>>
>>> Author: jacopoc
>>> Date: Tue Sep 13 10:55:12 2016
>>> New Revision: 1760528
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1760528&view=rev
>>> Log:
>>> Improved: set the character encoding to the system default (UTF-8) if and
>>> only
>>> if it is not set already by the client.
>>>
>>> Before this change the filter used to override the character encoding,
>>> even if
>>> it was specified in the http request.
>>> Also removed some unused imports and comments.
>>>
>>>
>>> Modified:
>>>       ofbiz/trunk/framework/webapp/src/main/java/org/apache/ofbiz
>>> /webapp/control/ContextFilter.java
>>>
>>> Modified: ofbiz/trunk/framework/webapp/src/main/java/org/apache/ofbiz/
>>> webapp/control/ContextFilter.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/sr
>>> c/main/java/org/apache/ofbiz/webapp/control/ContextFilter.
>>> java?rev=1760528&r1=1760527&r2=1760528&view=diff
>>> ============================================================
>>> ==================
>>> --- ofbiz/trunk/framework/webapp/src/main/java/org/apache/ofbiz/
>>> webapp/control/ContextFilter.java (original)
>>> +++ ofbiz/trunk/framework/webapp/src/main/java/org/apache/ofbiz/
>>> webapp/control/ContextFilter.java Tue Sep 13 10:55:12 2016
>>> @@ -21,16 +21,13 @@ package org.apache.ofbiz.webapp.control;
>>>    import static org.apache.ofbiz.base.util.UtilGenerics.checkMap;
>>>      import java.io.IOException;
>>> -import java.io.UnsupportedEncodingException;
>>>    import java.util.Enumeration;
>>>    import java.util.List;
>>>    import java.util.Map;
>>> -import java.util.Set;
>>>      import javax.servlet.Filter;
>>>    import javax.servlet.FilterChain;
>>>    import javax.servlet.FilterConfig;
>>> -import javax.servlet.ServletContext;
>>>    import javax.servlet.ServletException;
>>>    import javax.servlet.ServletRequest;
>>>    import javax.servlet.ServletResponse;
>>> @@ -50,12 +47,8 @@ import org.apache.ofbiz.entity.GenericVa
>>>    import org.apache.ofbiz.entity.util.EntityQuery;
>>>    import org.apache.ofbiz.entity.util.EntityUtil;
>>>    import org.apache.ofbiz.security.Security;
>>> -import org.apache.ofbiz.security.SecurityConfigurationException;
>>> -import org.apache.ofbiz.security.SecurityFactory;
>>>    import org.apache.ofbiz.service.LocalDispatcher;
>>> -import org.apache.ofbiz.service.ServiceContainer;
>>>    import org.apache.ofbiz.webapp.WebAppUtil;
>>> -import org.apache.ofbiz.webapp.event.RequestBodyMapHandlerFactory;
>>>    import org.apache.ofbiz.webapp.website.WebSiteWorker;
>>>      /**
>>> @@ -69,6 +62,9 @@ public class ContextFilter implements Fi
>>>        protected FilterConfig config = null;
>>>        protected boolean debug = false;
>>>    +    // default charset used to decode requests body data if no
>>> encoding is specified in the request
>>> +    private String defaultCharacterEncoding;
>>> +
>>>        /**
>>>         * @see javax.servlet.Filter#init(javax.servlet.FilterConfig)
>>>         */
>>> @@ -84,6 +80,10 @@ public class ContextFilter implements Fi
>>>                debug = Debug.verboseOn();
>>>            }
>>>    +        defaultCharacterEncoding = config.getServletContext().get
>>> InitParameter("charset");
>>> +        if (UtilValidate.isEmpty(defaultCharacterEncoding)) {
>>> +            defaultCharacterEncoding = "UTF-8";
>>> +        }
>>>            // check the serverId
>>>            getServerId();
>>>            // initialize the delegator
>>> @@ -104,7 +104,6 @@ public class ContextFilter implements Fi
>>>            HttpServletRequest httpRequest = (HttpServletRequest) request;
>>>            HttpServletResponse httpResponse = (HttpServletResponse)
>>> response;
>>>    -        // Debug.logInfo("Running ContextFilter.doFilter", module);
>>>              // ----- Servlet Object Setup -----
>>>    @@ -250,10 +249,13 @@ public class ContextFilter implements Fi
>>>                }
>>>            }
>>>    +        if (request.getCharacterEncoding() == null) {
>>> +            request.setCharacterEncoding(defaultCharacterEncoding);
>>> +        }
>>> +        WebAppUtil.setAttributesFromRequestBody(request);
>>> +
>>>            // check if multi tenant is enabled
>>>            boolean useMultitenant = EntityUtil.isMultiTenantEnabled();
>>> -        WebAppUtil.setCharacterEncoding(request);
>>> -        WebAppUtil.setAttributesFromRequestBody(request);
>>>            if (useMultitenant) {
>>>                // get tenant delegator by domain name
>>>                String serverName = httpRequest.getServerName();
>>>
>>>
>>>
>>>

Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1760528 - /ofbiz/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control /ContextFilter.java

Jacques Le Roux
Administrator
Tests passed, must have been a BuildBot quirk

https://ci.apache.org/builders/ofbiz-trunk/builds/1416

Jacques


Le 13/09/2016 à 14:48, Jacques Le Roux a écrit :

> Works also locally here, I have forced a new build on BuildBot, could be a temporary error, happens rarely but happens.
>
> Jacques
>
>
> Le 13/09/2016 à 13:43, Jacopo Cappellato a écrit :
>> Yeah, thanks for the notification, I also saw the automatic build failure
>> email.
>> Weird, local tests are successful and that service doesn't seem to be
>> related to my last commit... but I am looking into it.
>>
>> Jacopo
>>
>> On Tue, Sep 13, 2016 at 1:15 PM, Jacques Le Roux <
>> [hidden email]> wrote:
>>
>>> You have got a small issue
>>>
>>> https://ci.apache.org/builders/ofbiz-trunk/builds/1415
>>>
>>> https://ci.apache.org/projects/ofbiz/logs/trunk/html/
>>>
>>> Jacques
>>>
>>>
>>>
>>> Le 13/09/2016 à 12:55, [hidden email] a écrit :
>>>
>>>> Author: jacopoc
>>>> Date: Tue Sep 13 10:55:12 2016
>>>> New Revision: 1760528
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=1760528&view=rev
>>>> Log:
>>>> Improved: set the character encoding to the system default (UTF-8) if and
>>>> only
>>>> if it is not set already by the client.
>>>>
>>>> Before this change the filter used to override the character encoding,
>>>> even if
>>>> it was specified in the http request.
>>>> Also removed some unused imports and comments.
>>>>
>>>>
>>>> Modified:
>>>> ofbiz/trunk/framework/webapp/src/main/java/org/apache/ofbiz
>>>> /webapp/control/ContextFilter.java
>>>>
>>>> Modified: ofbiz/trunk/framework/webapp/src/main/java/org/apache/ofbiz/
>>>> webapp/control/ContextFilter.java
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/sr
>>>> c/main/java/org/apache/ofbiz/webapp/control/ContextFilter.
>>>> java?rev=1760528&r1=1760527&r2=1760528&view=diff
>>>> ============================================================
>>>> ==================
>>>> --- ofbiz/trunk/framework/webapp/src/main/java/org/apache/ofbiz/
>>>> webapp/control/ContextFilter.java (original)
>>>> +++ ofbiz/trunk/framework/webapp/src/main/java/org/apache/ofbiz/
>>>> webapp/control/ContextFilter.java Tue Sep 13 10:55:12 2016
>>>> @@ -21,16 +21,13 @@ package org.apache.ofbiz.webapp.control;
>>>>    import static org.apache.ofbiz.base.util.UtilGenerics.checkMap;
>>>>      import java.io.IOException;
>>>> -import java.io.UnsupportedEncodingException;
>>>>    import java.util.Enumeration;
>>>>    import java.util.List;
>>>>    import java.util.Map;
>>>> -import java.util.Set;
>>>>      import javax.servlet.Filter;
>>>>    import javax.servlet.FilterChain;
>>>>    import javax.servlet.FilterConfig;
>>>> -import javax.servlet.ServletContext;
>>>>    import javax.servlet.ServletException;
>>>>    import javax.servlet.ServletRequest;
>>>>    import javax.servlet.ServletResponse;
>>>> @@ -50,12 +47,8 @@ import org.apache.ofbiz.entity.GenericVa
>>>>    import org.apache.ofbiz.entity.util.EntityQuery;
>>>>    import org.apache.ofbiz.entity.util.EntityUtil;
>>>>    import org.apache.ofbiz.security.Security;
>>>> -import org.apache.ofbiz.security.SecurityConfigurationException;
>>>> -import org.apache.ofbiz.security.SecurityFactory;
>>>>    import org.apache.ofbiz.service.LocalDispatcher;
>>>> -import org.apache.ofbiz.service.ServiceContainer;
>>>>    import org.apache.ofbiz.webapp.WebAppUtil;
>>>> -import org.apache.ofbiz.webapp.event.RequestBodyMapHandlerFactory;
>>>>    import org.apache.ofbiz.webapp.website.WebSiteWorker;
>>>>      /**
>>>> @@ -69,6 +62,9 @@ public class ContextFilter implements Fi
>>>>        protected FilterConfig config = null;
>>>>        protected boolean debug = false;
>>>>    +    // default charset used to decode requests body data if no
>>>> encoding is specified in the request
>>>> +    private String defaultCharacterEncoding;
>>>> +
>>>>        /**
>>>>         * @see javax.servlet.Filter#init(javax.servlet.FilterConfig)
>>>>         */
>>>> @@ -84,6 +80,10 @@ public class ContextFilter implements Fi
>>>>                debug = Debug.verboseOn();
>>>>            }
>>>>    +        defaultCharacterEncoding = config.getServletContext().get
>>>> InitParameter("charset");
>>>> +        if (UtilValidate.isEmpty(defaultCharacterEncoding)) {
>>>> +            defaultCharacterEncoding = "UTF-8";
>>>> +        }
>>>>            // check the serverId
>>>>            getServerId();
>>>>            // initialize the delegator
>>>> @@ -104,7 +104,6 @@ public class ContextFilter implements Fi
>>>>            HttpServletRequest httpRequest = (HttpServletRequest) request;
>>>>            HttpServletResponse httpResponse = (HttpServletResponse)
>>>> response;
>>>>    -        // Debug.logInfo("Running ContextFilter.doFilter", module);
>>>>              // ----- Servlet Object Setup -----
>>>>    @@ -250,10 +249,13 @@ public class ContextFilter implements Fi
>>>>                }
>>>>            }
>>>>    +        if (request.getCharacterEncoding() == null) {
>>>> + request.setCharacterEncoding(defaultCharacterEncoding);
>>>> +        }
>>>> +        WebAppUtil.setAttributesFromRequestBody(request);
>>>> +
>>>>            // check if multi tenant is enabled
>>>>            boolean useMultitenant = EntityUtil.isMultiTenantEnabled();
>>>> -        WebAppUtil.setCharacterEncoding(request);
>>>> -        WebAppUtil.setAttributesFromRequestBody(request);
>>>>            if (useMultitenant) {
>>>>                // get tenant delegator by domain name
>>>>                String serverName = httpRequest.getServerName();
>>>>
>>>>
>>>>
>>>>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1760528 - /ofbiz/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control /ContextFilter.java

Jacopo Cappellato-5
cool, thanks

Jacopo

On Tue, Sep 13, 2016 at 2:56 PM, Jacques Le Roux <
[hidden email]> wrote:

> Tests passed, must have been a BuildBot quirk
>
> https://ci.apache.org/builders/ofbiz-trunk/builds/1416
>
> Jacques
>
>
>
> Le 13/09/2016 à 14:48, Jacques Le Roux a écrit :
>
>> Works also locally here, I have forced a new build on BuildBot, could be
>> a temporary error, happens rarely but happens.
>>
>> Jacques
>>
>>
>> Le 13/09/2016 à 13:43, Jacopo Cappellato a écrit :
>>
>>> Yeah, thanks for the notification, I also saw the automatic build failure
>>> email.
>>> Weird, local tests are successful and that service doesn't seem to be
>>> related to my last commit... but I am looking into it.
>>>
>>> Jacopo
>>>
>>> On Tue, Sep 13, 2016 at 1:15 PM, Jacques Le Roux <
>>> [hidden email]> wrote:
>>>
>>> You have got a small issue
>>>>
>>>> https://ci.apache.org/builders/ofbiz-trunk/builds/1415
>>>>
>>>> https://ci.apache.org/projects/ofbiz/logs/trunk/html/
>>>>
>>>> Jacques
>>>>
>>>>
>>>>
>>>> Le 13/09/2016 à 12:55, [hidden email] a écrit :
>>>>
>>>> Author: jacopoc
>>>>> Date: Tue Sep 13 10:55:12 2016
>>>>> New Revision: 1760528
>>>>>
>>>>> URL: http://svn.apache.org/viewvc?rev=1760528&view=rev
>>>>> Log:
>>>>> Improved: set the character encoding to the system default (UTF-8) if
>>>>> and
>>>>> only
>>>>> if it is not set already by the client.
>>>>>
>>>>> Before this change the filter used to override the character encoding,
>>>>> even if
>>>>> it was specified in the http request.
>>>>> Also removed some unused imports and comments.
>>>>>
>>>>>
>>>>> Modified:
>>>>> ofbiz/trunk/framework/webapp/src/main/java/org/apache/ofbiz
>>>>> /webapp/control/ContextFilter.java
>>>>>
>>>>> Modified: ofbiz/trunk/framework/webapp/src/main/java/org/apache/ofbiz/
>>>>> webapp/control/ContextFilter.java
>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/sr
>>>>> c/main/java/org/apache/ofbiz/webapp/control/ContextFilter.
>>>>> java?rev=1760528&r1=1760527&r2=1760528&view=diff
>>>>> ============================================================
>>>>> ==================
>>>>> --- ofbiz/trunk/framework/webapp/src/main/java/org/apache/ofbiz/
>>>>> webapp/control/ContextFilter.java (original)
>>>>> +++ ofbiz/trunk/framework/webapp/src/main/java/org/apache/ofbiz/
>>>>> webapp/control/ContextFilter.java Tue Sep 13 10:55:12 2016
>>>>> @@ -21,16 +21,13 @@ package org.apache.ofbiz.webapp.control;
>>>>>    import static org.apache.ofbiz.base.util.UtilGenerics.checkMap;
>>>>>      import java.io.IOException;
>>>>> -import java.io.UnsupportedEncodingException;
>>>>>    import java.util.Enumeration;
>>>>>    import java.util.List;
>>>>>    import java.util.Map;
>>>>> -import java.util.Set;
>>>>>      import javax.servlet.Filter;
>>>>>    import javax.servlet.FilterChain;
>>>>>    import javax.servlet.FilterConfig;
>>>>> -import javax.servlet.ServletContext;
>>>>>    import javax.servlet.ServletException;
>>>>>    import javax.servlet.ServletRequest;
>>>>>    import javax.servlet.ServletResponse;
>>>>> @@ -50,12 +47,8 @@ import org.apache.ofbiz.entity.GenericVa
>>>>>    import org.apache.ofbiz.entity.util.EntityQuery;
>>>>>    import org.apache.ofbiz.entity.util.EntityUtil;
>>>>>    import org.apache.ofbiz.security.Security;
>>>>> -import org.apache.ofbiz.security.SecurityConfigurationException;
>>>>> -import org.apache.ofbiz.security.SecurityFactory;
>>>>>    import org.apache.ofbiz.service.LocalDispatcher;
>>>>> -import org.apache.ofbiz.service.ServiceContainer;
>>>>>    import org.apache.ofbiz.webapp.WebAppUtil;
>>>>> -import org.apache.ofbiz.webapp.event.RequestBodyMapHandlerFactory;
>>>>>    import org.apache.ofbiz.webapp.website.WebSiteWorker;
>>>>>      /**
>>>>> @@ -69,6 +62,9 @@ public class ContextFilter implements Fi
>>>>>        protected FilterConfig config = null;
>>>>>        protected boolean debug = false;
>>>>>    +    // default charset used to decode requests body data if no
>>>>> encoding is specified in the request
>>>>> +    private String defaultCharacterEncoding;
>>>>> +
>>>>>        /**
>>>>>         * @see javax.servlet.Filter#init(javax.servlet.FilterConfig)
>>>>>         */
>>>>> @@ -84,6 +80,10 @@ public class ContextFilter implements Fi
>>>>>                debug = Debug.verboseOn();
>>>>>            }
>>>>>    +        defaultCharacterEncoding = config.getServletContext().get
>>>>> InitParameter("charset");
>>>>> +        if (UtilValidate.isEmpty(defaultCharacterEncoding)) {
>>>>> +            defaultCharacterEncoding = "UTF-8";
>>>>> +        }
>>>>>            // check the serverId
>>>>>            getServerId();
>>>>>            // initialize the delegator
>>>>> @@ -104,7 +104,6 @@ public class ContextFilter implements Fi
>>>>>            HttpServletRequest httpRequest = (HttpServletRequest)
>>>>> request;
>>>>>            HttpServletResponse httpResponse = (HttpServletResponse)
>>>>> response;
>>>>>    -        // Debug.logInfo("Running ContextFilter.doFilter", module);
>>>>>              // ----- Servlet Object Setup -----
>>>>>    @@ -250,10 +249,13 @@ public class ContextFilter implements Fi
>>>>>                }
>>>>>            }
>>>>>    +        if (request.getCharacterEncoding() == null) {
>>>>> + request.setCharacterEncoding(defaultCharacterEncoding);
>>>>> +        }
>>>>> +        WebAppUtil.setAttributesFromRequestBody(request);
>>>>> +
>>>>>            // check if multi tenant is enabled
>>>>>            boolean useMultitenant = EntityUtil.isMultiTenantEnabled();
>>>>> -        WebAppUtil.setCharacterEncoding(request);
>>>>> -        WebAppUtil.setAttributesFromRequestBody(request);
>>>>>            if (useMultitenant) {
>>>>>                // get tenant delegator by domain name
>>>>>                String serverName = httpRequest.getServerName();
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>
>>
>