Getting Started with Java Web development

Source: Internet
Author: User
Tags tomcat server

One, Tomcat server common startup issues:
(1). Java_home environment variables, because some jar files in the Tomcat server's Bin directory must be used to the Java class Library, you must first configure the JAVA_HOME environment variable.
(2). Port occupancy Issues
(3). Catalina_home the environment variable, if the CATALINA_HOME environment variable is configured, the Tomcat server pointed to by Catalina_home is started by default.


II, TOMCAT directory structure:
(1). Bin: Holds script files that start and close Tomcat.
(2). conf: Stores various configuration files in the Tomcat server.
(3). Lib: The support jar package that holds the Tomcat server.
(4). Logs: A log file that holds tomcat.
(5). Temp: Holds temporary files generated by the Tomcat runtime.
(6). Webapps:web Application Storage directory.
(7). Work:tomcat working directory.


Iii. Web application and Virtual directory mapping:
(1). Virtual directory Mapping: After the Web application is developed, you need to give the Web application directory to the Web server Management (virtual directory), this process is called virtual directory mapping.
(2). Several ways to implement virtual directory mapping:
I. Configure a context in the Server.xml file to point to a Web application that requires a restart of the server.
II. Create a new XML file under $catalina_base$/conf/enginename/hostname/, the file name is the virtual directory of the Web application (root indicates that the app is the default app), Then just configure the path to the Web app in the file.
Iii. Tomcat automatically manages the web app under WebApps and maps it to a virtual directory.


IV. organizational structure of Web applications:


Five, configure the virtual host:
(1). To configure a virtual host, simply add a (2). If the configured virtual host is to be accessed by the outside world, it must be registered with the DNS server (domain name purchase) or the Hosts file in the Windows system.
(3). Configure the virtual host only in the Server.xml configuration file, configure <engine name= "Catalina" defaulthost = "/>


Vi. Web resource access process:
(1). I. After entering the net in the browser, start looking for the host corresponding IP address (Windows or DNS), find the appropriate IP, connect to the appropriate server.
II. The client sends an HTTP request to the host, the host resolves the host and application to be accessed from the request information, finds the appropriate resources, and then reads the resources to send an HTTP response to the client.
III. After the browser receives the response, it resolves and displays the HTTP response.
(2). Make the Web app into a war package, JAR-CVF **.war * *, the service chess will automatically unzip the war package.


Vii. Tomcat Architecture:


Viii. Configure the use of Tomcat Manager:
1. The user name and password can be configured in the Tomcat-users file under the Conf directory, and the user role must be configured as manager if you want to access the manager page.


Viii. Understanding the HTTP protocol:
1.telnet IP Port-->get Resource Path http/1.1 host: (not specified, several default hosts), you can request from the host to the corresponding page.
2. View via HTTP watch.


Nine, HTTP please and request the way detailed:
1.http requests include request lines, request headers and Entity data (there is a blank line between the message line and the data)


There are two types of 2.http requests: Get and post (form), the main difference between these two methods is the transfer of data.
: get-->/mail/1.html?name=abs&pwd=123 (method of URL parameter) .put--> transferred data


&NBSP;

Ten, HTTP request each header field detailed:
accept:text/html,image/*--> client supported file types
accept-charset:iso-8859-1--> Client encoding method
accept-encoding:gzip-- > Client supported compression format
accept-language:zh-cn--> client's locale
host:www.sina.com--> client to access the hostname
if-modified-since: --The client tells the server the cache time of the resource (the browser usually caches the page to speed up access, and if there is no update after the access time, the cache is accessed directly)
referer:--> client tells the server, which resource is accessed from, mainly used for anti-theft chain.
user-agent:--> Client Software Environment
COOKIE:
connection:close/keep-alive--> This request, continue to remain connected or close the connection
Date:-- > Client's request time


Getting Started with Java Web development

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.