[
https://issues.apache.org/jira/browse/WW-5100?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17242984#comment-17242984
]
Lukasz Lenart edited comment on WW-5100 at 12/3/20, 8:01 AM:
-------------------------------------------------------------
I finally tracked down the issue, it is related to detecting {{Locale}}. In
Struts 2.3.x these
[lines|https://github.com/apache/struts/blob/master/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java#L840-L842]
are not executed as `locale` is null, in Struts 2.5.x we fixed locale
detections and now we apply this properly. The case is that Encoding is
correlated with Locale in [Servlet
API|https://javaee.github.io/javaee-spec/javadocs/javax/servlet/ServletResponse.html#setLocale-java.util.Locale-].
My advice is to set
[struts.action.excludePattern|https://struts.apache.org/core-developers/web-xml.html#exclude-specific-urls]
to `.*\.js` to avoid Struts processing the JavaScript related requests as
those aren't Struts related requests. Then set Servlet Container to use proper
Encoding for *.js files using one of the
[options|https://stackoverflow.com/a/11343571/1805267]
was (Author: lukaszlenart):
I finally tracked the issue, it is related to detecting {{Locale}}. In Struts
2.3.x these
[lines|https://github.com/apache/struts/blob/master/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java#L840-L842]
are not executed as `locale` is null, in Struts 2.5.x we fixed locale
detections and now we apply this properly. The case is that Encoding is
correlated with Locale in [Servlet
API|https://javaee.github.io/javaee-spec/javadocs/javax/servlet/ServletResponse.html#setLocale-java.util.Locale-].
My advice is to set
[struts.action.excludePattern|https://struts.apache.org/core-developers/web-xml.html#exclude-specific-urls]
to `.*\.js` to avoid Struts processing the JavaScript related requests as
those aren't Struts related requests. Then set Servlet Container to use proper
Encoding for *.js files using one of the
[options|https://stackoverflow.com/a/11343571/1805267]
> incorrect content-type behavior after upgrading to struts 2.5.*
> ---------------------------------------------------------------
>
> Key: WW-5100
> URL: https://issues.apache.org/jira/browse/WW-5100
> Project: Struts 2
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.5.22
> Environment: Windows
> Reporter: xue
> Priority: Blocker
> Labels: features
> Fix For: 2.6
>
>
> 1. After upgrading from struts 2.3.* to struts 2.5.22, the content-type
> header of the response will changed to
> "application/script;charset=charset=ISO-8859-1" which was
> "application/script" in struts 2.3.4.
> Which caused our application failed, as it should be default as UTF-8.
> 2. When specifying the charset in Content-type with struts filer, the
> Content-Type is change to "application/script;charset=charset=UTF-8", but
> UTF-8 encoded file can still not be loaded correctly.
> It is blocker issue, which fails our application after upgrading.
> Please help to explain and provide solution, thanks,
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)