Web server summary


Web server

1, JavaWeb overview

1.1 What is JavaWeb?

Using java language to write the general term for all browsers have access to the program. Called javaWeb.

1.2 JavaWeb programming is based on a request and response

(1) What is a request

  • The client sends data to the server. Called 请求.

(2) What is the response

  • Server data back to the client, called 响应.

(3), the relationship between requests and responses

  • Requests and responses are in pairs!
    Here Insert Picture Description

2, Web Server Overview

2.1 Server Introduction

Refers to the network environment for the client (Client) to provide a service dedicated computer, server installed network operating system (such as Windows 2000 Server, Linux, Unix, etc.) and a variety of server applications software (such as Web servers, e Mail service) computer

注:服务器的主要功能是提供网上信息浏览服务

Categories 2.2 Web resources

The so-called web resources on the Internet that is outside the Internet for access files or programs, and according to the principle and the effect they appear different, they will be divided into static resources and dynamic resource
(1) static resources
such as: html,css,JavaScript.
Static resource: the results obtained after all users access the same.
Static resources can be resolved directly browser.

After the static resource is requested, it may be returned directly to the browser. Browser parses these static resources through the built-in static resource parsing engine, demonstrating the interface.

(2) dynamic resource
such as: servlet/jsp,php/aspand the like.
Dynamic resource: the results for each user access to the same resources, the same may not be obtained.
After the dynamic resources need to be converted to a static resource, and then returned to the browser.

After being dynamic resource request is first converted to a static resource, and then returned to the browser, then the browser's built-parsing engine parse static resources, demonstrating interface.

2.3 commonly used Web server

Tomcat: for Web server provided by the Apache organization that provides support for the Servlet and jsp. It is a lightweight javaWeb container (server), is currently the most widely used JavaWeb server (free).
注:javaWeb容器 或 web容器,就理解为Tomcat服务器

Jboss: is a JavaEE specification compliance, open source, pure Java EJB server, it supports all the JavaEE specification (free).

GlassFish: the JavaWeb a server developed by Oracle, is a robust server business to achieve product-quality (rarely used).

Resin: is CAUCHO company's products, is a very popular server, servlet and JSP to provide good support, performance is relatively good, resin itself using JAVA language development (charges apply more).

WebLogic: Oracle's products, is currently the most widely used Web server that supports JavaEE specification, and continuous improvement in order to adapt to the new development requirements for large-scale projects (fees, use of small, suitable for large companies).

3, the software architecture

3.1 C / S architecture: client / server

C / S software architecture
Client / Server client and server software. PC side software is required to install
such as: QQ Thunder

  • Advantages: dazzle effect, part of the code written to the client (fast)
  • Cons: server-side updates, the client needs to be updated

3.2 B / S architecture: browser / server (belonging JavaEE-B / S)

B / S structure of the software
Browser / Server browser and server software. No need to install the PC side. Just to have a browser.
For example: Jingdong, Taobao station.

  • Advantages: server-side updates, the client browser does not need to be updated.
  • Disadvantages: not dazzle effect, all of the code running in the server, causing the server too much pressure.
  • Effect: using HTML5, CSS3 can make a flashy effect.
  • Server-side pressure: to build a cluster server. But also AJAX technology.

4, Tomcat server

4.1 Tomcat directory structure

Here Insert Picture Description

Deploy Tomcat 4.2

First, the project will be placed directly under the webapps directory
to simplify deployment: In some cases, the project is relatively large, longer copy time, can be packaged into a project form named after the .war suffix placed webapps, when you want to remove only you need to delete .war file project on it.

Disadvantages: copy, do not flexible.

Two, server.xml file in the conf modify
add tags within the last Host tag the file
path again after configuration access is: localhost: 8080 / virtual directory / resource name

docBase: path items stored.
path: Virtual Directory

Cons: In the server (tomcat entire core configuration file) configuration is not safe, when many projects are likely to ruin the core profile.

Three, \ Catalina \ localhost create an XML file (recommended) in the conf
write the following contents in the XML file created:

<Context  docBase="项目存放的路径"/>

At this point the virtual directory of the project is the name of the XML file. Access path is:

localhost:8080/XML文件名/资源名

This configuration also called hot deployment, very recommended.

Note:一般来说,作为一枚开发者,会第一种方式就可以了。而如果作为一枚运维,那么你一定要熟练掌握第三种热部署方式

Published 22 original articles · won praise 14 · views 1174

Guess you like

Origin blog.csdn.net/weixin_44157233/article/details/104019745