JAVA外文文献+翻译

上传人:仙*** 文档编号:90293396 上传时间:2022-05-14 格式:DOC 页数:17 大小:67.50KB
收藏 版权申诉 举报 下载
JAVA外文文献+翻译_第1页
第1页 / 共17页
JAVA外文文献+翻译_第2页
第2页 / 共17页
JAVA外文文献+翻译_第3页
第3页 / 共17页
资源描述:

《JAVA外文文献+翻译》由会员分享,可在线阅读,更多相关《JAVA外文文献+翻译(17页珍藏版)》请在装配图网上搜索。

1、-Java and the InternetIf Java is, in fact, yet another puter programming language, you may question why it is so important and why it is being promoted as a revolutionary step in puter programming. The answer isnt immediately obvious if youre ing from a traditional programming perspective. Although

2、Java is very useful for solving traditional stand-alone programming problems, it is also important because it will solve programming problems on the World Wide Web.1. Client-side programmingThe Webs initial server-browser design provided for interactive content, but the interactivity was pletely pro

3、vided by the server. The server produced static pages for the client browser, which would simply interpret and display them. Basic HTML contains simple mechanisms for data gathering: te*t-entry bo*es, check bo*es, radio bo*es, lists and drop-down lists, as well as a button that can only be programme

4、d to reset the data on the form or “submit the data on the form back to the server. This submission passes through the mon Gateway Interface (CGI) provided on all Web servers. The te*t within the submission tells CGI what to do with it. The most mon action is to run a program located on the server i

5、n a directory thats typically called “cgi-bin. (If you watch the address window at the top of your browser when you push a button on a Web page, you can sometimes see “cgi-bin within all the gobbledygook there.) These programs can be written in most languages. Perl is a mon choice because it is desi

6、gned for te*t manipulation and is interpreted, so it can be installed on any server regardless of processor or operating system.Many powerful Web sites today are built strictly on CGI, and you can in fact do nearly anything with it. However, Web sites built on CGI programs can rapidly bee overly pli

7、cated to maintain, and there is also the problem of response time. The response of a CGI program depends on how much data must be sent, as well as the load on both the server and the Internet. (On top of this, starting a CGI program tends to be slow.) The initial designers of the Web did not foresee

8、 how rapidly this bandwidth would be e*hausted for the kinds of applications people developed. For e*ample, any sort of dynamic graphing is nearly impossible to perform with consistency because a GIF file must be created and moved from the server to the client for each version of the graph. And youv

9、e no doubt had direct e*perience with something as simple as validating the data on an input form. You press the submit button on a page; the data is shipped back to the server; the server starts a CGI program that discovers an error, formats an HTML page informing you of the error, and then sends t

10、he page back to you; you must then back up a page and try again. Not only is this slow, its inelegant.The solution is client-side programming. Most machines that run Web browsers are powerful engines capable of doing vast work, and with the original static HTML approach they are sitting there, just

11、idly waiting for the server to dish up the ne*t page. Client-side programming means that the Web browser is harnessed to do whatever work it can, and the result for the user is a much speedier and more interactive e*perience at your Web site.The problem with discussions of client-side programming is

12、 that they arent very different from discussions of programming in general. The parameters are almost the same, but the platform is different: a Web browser is like a limited operating system. In the end, you must still program, and this accounts for the dizzying array of problems and solutions prod

13、uced by client-side programming. The rest of this section provides an overview of the issues and approaches in client-side programming.2.Plug-insOne of the most significant steps forward in client-side programming is the development of the plug-in. This is a way for a programmer to add new functiona

14、lity to the browser by downloading a piece of code that plugs itself into the appropriate spot in the browser. It tells the browser “from now on you can perform this new activity. (You need to download the plug-in only once.) Some fast and powerful behavior is added to browsers via plug-ins, but wri

15、ting a plug-in is not a trivial task, and isnt something youd want to do as part of the process of building a particular site. The value of the plug-in for client-side programming is that it allows an e*pert programmer to develop a new language and add that language to a browser without the permissi

