In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article is about the sample analysis of Web server and Http in Java. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Technical explanation of Web Server
Microsoft: ASP is the earliest popular in China.
Embed the script of VB in HTML, ASP+COM
In the opening of ASP, basically a page has thousands of lines of business code, and the page is extremely chaotic.
High maintenance cost
PHP:
PHP development is very fast, powerful, cross-platform, and the code is very simple.
Limitations: unable to carry large traffic
JSP/Servlet
Bounce S: browsers and servers
Cpact S: client and server
The Bamp S architecture promoted by sun Company
Based on java (all big companies, or some open source components, are written in java)
It can bear the influence of the three high problems.
Syntax such as ASP,ASP- > JSP strengthens the market
Web server
The server is a passive operation, which is used to process some light balls of the user and some response information of the user.
IIS
Microsoft; ASP... , included in Windows
Tomcat
Tomcat is a core project in the Jakarta project of Apache Software Foundation. The latest Servlet and JSP specifications can always be reflected in Tomcat. Because of its advanced technology, stable performance and free, Tomcat is deeply loved by java lovers and recognized by some software developers, and has become a popular Web application server.
Tomcat server is a free and open source Web application server, which is a lightweight application server. It is widely used in small and medium-sized systems and not many concurrent access users. It is the first choice for developing and debugging JSP programs. For a person with Java bleeding web, it is the best choice.
Tomcat actually runs JSP pages and Servlet. The latest version of Tomcat is 9.0
Content in JAVA jdk
Jdk
Bin- execution file
Include- includes many low-level posts written by C++.
Jre
There are many jar packages in lib.
The core jar package of java is rt.jar
Contents of the TomcatTomcat root directory
Script files that bin- starts and closes
Conf- profile
Jar package on which lib- depends
Logs- log
Webapps: published website
Configuration of Tomcat
This core configuration file can be configured with many parameters
Configure the port number for startup
The default port number for Tomcat is: 8080
Mysql:3306
Http:80
Https:443
Modify as follows
ConnectionTimeout= "20000" redirectPort= "8443" / >
The name of the host can be configured
The default host name is: localhost- > 127.0.0.1
The default location for website applications is: webapps
Modify as follows
Talk about how the website is visited.
1. Enter a domain name
two。 Check to see if there is a mapping for this domain name in this season's C:\ Windows\ System32\ drivers\ etc\ hosts configuration file
Yes: return the corresponding ip address directly. In this address, there are web programs that you need to access, which can be accessed directly.
127.0.0.1 www.lengding.com
No: go to the DNS server and return if you find it. If you can't find it, you can't access it.
Publish a website
Put the website written by yourself under the folder (webapps) of the web application specified in the server (Tomcat), and you can visit it.
The structure of the website
-- web directory of the webapps:Tocat server-- ROOT-lengding: directory name of the website-WEB-INF-classes:java program-jar package that the lib:web application depends on-web.xml: website configuration file-index. The default home page of html-static-css-style.css-js-imgHttp1, What is Http?
Http is a simple request-response protocol that usually runs on top of TCP.
Text: html, string, ~...
Hypertext: picture, music, video, location, map …
Port: 80
Https: secure
four hundred and forty three
2. Two times
Http1.0
HTTP/1.0: the client can connect to the web server and can only get one web resource after the connection.
Http2.0
HTTP/1.1: the client can connect to the web server and get multiple web resources after the connection.
3. Http request
Client-send request (Request)-server
Request URL: https://www.baidu.com/ request address Request Method:GET get method / post method Status Code:200 OK status code: 200Remote (remote) Address:14.215.177.39:443Accept:text/htmlAccept-Encoding:gzip, deflate, brAccept-Language:zh-CN,zh;q=0.9 language Cache-Control:max-age=0Connection:keep-alive
Request line
Request method in the request line: GET
Request method, Get,Post,HEAD,DELETE,PUT,TRACT...
Get: the request can carry fewer parameters and is limited in size, and the data content will be displayed in the browser's URL address bar. It is not safe, but efficient.
Post: there is no limit on the parameters that the request can carry, there is no limit on the size, and the data content will not be displayed in the URL address bar of the browser. It is safe, but not efficient (it can be ignored now).
Message header
Accept: tells the browser the data type it supports Accept-Encoding: which encoding format is supported GBK UTF-8 GB2312 ISO8859-1Accept-Language: tells the browser its locale Cache-Control: cache control Connection: tells the browser whether the request is disconnected or remains connected HOST: host. / .4, Http response
Server-response-client
Cache-Control:private cache controls Connection:Keep-Alive connection Content-Encoding:gzip encoding Content-Type:text/html type
Response body
Accept: tell the browser the data type it supports Accept-Encoding: which encoding format is supported GBK UTF-8 GB2312 ISO8859-1Accept-Language: tell the browser its locale Cache-Control: cache control Connection: tell the browser whether to disconnect or remain connected when the request is completed HOST: host. / .Refresh: tell the client how often to refresh; Location: relocate the web page
Response status code
200: the request response was successful
3xx: request redirection
Redirect: you go back to the new position I gave you
4xx: resource 404 not found
Resource does not exist
5xx: server code error
five hundred
502: gateway error
Thank you for reading! This is the end of this article on "sample Analysis of Web Server and Http in Java". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.