精华区 [关闭][返回]

当前位置:网易精华区>>讨论区精华>>编程开发>>C/C++>>网络与通讯>>[转载] SOCKET, CGI, CORBA, RMI, DCOM -(2)

主题:[转载] SOCKET, CGI, CORBA, RMI, DCOM -(2)
发信人: crazyjava()
整理人: (1999-11-10 08:57:37), 站内信件
【 以下文字转载自 SystemAnalysis 讨论区 】
【 原文由 骄傲的中国人 所发表 】
CGI

A second, very popular way of communicating over a computer 
network(possibly the most popular way), is via CGI. CGI is 
a way to program your Web server so that it can offer more 
than the static form of HTML documents. When a client requests 
a CGI page, the server runs a program (identified by a special 
from of URL) that builds an HTML page on the fly. The server 
then transmits page can perform a simple computation, access 
a database, access another host, or do almost anything 
necessary to acquire the data it includes in the requested 
page.

The handy thing about CGI is that it is supported by every Web
browser and essentially every Web server. 

Despite its ease of use and popularity, however, CGI has some 
serious drawbacks:
1) CGI is slow. Tests reported by Orfali and Harkey(my teachers), 
   leading authorities on client-server computing, show that CGI 
   is about 200 times slower than IIOP.
2) CGI can compromise server security. CGI is a jerrybuilt 
   extension to Web servers. Many sites have been compromised 
   by hackers who have exploited weaknesses arising from the 
   inadequate integration between a Web server and the CGI 
   programs it spawns.
3) CGI cannot store state information. HTTP is a stateless 
   protocol. This means that Web browsers (and other HTTP 
   clients) are connected to Web servers only for the duration 
   of a single request. A browser cannot ask the server to 
   remember who it is, or anything about its previous requests. 
   The client must store this information and re-transmit it 
   with any request that needs it.

The Servlet Alternative

The limitation of CGI architecture led Sun to introduce its 
own alternative based on Java, the JavaServer architecture. 
JavaServer introduces the servlet, which is a java program 
that in many ways resembles an applet, but that runs on the 
server rather than on the client. Clients can request that 
servlets be started and can obtain results produced by 
servlets. Like client-side applets, servlets run under control 
of a security manager that monitors their artivities, preventing 
them from performing actions that might threaten system security. 
Moreover, servlets, though they are written in Java, run more 
effeiciently than CGI scripts. 

Because servlets are written in Java, they can invoke any of 
Java's APIs or facilites. Thus, for example, a servlet could 
use RMI to comminicate with a second rmote server, or with the 
originally requesting client. This chameleon characteristic 
makes it difficult to anticipate the typical ways in which 
servlets may someday come to be used, if they gain a permanent 
foothold in the computing marketplace.

When might you choose to use CGI as a means of communicating 
with a remote server? If performance is not a major concern 
and you're concern with providing access to a wide variety of 
clients (for example, the public), then CGI has important 
strenghts. If, on the other hand, your are creating applications 
that will be confined to your own organization, some other 
approach will probably serve you better. Servlets are an 
interesting alternative because they provide the same strength 
as CGI with fewer drawbacks.

/Crazyjava

--
孤身走我路...
其实,路,两个人一起走比一个人要好。
email: [email protected]

※ 修改:.crazyjava 于 Jul 30 17:04:06 修改本文.[FROM: 139.87.93.173]
※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 139.87.93.173]
--
※ 转载:.月光软件站 http://www.moon-soft.com.[FROM: 139.87.93.173]

[关闭][返回]