16、on of the browser manufacturer. Thus, plug-ins provide a “back door that allows the creation of new client-side programming languages (although not all languages are implemented as plug-ins).3.Scripting languagesPlug-ins resulted in an e*plosion of scripting languages. With a scripting language you

17、embed the source code for your client-side program directly into the HTML page, and the plug-in that interprets that language is automatically activated while the HTML page is being displayed. Scripting languages tend to be reasonably easy to understand and, because they are simply te*t that is part

18、 of an HTML page, they load very quickly as part of the single server hit required to procure that page. The trade-off is that your code is e*posed for everyone to see (and steal). Generally, however, you arent doing amazingly sophisticated things with scripting languages so this is not too much of

19、a hardship.This points out that the scripting languages used inside Web browsers are really intended to solve specific types of problems, primarily the creation of richer and more interactive graphical user interfaces (GUIs). However, a scripting language might solve 80 percent of the problems encou

20、ntered in client-side programming. Your problems might very well fit pletely within that 80 percent, and since scripting languages can allow easier and faster development, you should probably consider a scripting language before looking at a more involved solution such as Java or Active* programming

21、.The most monly discussed browser scripting languages are JavaScript (which has nothing to do with Java; its named that way just to grab some of Javas marketing momentum), VBScript (which looks like Visual Basic), and Tcl/Tk, which es from the popular cross-platform GUI-building language. There are

22、others out there, and no doubt more in development.JavaScript is probably the most monly supported. It es built into both Netscape Navigator and the Microsoft Internet E*plorer (IE). In addition, there are probably more JavaScript books available than there are for the other browser languages, and s

23、ome tools automatically create pages using JavaScript. However, if youre already fluent in Visual Basic or Tcl/Tk, youll be more productive using those scripting languages rather than learning a new one. (Youll have your hands full dealing with the Web issues already.) 4.JavaIf a scripting language

24、can solve 80 percent of the client-side programming problems, what about the other 20 percentthe “really hard stuff The most popular solution today is Java. Not only is it a powerful programming language built to be secure, cross-platform, and international, but Java is being continually e*tended to

25、 provide language features and libraries that elegantly handle problems that are difficult in traditional programming languages, such as multithreading, database access, network programming, and distributed puting. Java allows client-side programming via the applet.An applet is a mini-program that w

26、ill run only under a Web browser. The applet is downloaded automatically as part of a Web page (just as, for e*ample, a graphic is automatically downloaded). When the applet is activated it e*ecutes a program. This is part of its beautyit provides you with a way to automatically distribute the clien

27、t software from the server at the time the user needs the client software, and no sooner. The user gets the latest version of the client software without fail and without difficult reinstallation. Because of the way Java is designed, the programmer needs to create only a single program, and that pro

28、gram automatically works with all puters that have browsers with built-in Java interpreters. (This safely includes the vast majority of machines.) Since Java is a full-fledged programming language, you can do as much work as possible on the client before and after making requests of the server. For

29、e*ample, you wont need to send a request form across the Internet to discover that youve gotten a date or some other parameter wrong, and your client puter can quickly do the work of plotting data instead of waiting for the server to make a plot and ship a graphic image back to you. Not only do you

30、get the immediate win of speed and responsiveness, but the general network traffic and load on servers can be reduced, preventing the entire Internet from slowing down.One advantage a Java applet has over a scripted program is that its in piled form, so the source code isnt available to the client.

31、On the other hand, a Java applet can be depiled without too much trouble, but hiding your code is often not an important issue. Two other factors can be important. As you will see later in this book, a piled Java applet can prise many modules and take multiple server “hits (accesses) to download. (I

32、n Java 1.1 and higher this is minimized by Java archives, called JAR files, that allow all the required modules to be packaged together and pressed for a single download.) A scripted program will just be integrated into the Web page as part of its te*t (and will generally be smaller and reduce serve

33、r hits). This could be important to the responsiveness of your Web site. Another factor is the all-important learning curve. Regardless of what youve heard, Java is not a trivial language to learn. If youre a Visual Basic programmer, moving to VBScript will be your fastest solution, and since it wil

