[
https://issues.apache.org/jira/browse/WW-3796?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13252284#comment-13252284
]
Pelladi Gabor commented on WW-3796:
-----------------------------------
Just for the record, I forgot to mention that different containers behave
differently. This issue did not come up on tomcat, but on glassfish it produced
this for every request:
PWC4011: Unable to set request character encoding to UTF-8 from context
/myproject, because request parameters have already been read, or
ServletRequest.getReader() has already been called
> Error at setting character encoding if the parameters have been already read
> ----------------------------------------------------------------------------
>
> Key: WW-3796
> URL: https://issues.apache.org/jira/browse/WW-3796
> Project: Struts 2
> Issue Type: Improvement
> Components: Dispatch Filter
> Affects Versions: 2.3.1.2
> Environment: Glassfish
> Reporter: Pelladi Gabor
> Assignee: Lukasz Lenart
> Priority: Trivial
> Labels: patch
> Fix For: 2.3.3
>
> Attachments: WW-3796.diff
>
>
> In my application I have an access log filter that logs all incoming requests
> and the parameters of the request.
> The struts2 filter calls request.setCharacterEncoding(encoding), which
> results in an error, because the request encoding cannot be set after the
> parameters have been read. This pollutes the log with errors for every
> request.
> I cannot put the access log filter after the struts2 filter, because it does
> not invoke chain.doFilter() for the actions.
> I have a custom filter before the access log filter that sets the request
> encoding in advance. Struts2 tries to set the encoding again later, but too
> late in my case.
> The proposed patch is very simple and straightforward, and would solve my
> problem with the polluted log. If the encoding is already set to the same
> value, do not try to set it again. It is useless and will cause an error. In
> all other cases, set it as now.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira