Java Note 3

Source: Internet
Author: User

Tomcat related

<!--servlet Hello--
<servlet>
<servlet-name>Hello</servlet-name>
<servlet-class>com.foobar.Hello</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Hello</servlet-name>
<url-pattern>/Hello.view</url-pattern>
</servlet-mapping>

<context docbase= "/foo/bar" reloadable= "true"/>


Get requests are limited in length, content appears on the address bar, unsafe, post requests do not, but cannot be bookmarked. Post can avoid caching, but it can also be avoided if get plus timestamps.

Whether the request is idempotent: whether the server state is changed, and whether the same operation returns the same result.

URL encoding,%2f, "/", use Urldecoder and urlencoder to manipulate URL encoding. The data of the browser post is encode by the browser, such as "Forest" and "%e6%9e%97" (Utf-8 encoding), if the container uses ISO-8895-1 encoding, then the data obtained by the servlet will be "%e6%9e%97" Foobar "(Will be decoded with iso-8895-1), the data will be chaotic at this time. For post, you can use setcharsetencoding to solve (but only for body), and for Get, use new String (Foobar.getbytes ("iso-8895-1"), "Utf-8") to solve, The encoding problem should use filter. Consider: If you post a URL with a query string.

Java Note 3

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.