第1章--Web应用开发概述

Web应用开发概述

浏览器-服务器架构(BS-architecture)

browser/ App    ---- request ---->    server (database)

<- response/data --

protocol: HTTP(Hyper-Text Transfer Protocol)

have a try:

cmd: sudo nc -l 80  -- listen at the port of 80(port 80 is used by HTTP)

browser: type "localhost" in the address bar

these are the info that sent to the server(localhost)

meanwhile, the browser is waiting for the request (from the server)

try to type "hello" and ctrl+c

"hello" will be displayed in the browser

If we enter the address of a website, such as "http://study.163.com"

it is called URL (uniform resource locator) (统一资源定位)

In this case: "http://study.163.com/smartSpec/intro.html?name=163"

http: protocol, such as ftp, mailto

smartSpec/intro.html: request sent to the server

?name=163: data that sent to the server via GET method

Let's see what info can be sent via GET method

[html] view plain copy

    1. <html> <body>
    2. <form action="http://localhost/form_action.html" method="get">
    3. <p>First Name: <input type="text" name="fname" /></p>
    4. <p>Last Name: <input type="text" name="lname" /></p>
    5. <input type="submit" value="Submit" />
    6. </form> </body> </html>

1. open .html in the browser

2. type sudo nc -l 80 in terminal

3. submit the info

4. result

GET /form_action.html?fname=Lin&lname=Matt

What if we use POST as the method?

same steps as GET

but different result:

POST /form_action.html (no extra data shown explicitly after "/form_action.html")

but "fname=Lin&lname=Matt" will be displayed at the end.

furthermore, new property "content-length" added, which means the number of characters (data) sent to the server, which is fname=Lin&lname=Matt in this case)

After those info/data/request(shown above) has been sent to the server,

the server needs to give the feedback(response) back to the client/ browser.

feedback:

1. 静态页面(such as .html file, .img file)

2. 动态数据  (data retrieved by programs running on the server side based on the input (like first name/ last name in the previous example))

HTTP protocol: connectionless 无连接的

After a series of actions has done (request --> response),the connection gets broken.

Advantages --> disconnect with those users who are not currently communicating with the server at that time, in other words, accessible to as many users as possible at the same time

Disadvantages: the server does not know who u r after one connection.

for example, after we log in, we expect that we do not need to log in again if we try to visit other relevant webpages.

--> solution: cookie

after the first-time connection, the client got a "number" from the server which identifies the client/ browser itself.

then the browser will store that number, and every time the client connects to the server, it will bring that number with it, and the server will know the client by checking that id number

that number in this example is called cookie.

Also, the cookie got its own expiry date, which is set by the server.

HTTP会话 (session) :connection, request, response, close.

HTTP protocol: how to deal with the data in the database

background: when the client sends a request to the server, the program in the server always try to retrieve the relevant data from its database system, and then the program is going to generate an HTML file (or other file that can be understood by the browser), and sends back to the client as a response.

problem 1: the limitation of the number of connections between the database and the web server is much smaller than that between the client and the web server.

in other words, minimising the number of the connections btw database and the web server is required.

--> solution1: connection pool

creates a connection pool between the web server and the database which has limited connections.

each time the web server requires a connection to the database, it will ask the connection pool for the access of connection

--> solution2: cache

different clients might search for the same data during a short period of time

there is no need to run the program to retrieve the same data from the database repeatedly.

-- lower the workload of the database and speed up the reaction from the server

