Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

On the problem of codec requested on Tomcat

2025-03-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Recently, after reading the inside story of in-depth Analysis of Java Web Technology (author: Xu Lingbo), there is a lack of a small point about the coding and decoding of Web requests on Tomcat, which may affect the understanding of some readers. I specially checked it, and it is summarized as follows:

1. The requested PathInfo part is decoded with the encoding specified by the URIEncoding attribute of the Connector element of the Tomcat.

For specific use, please refer to https://tomcat.apache.org/tomcat-8.5-doc/config/http.html.

two。 Second, let's first talk about the parsing of the request body (POST body). Tomcat will get the character code in the next order:

1) the user specifies through a similar code:

2) the encoding specified in the request header of the request message content-type.

3) apply the unified coding configured by web.xml (this is currently in the Servlet4.0 specification)

4) system default ISO8859-1

3. The other is the parsing of the QueryString part. By default, Tomcat uses the same URIEncoding as 1) to parse QueryString. But at the same time Tomcat provides another parameter, useBodyEncodingForURI. Literal meaning uses newspaper style coding to parse QueryString. If the parameter is true. Then Tomcat uses the same encoding as 2) to parse QueryString.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report