tomcat servlet JSP common gateway interface 公共网关接口
Tomcat主要充当servlet/JSP容器,不过它却有大量的功能可以与传统的Web服务器相媲美,对公共网关接口(Common Gateway Interface)的支持就是其中之一。
传统的Web服务器为了响应浏览器的请求,提供了运行外挂程序的一种方式,典型地用于处理基于Web的表单。这种机制叫做CGI。
CGI之所以称为通用,是因为它几乎可以调用所有编程或脚本语言:Perl、Python、awk、Unix Shell脚本,甚至还可以选择性地支持Java。
实际上,由于启动负荷过载,您可能不会将Java应用程序当成CGI来执行;而设计servlet规范的起因就是为了消除这种系统负载过载。
servlet几乎永远都比CGI高效,因为每当有人点击链接或按钮时候,并不会启动新的操作系统级进程。
[root@d3 apache-tomcat-7.0.90]# cat conf/tomcat-users.xml
<?xml version='1.0' encoding='utf-8'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<tomcat-users>
<!--
NOTE: By default, no user is included in the "manager-gui" role required
to operate the "/manager/html" web application. If you wish to use this app,
you must define such a user - the username and password are arbitrary. It is
strongly recommended that you do NOT use one of the users in the commented out
section below since they are intended for use with the examples web
application.
-->
<!--
NOTE: The sample user and role entries below are intended for use with the
examples web application. They are wrapped in a comment and thus are ignored
when reading this file. If you wish to configure these users for use with the
examples web application, do not forget to remove the <!.. ..> that surrounds
them. You will also need to set the passwords to something appropriate.
-->
<!--
<role rolename="tomcat"/>
<role rolename="role1"/>
<user username="tomcat" password="<must-be-changed>" roles="tomcat"/>
<user username="both" password="<must-be-changed>" roles="tomcat,role1"/>
<user username="role1" password="<must-be-changed>" roles="role1"/>
-->
<role rolename="admin"/>
<user username="un" password="123" roles="admin"/>
</tomcat-users>
[root@d3 apache-tomcat-7.0.90]#
在Java servlet出现之前,大多数Web应用程序都是以C/C++或Perl编写的。这些应用程序通常由多个静态HTML网页以及一些产生动态内容的CGI所构成。这些CGI脚本的编写过程可能与平台无关,不过这不是必要的
。同时,因为CGI是跨左右Web服务器品牌与实现的工业标准,所以CGI脚本可以写成独立于Web服务器实现的程序。事实上,某些CGI是这样处理的,而另一些则不是。CGI的最大问题是其设计本身会让他先天性执行缓慢,并无法扩充。
另一种产生动态网页内容的方式是使用Web服务器模块。例如,Apache http Web服务器可以在启动时执行动态可加载的模块。这些模块会响应预先配置的HTTP请求样式,并将动态网页内容送至HTTP的客户端/浏览器。
“通用网关接口”(CGI)是将Web服务器与自定义的Web应用程序挂钩的老标准,其主要用途是编写动态网页内容的脚本。一次,一半会把他成为“CGI脚本编写”(CGI scriprting),但其实也可以用C语言来编写CGI程序(对这样的程序,
我们一般不把它叫做脚本)。
所有对CGI脚本的HTTP请求,意味着操作系统都必须产生及执行新的进程,而且设计规则也会强制要求这样做。当Web服务器在大量网络负载下运行时,会启动和停止太多的进程,势必会造成服务器必须投入大部分资源以处理
启动和停止作业,而完成非HTTP请求。
tomcat servlet JSP common gateway interface 公共网关接口的更多相关文章
- Common Gateway Interface Python CGI编程
https://en.wikipedia.org/wiki/Gateway_(telecommunications) In telecommunications, the term gateway r ...
- CGI(Common Gateway Interface),通用网关接口
通用网关接口,简称CGI,是一种根据请求信息动态产生回应内容的技术.通过CGI,Web 服务器可以将根据请求不同启动不同的外部程序,并将请求内容转发给该程序,在程序执行结束后,将执行结果作为回应返回给 ...
- java web 开发入门 --- tomcat/servlet/jsp
在做java web 开发时,要先安装tomcat.它是一个web服务器,也叫web容器,我们把写好的jsp, html页面放到它里面,然后启动它,就可以用浏览器访问这些页面,地址栏中输入localh ...
- The Apache Tomcat Servlet/JSP Container
1.Tomcat部署的场景分析 通常,我们对tomcat单机部署需求可以分为几种: 单实例单应用 (一个tomcat 一个web应用) 单实例多应用 (一个tomcat多个应用) 多实例单应用 (多个 ...
- 什么是CGI(Common Gateway Interface)?
参考: 1.Python CGI编程 2.十分钟搞懂CGI 3.CGI Made Really Easy
- Tomcat+Servlet登录页面实例
概念 Tomcat server是一个免费的开放源码的Web 应用server,属于轻量级应用server,在中小型系统和并发訪问用户不是非常多的场合下被普遍使用,是开发和调试JSP 程序的首选. ...
- python web server gateway interface (wsgi ) notes
前言: 注:如果需要得到支持批Python3.x以及包含了勘误表,附录,和说明的更新版规范,请查看PEP 3333 摘要: 这篇文档详细说明了一套在web服务器与Python web应用程序(web框 ...
- Python Web Server Gateway Interface -- WSGI
了解了HTTP协议和HTML文档,我们其实就明白了一个Web应用的本质就是: 浏览器发送一个HTTP请求: 服务器收到请求,生成一个HTML文档: 服务器把HTML文档作为HTTP响应的Body发送给 ...
- (一)CGI (通用网关接口) 简介
CGI (通用网关接口)公共网关接口(Common Gateway Interface,CGI)是Web 服务器运行时外部程序的规范,按CGI 编写的程序可以扩展服务器功能.CGI 应用程序能与浏览器 ...
随机推荐
- 【MFC】设置窗口焦点
BOOL CTMSDlg::OnInitDialog() { ...... ...... //设置窗口焦点,注意return TRUE 改成 return FALSE GetDlgItem(IDC_E ...
- 使用gcc的-finstrument-functions选项进行函数跟踪【转】
转自:http://blog.csdn.net/jasonchen_gbd/article/details/44044899 版权声明:本文为博主原创文章,转载请附上原博链接. GCC Functio ...
- 使用 new Q_max_capacity 參數,同樣 loading 下,粗估耗電量(UI 上的 %)。
Precondition : 除了 Q_max 外,其它參數皆同. old Q_max_capacity : 1500 mAh new Q_max_capacity : 2200 mAh 有一個 lo ...
- jquery小技巧:使用jquery.confirm和PNotify实现弹出提示和消息提示
在从UIKIT前端换到BOOSTRAP前端时,一些转换的技巧. https://myclabs.github.io/jquery.confirm/ http://sciactive.github.io ...
- Powershell简介及其编程访问
Powershell是下一代的命令行外壳程序,较之于它的前身(cmd.exe),它的功能更加强大,也更加易用.最根本的区别在于它是基于对象的操作(基于.NET Framework),而不是基于字符串的 ...
- CCCC L2-024 部落【并查集】
https://www.patest.cn/contests/gplt/L2-024 首先在一行中输出这个社区的总人数.以及互不相交的部落的个数.随后对每一次查询,如果他们属于同一个部落,则在一行中输 ...
- 空间划分的数据结构(网格/四叉树/八叉树/BSP树/k-d树/BVH/自定义划分)
目录 网格 (Grid) 网格的应用 四叉树/八叉树 (Quadtree/Octree) 四叉树/八叉树的应用 BSP树 (Binary Space Partitioning Tree) 判断点在平面 ...
- 327. Count of Range Sum
/* * 327. Count of Range Sum * 2016-7-8 by Mingyang */ public int countRangeSum(int[] nums, int lowe ...
- html中的列表标签
1.<dl>定义列表,<dt>定义列表中的项目,<dd>对项目的描述 例: 效果: 2.<ul>无序列表,<li>列表项 例: 效果: 3. ...
- Oracle SOA Suit Medicator and OSB
Medicator和OSB (Oracle Service Bus)存在的目的,从架构的设计模式上看,和解耦多态等理念非常的相似. 通过Proxy代理的方式,把真正某个Service的实现进行隐藏,让 ...