Java开发工程师(Web方向) - 01.Java Web开发入门 - 第1章.Web应用开发概述的更多相关文章

  1. Java开发工程师(Web方向) - 01.Java Web开发入门 - 第3章.Tomcat

    第3章--Tomcat Tomcat安装与运行 Tomcat:目前最常用的基于java的web应用服务器 本课程中所有的Java代码最终都需要部署到Tomcat中运行 Tomcat的配置文件是XML的 ...

  2. Java开发工程师(Web方向) - 01.Java Web开发入门 - 第6章.蜂巢

    第6章--蜂巢 蜂巢简介 网站开发完,就需要测试.部署.在服务器上运行. 网易蜂巢: 采用Docker容器化技术的云计算平台 https://c.163.com 容器管理:容器可被视作为云主机的服务器 ...

  3. Java开发工程师(Web方向) - 01.Java Web开发入门 - 第4章.Maven

    第4章--Maven Maven实战 Java Web应用的部署: 手动式: 编译:javac -cp $CATALINA_HOME/lib/servlet-api.jar web-inf/class ...

  4. Java开发工程师(Web方向) - 01.Java Web开发入门 - 第5章.Git

    第5章--Git 版本控制简介 VCS (version control system) 版本控制系统:记录若干文件的修订记录的系统,帮助查阅/回到某个历史版本 LVCS本地 CVCS集中式(Cent ...

  5. Java开发工程师(Web方向) - 01.Java Web开发入门 - 第2章.HTTP协议简介

    第2章--HTTP协议简介 HTTP协议简介 Abstract: HTTP协议的特性,HTTP请求/响应的过程,HTTP请求/响应的报文格式等知识,最后会演示如何通过Chrome提供的开发者工具,去跟 ...

  6. Java软件工程师面试题:Java运行时异常与一般异常有什么不一样?

    异常表示程序运行过程中可能出现的非正常状态,运行时异常表示虚拟机的通常操作中可能遇到的异常,是一种常见运行错误.java编译器要求方法必须声明抛出可能发生的非运行时异常,但是并不要求必须声明抛出未被捕 ...

  7. Android开发工程师面试题之handler详解。android程序员,android开发面试资料,详解

    Message:消息:其中包含了消息ID,消息对象以及处理的数据等,由MessageQueue统一列队,终由Handler处理 Handler:处理者:负责Message发送消息及处理.Handler ...

  8. 前端开发工程师 - 05.产品前端架构 - 协作流程 & 接口设计 & 版本管理 & 技术选型 &开发实践

    05.产品前端架构 第1章--协作流程 WEB系统 角色定义 协作流程 职责说明 第2章--接口设计 概述 接口规范 规范应用 本地开发 第3章--版本管理 见 Java开发工程师(Web方向) - ...

  9. Java后端开发工程师是否该转大数据开发?

    撰写我对java后端开发工程师选择方向的想法,写给在java后端选择转方向的人 背景 看到一些java开发工程师,对java后端薪酬太悲观了.认为换去大数据领域就会高工资.觉得java后端没有前途.我 ...

随机推荐

  1. BindingException: Invalid bound statement (not found)问题排查:SpringBoot集成Mybatis重点分析

    重构代码,方法抛出异常:BindingException: Invalid bound statement (not found) 提示信息很明显:mybatis没有提供某方法 先不解释问题原因和排查 ...

  2. careercup-扩展性和存储限制10.3

    题目 给你一个文件,里面包含40亿个整数,写一个算法找出该文件中不包含的一个整数, 假设你有1GB内存可用. 如果你只有10MB的内存呢? 解答 我们先来做个算术题,40亿个整数大概有多大? * ^ ...

  3. 一点一点看JDK源码(六)java.util.LinkedList前篇之链表概要

    一点一点看JDK源码(六)java.util.LinkedList前篇之链表概要 liuyuhang原创,未经允许禁止转载 本文举例使用的是JDK8的API 目录:一点一点看JDK源码(〇) 1.什么 ...

  4. js中两个日期大小比较,获取当前日期,日期加减一天

    一.两个日期大小比较 1.日期参数格式:yyyy-mm-dd // a: 日期a, b: 日期b, flag: 返回的结果 function duibi(a, b,flag) { var arr = ...

  5. git 完善使用中

    GIT 版本库控制: 第一步:Git 的账号注册 url :https://github.com/ 这是git的官网如果第一次打开会这样 中间红色圈内是注册 内容, 第一项是用户名 第二项是邮箱 第三 ...

  6. Linux入门——SSH免密登录

    SSH免密登录 1.简介 SSH是一种网络协议,用于计算机之间的加密登录. 本文针对的实现是OpenSSH,它是自由软件,应用非常广泛. 2.初始化公钥私钥 有rsa,dsa两种加密方式,生成的公钥私 ...

  7. ubuntu下的python请求库的安装——Selenium,ChromeDriver,GeckoDriver,PhantomJS,aiohttp

    Selenium安装: pip3 install selenium ChromeDriver安装: 在这链接下载对应版本:https://chromedriver.storage.googleapis ...

  8. 转载:CSS的组成,三种样式(内联式,嵌入式,外部式),优先级

    (仅供自己备份) 原文地址:http://blog.csdn.net/chq11106004389/article/details/50515717 CSS的组成 选择符/选择器+声明(属性+值) 选 ...

  9. Blender2.79建模快捷键

    快捷键 基本操作 滚动鼠标中键滚轮:视图放大或缩小 按住鼠标中键滚轮:视图旋转 单独鼠标右键:选择物体 单独鼠标右键:放置物体 shift+鼠标中键:视图平移 小键盘数字1:前视图:ctrl+1:后视 ...

  10. java 用户修改密码

    import java.util.Scanner; class Member { private String mima; private String name; public String get ...