Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0004788Openbravo ERPA. Platformpublic2008-09-01 18:452022-02-01 08:09
gorka_gil 
Triage Platform Base 
lowminorN/A
newopen 
5
pi 
 
Core
No
0004788: In tomcat filters change HttpServletRequest to HttpServletRequestWrapper
There is three filters for request:
  - CharsetFilter.java
  - CacheFilter.java
  - SessionExpirationFilter.java


Now this filters edit directly the request/response objects.
The recommended implementation is use a wrapper:
http://java.sun.com/products/servlet/Filters.html [^]


I try to implement it in the way:

  public void doFilter(ServletRequest request, ServletResponse response, FilterChain next) throws IOException, ServletException {
    HttpServletRequestWrapper reqWrapper = new HttpServletRequestWrapper((HttpServletRequest) request);
    next.doFilter(reqWrapper, response);
    reqWrapper.setCharacterEncoding(encoding);
  }

But the problem is that the setCharacterEncoding must be done before receive the request, because after has no effect.


The actual and working solution is:

  public void doFilter(ServletRequest request, ServletResponse response, FilterChain next) throws IOException, ServletException {
    request.setCharacterEncoding(encoding);
    next.doFilter(request, response);
  }

and in the Web.xml set the CharsetFilter the first filter.

Thanks to Ville for his collaboration.
   
   Now (trunk 6707), works fine,

but for test if a new implementation works:

1. Go to any window, for example, Sales order
2. In some field, for example, description
3. Introduce no standard characters, for example "€@#$%&"
4. Save
ToBeReviewed
related to defect 0004774 closed gorka_gil Session filter breaks charset filter 
Issue History
2008-09-01 18:45gorka_gilNew Issue
2008-09-01 18:45gorka_gilAssigned To => cromero
2008-09-01 18:45gorka_gilsf_bug_id0 => 2087168
2008-09-01 18:45gorka_gilRegression testing => No
2008-09-01 18:47gorka_gilRelationship addedrelated to 0004774
2008-09-01 18:55gorka_gilDescription Updated
2008-09-01 18:56gorka_gilDescription Updated
2008-09-01 18:57gorka_gilDescription Updated
2008-11-10 13:10cromeroAssigned Tocromero => pjuvara
2008-11-16 19:54pjuvaraTag Attached: ToBeReviewed
2009-05-22 19:34pjuvaraAssigned Topjuvara => iciordia
2017-03-10 17:06gorka_gilAssigned Toiciordia => platform
2017-03-10 17:06gorka_gilNote Added: 0094946
2022-02-01 08:09alostaleAssigned Toplatform => Triage Platform Base

Notes
(0094946)
gorka_gil   
2017-03-10 17:06   
@platform team: please check if that request is useful and still valid