34、l probably solve most typical client/server problems you might be hard pressed to justify learning Java. If youre e*perienced with a scripting language you will certainly benefit from looking at JavaScript or VBScript before mitting to Java, since they might fit your needs handily and youll be more

35、productive sooner.to run its applets withi5.Active*To some degree, the petitor to Java is Microsofts Active*, although it takes a pletely different approach. Active* was originally a Windows-only solution, although it is now being developed via an independent consortium to bee cross-platform. Effect

36、ively, Active* says “if your program connects to its environment just so, it can be dropped into a Web page and run under a browser that supports Active*. (IE directly supports Active* and Netscape does so using a plug-in.) Thus, Active* does not constrain you to a particular language. If, for e*amp

37、le, youre already an e*perienced Windows programmer using a language such as C+, Visual Basic, or Borlands Delphi, you can create Active* ponents with almost no changes to your programming knowledge. Active* also provides a path for the use of legacy code in your Web pages.6.SecurityAutomatically do

38、wnloading and running programs across the Internet can sound like a virus-builders dream. Active* especially brings up the thorny issue of security in client-side programming. If you click on a Web site, you might automatically download any number of things along with the HTML page: GIF files, scrip

39、t code, piled Java code, and Active* ponents. Some of these are benign; GIF files cant do any harm, and scripting languages are generally limited in what they can do. Java was also designed to run its applets within a “sandbo* of safety, which prevents it from writing to disk or accessing memory out

40、side the sandbo*. Active* is at the opposite end of the spectrum. Programming with Active* is like programming Windowsyou can do anything you want. So if you click on a page that downloads an Active* ponent, that ponent might cause damage to the files on your disk. Of course, programs that you load

41、onto your puter that are not restricted to running inside a Web browser can do the same thing. Viruses downloaded from Bulletin-Board Systems (BBSs) have long been a problem, but the speed of the Internet amplifies the difficulty.The solution seems to be “digital signatures, whereby code is verified

42、 to show who the author is. This is based on the idea that a virus works because its creator can be anonymous, so if you remove the anonymity individuals will be forced to be responsible for their actions. This seems like a good plan because it allows programs to be much more functional, and I suspe

43、ct it will eliminate malicious mischief. If, however, a program has an unintentional destructive bug it will still cause problems.The Java approach is to prevent these problems from occurring, via the sandbo*. The Java interpreter that lives on your local Web browser e*amines the applet for any unto

44、ward instructions as the applet is being loaded. In particular, the applet cannot write files to disk or erase files (one of the mainstays of viruses). Applets are generally considered to be safe, and since this is essential for reliable client/server systems, any bugs in the Java language that allo

45、w viruses are rapidly repaired. (Its worth noting that the browser software actually enforces these security restrictions, and some browsers allow you to select different security levels to provide varying degrees of access to your system.)You might be skeptical of this rather draconian restriction

46、against writing files to your local disk. For e*ample, you may want to build a local database or save data for later use offline. The initial vision seemed to be that eventually everyone would get online to do anything important, but that was soon seen to be impractical (although low-cost “Internet

47、appliances might someday satisfy the needs of a significant segment of users). The solution is the “signed applet that uses public-key encryption to verify that an applet does indeed e from where it claims it does. A signed applet can still trash your disk, but the theory is that since you can now h

48、old the applet creator accountable they wont do vicious things. Java provides a framework for digital signatures so that you will eventually be able to allow an applet to step outside the sandbo* if necessary.Digital signatures have missed an important issue, which is the speed that people move arou

