Has the content of useBodyEncodingForURI changed from Tomcat8?

** Notes on migrating from Tomcat 7 to Tomcat 8 **

Has the content of useBodyEncodingForURI changed from Tomcat8?

When Japanese was included in the query parameter of GET at the time of Tomcat7, the characters were garbled. The range of influence was too large to set server.xml to useBodyEncodingForURI = "true", so Previously, the problematic apps were individually fixed as shown below.

String param = new String(parameter.getBytes("ISO_8859_1"));

However, from Tomcat8, if the above support is provided, the characters will be garbled, and rather the support is no longer necessary.

Tomcat7: http://tomcat.apache.org/tomcat-7.0-doc/config/ajp.html Tomcat8: http://tomcat.apache.org/tomcat-8.0-doc/config/ajp.html

Comparing the documents, the explanation of ʻURIEncoding` is different.

Tomcat7

This specifies the character encoding used to decode the URI bytes, after %xx decoding the URL. If not specified, ISO-8859-1 will be used.

Specify the URI encoding of the request parameter at the time of GET. ** ISO-8859-1 ** is used if URIEncoding is not specified.

Tomcat8

This specifies the character encoding used to decode the URI bytes, after %xx decoding the URL. If not specified, UTF-8 will be used unless the org.apache.catalina.STRICT_SERVLET_COMPLIANCE system property is set to true in which case ISO-8859-1 will be used.

Specify the URI encoding of the request parameter at the time of GET. ** UTF-8 ** is used if URIEncoding is not specified. However, if the system property org.apache.catalina.STRICT_SERVLET_COMPLIANCE is set to true, ** ISO-8859-1 ** will be used.

The behavior when URIEncoding is not specified has changed.

Correspondence

I tried to set the system property ʻorg.apache.catalina.STRICT_SERVLET_COMPLIANCEtotrue, but ʻOrg.apache.catalina.STRICT_SERVLET_COMPLIANCE seems to be an option to eliminate the difference due to the version change of Tomcat. Since the range of influence is too wide, I decided to specify ʻISO-8859-1, which is the default of Tomcat7, for ʻURIEncoding.

conf/server.xml


<Connector port="8080" protocol="HTTP/1.1"
           redirectPort="8443"
           URIEncoding="ISO-8859-1" />

Recommended Posts

Has the content of useBodyEncodingForURI changed from Tomcat8?
[Rails 6] The save timing of active_strage images has been changed.
[Challenge CircleCI from 0] Learn the basics of CircleCI
The story of RxJava suffering from NoSuchElementException
Ruby from the perspective of other languages
Find the difference from a multiple of 10
The date time of java8 has been updated
ArrayList and the role of the interface seen from List
Format of the log output by Tomcat itself in Tomcat 8
From the introduction of devise to the creation of the users table
Prepare the execution environment of Tomcat in IntelliJ Community
Access the war file in the root directory of Tomcat
Volume 3 types of Docker Compose considered from the purpose
How to write Scala from the perspective of Java
About the usefulness of monads from an object-oriented perspective
The story of migrating from Paperclip to Active Storage
Java language from the perspective of Kotlin and C #
Extract a specific element from the list of objects
How to download the old version of Apache Tomcat
(Ruby on Rails6) Reflecting the posted content from the form
A record of studying the Spring Framework from scratch