49、nd on the Internet. If you download a buggy program and it does something untoward, how long will it be before you discover the damage It could be days or even weeks. By then, how will you track down the program thats done it And what good will it do you at that point7.Internet vs. intranetThe Web i

50、s the most general solution to the client/server problem, so it makes sense that you can use the same technology to solve a subset of the problem, in particular the classic client/server problem within a pany. With traditional client/server approaches you have the problem of multiple types of client

51、 puters, as well as the difficulty of installing new client software, both of which are handily solved with Web browsers and client-side programming. When Web technology is used for an information network that is restricted to a particular pany, it is referred to as an intranet. Intranets provide mu

52、ch greater security than the Internet, since you can physically control access to the servers within your pany. In terms of training, it seems that once people understand the general concept of a browser its much easier for them to deal with differences in the way pages and applets look, so the lear

53、ning curve for new kinds of systems seems to be reduced.The security problem brings us to one of the divisions that seems to be automatically forming in the world of client-side programming. If your program is running on the Internet, you dont know what platform it will be working under, and you wan

54、t to be e*tra careful that you dont disseminate buggy code. You need something cross-platform and secure, like a scripting language or Java. If youre running on an intranet, you might have a different set of constraints. Its not unmon that your machines could all be Intel/Windows platforms. On an in

55、tranet, youre responsible for the quality of your own code and can repair bugs when theyre discovered. In addition, you might already have a body of legacy code that youve been using in a more traditional client/server approach, whereby you must physically install client programs every time you do a

56、n upgrade. The time wasted in installing upgrades is the most pelling reason to move to browsers, because upgrades are invisible and automatic. If you are involved in such an intranet, the most sensible approach to take is the shortest path that allows you to use your e*isting code base, rather than

57、 trying to recode your programs in a new language.When faced with this bewildering array of solutions to the client-side programming problem, the best plan of attack is a cost-benefit analysis. Consider the constraints of your problem and what would be the shortest path to your solution. Since clien

58、t-side programming is still programming, its always a good idea to take the fastest development approach for your particular situation. This is an aggressive stance to prepare for inevitable encounters with the problems of program development.8.Server-side programmingThis whole discussion has ignore

59、d the issue of server-side programming. What happens when you make a request of a server Most of the time the request is simply “send me this file. Your browser then interprets the file in some appropriate fashion: as an HTML page, a graphic image, a Java applet, a script program, etc. A more plicat

60、ed request to a server generally involves a database transaction. A mon scenario involves a request for a ple* database search, which the server then formats into an HTML page and sends to you as the result. (Of course, if the client has more intelligence via Java or a scripting language, the raw da

61、ta can be sent and formatted at the client end, which will be faster and less load on the server.) Or you might want to register your name in a database when you join a group or place an order, which will involve changes to that database. These database requests must be processed via some code on th

62、e server side, which is generally referred to as server-side programming. Traditionally, server-side programming has been performed using Perl and CGI scripts, but more sophisticated systems have been appearing. These include Java-based Web servers that allow you to perform all your server-side prog

63、ramming in Java by writing what are called servlets. Servlets and their offspring, JSPs, are two of the most pelling reasons that panies who develop Web sites are moving to Java, especially because they eliminate the problems of dealing with differently abled browsers. 9. separate arena: application

64、sMuch of the brouhaha over Java has been over applets. Java is actually a general-purpose programming language that can solve any type of problemat least in theory. And as pointed out previously, there might be more effective ways to solve most client/server problems. When you move out of the applet

65、 arena (and simultaneously release the restrictions, such as the one against writing to disk) you enter the world of general-purpose applications that run standalone, without a Web browser, just like any ordinary program does. Here, Javas strength is not only in its portability, but also its program

66、mability. As youll see throughout this book, Java has many features that allow you to create robust programs in a shorter period than with previous programming languages.Be aware that this is a mi*ed blessing. You pay for the improvements through slower e*ecution speed (although there is significant work going on in this areaJDK 1.3, in particular, introduce

展开阅读全文
温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!