صفحة 1 من 3 123 الأخيرةالأخيرة
النتائج 1 إلى 15 من 36

الموضوع: SAMS PUBLISHING " JAVA UNLEASHED " VOL 1

  1. #1
    التسجيل
    03-08-2004
    الدولة
    تركيا
    المشاركات
    3,755

    Arrow SAMS PUBLISHING " JAVA UNLEASHED " VOL 1

    بسم الله الرحمن الرحيم
    السلام عليكم ورحمة الله وبركاته
    هذا الكتاب محمي بموجب قوانين الحقوق الملكية والفكرية وأي استعمال غير مرخص يعاقب بموجب القانون

    شباب اليكم هذا الكتاب الذي قد تصل قيمته الى 50 دولار
    أي مشكلة (نقص ،توزيع ،خلل) يرجى كتابته هنا
    اخر تحديث له عام 1997
    وشكرا
    رمضان كريم

  2. #2
    التسجيل
    03-08-2004
    الدولة
    تركيا
    المشاركات
    3,755

    مشاركة: SAMS PUBLISHING " JAVA UNLEASHED " VOL 1

    JAVA UNLEASHED

    Everything You Need To Know To Master Java!

    Introduction



    Nothing short of the World Wide Web itself has captured the attention of the Internet community as much as Java. Java, a Web programming technology, could forever alter the course of software development, especially in regard to the Internet. Java sports all features necessary for extending the Web in ways previously impossible. Java was designed with issues such as portability and reliability in mind. Java is an absolute essential for applications that are to run on the Internet. Java has stirred up so much excitement mainly because of what you can do with it on the Web. Java first introduced inline sound and animation in Web pages, and also added interactive Web pages, including games implemented in Java. Because of Java, the entire concept of the Web and what it can do is being redefined. In Java Unleashed, you will learn what Java is, what it can do, and how to use it. Many aspects of Java programming are covered, with lots of example source code to try out in your own Web pages. You can find out the difference between Java and C++, and what Java class libraries are. Aside from programming, there are plenty of other areas covered that you may need and will surely find interesting. For example, Java networking definitely delivers. You can write your own chat program, and learn how to load a URL from a Java applet. The Java networking support will not disappoint you! You can learn about Netscape 2.0's Java-related capabilities, security issues and master Java language fundamentals. You will also learn how to create games to be played on the Internet, and extend Java with content and protocol handlers. Ready to add spice to your Web site? With Java applets, the most popular usage of the Java programming language, you can learn how to write and design applets with the Java applet package. When learning Java, you will be able to exploit the full power and functionality of JavaScript, which can enhance your Web site even more. Also, the impact of Java on various real-world issues is discussed, along with what the future holds for Java and the Web in general. Copyright (c) 1996 by Sams.net Publishing FIRST EDITION International Standard Book Number: 1-57521-049-5

    Trademarks All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized. Sams.net Publishing cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark. Java is a trademark of Sun Microsystems, Inc.

  3. #3
    التسجيل
    03-08-2004
    الدولة
    تركيا
    المشاركات
    3,755

    مشاركة: SAMS PUBLISHING " JAVA UNLEASHED " VOL 1

    Chapter 1

    Java Makes Executable Content Possible

    By the mid 1990s, the World Wide Web had transformed the online world. Through a system of hypertext, users of the Web were able to select and view information from all over the world. However, while this system of hypertext gave users a high degree of selectivity over the information they chose to view, their level of interactivity with that information was low. Hypermedia had opened up many options for new kinds of sensory input a user might receive, including access to graphics, text, or even videos. However, the Web lacked true interactivity—real-time, dynamic, and visual interaction between the user and application.

    Java brings this missing interactivity to the Web. With a Java-enabled Web browser, you can encounter animations and interactive applications. Java programmers can make customized media formats and information protocols that can be displayed in any Java-enabled browser. Java’s features enrich the communication, information, and interaction on the Web by enabling users to distribute executable content—rather than just HTML pages and multimedia files—to users. This ability to distribute executable content is the power of Java.

    With origins in Sun Microsystem’s work to create a programming language to create software that can run on many different kinds of devices, Java evolved into a language for distributing executable content through the Web. Today, Java brings new interest to Web pages through applications that can all give the user immediate feedback and accept user input continuously through mouse or keyboard entries.

    In this chapter, I first present a description and definition of Java and explore what Java brings to Web communication. Then I present a brief “armchair” tour of some examples of what Java can do. If you want to go directly to programming in Java, see the other parts of this book. Otherwise, read this chapter and the others in this part for a survey of the potential of Java and the basics of its technical organization. These chapters should prepare you for the more detailed look at existing Java programming in the rest of this book.

    What Can Java Do?

    Java animates pages on the Web and makes interactive and specialized applications possible. Figure 1.1 illustrates how the software used with the Web can support a variety of communication. With hypertext, the basis for information organization on the Web, you can select what information to view. Programmers can create some interactivity through gateway programs that use files of hypertext on the Web as interfaces. When you use a Web page with such a gateway program, you can access databases or receive a customized response based on a query.

    Java adds to these communication possibilities by making it possible to distribute executable content. This gives Web information providers the opportunity to create a hypertext page that engages users in continuous, real-time, and complex interaction. This executable content is literally downloaded to the user’s computer. Once downloaded, the executable content might run an animation, perform computation, or guide a user through more information at remote network sites.

    [img]file:///D:/Java%20Unleashed/figicon.gif[/img]FIGURE 1.1.

    The Web’s software supports selectivity, display, computation, and interactivity.

    A METAPHOR FOR JAVA One metaphor for hypertext is that it offers a visually static page of information (which can include text, graphics, sound, and video). The hypertext page can also have “depth” where it contains hyperlinks connecting to other documents or resources. Java transforms this static page metaphor into a more dynamic one. The information on a Java page on the Web does not have to be visually static or limited to a pre-defined set of ways to interact with users. Users encountering Java programs can take part in a wider variety of interactive behavior, limited only by the imagination and skill of the Java programmer. Java thus transforms a hypertext page into a stage, complete with the chance for actors and players to appear and things to happen. And, instead of the user being in the audience, a user of a Java-enabled Web browser is actively a part of the activity on this stage, changing what transpires and reacting to it, and shaping the information content delivered on the Web.

    Java thus brings Web pages alive through animation and a higher degree of interaction than what is possible through gateway programming alone.

    JAVA’S HOMESun Microsystems, the developers of Java, provide a one-stop collection of information about Java on the Web at http://java.sun.com/. This site includes a full range of the latest information on Java and Java-enabled browsers. Links from this site take you to detailed announcements, release information, documentation, and links to Java demonstrations.

  4. #4
    التسجيل
    03-08-2004
    الدولة
    تركيا
    المشاركات
    3,755

    مشاركة: SAMS PUBLISHING " JAVA UNLEASHED " VOL 1

    What Is Java?

    The name Java is a trademark of Sun Microsystems and refers to the programming language developed by Sun and released in public alpha and beta versions in 1995. Java is used to create executable content that can be distributed through networks. Used generically, the name Java refers to a set of software tools for creating and implementing executable content using the Java programming language.

    In order for users to use Java content, they must have a key piece of Java software—the Java interpreter. To view Java content on the Web, a user’s Web browser must be Java-enabled. In the alpha release of Java, available during the spring and summer of 1995, only the special browser called HotJava could interpret programs created by the Java language. HotJava was developed by Sun to showcase the capabilities of the Java programming language. Other brands of Web browsers have since been upgraded to be able to interpret Java programs, most notably, the Netscape Navigator Web browser.

    A Java-enabled Web browser has the same capabilities as a non-Java Web browser, but additionally has the capability to interpret and display Java’s executable content. A Web browser that is not Java-enabled does not recognize Java and thus can’t display the Java executable content. Thus, Java-enabled browsers “see” the Web plus more—applications written using Java.

    As described in the section on Java’s origins (Java Origins and Direction), Java capability is expected to be integrated into future versions of other Web browsers and network tools.

    You can download the Java Developer’s Kit (JDK), which contains Java language development tools, from Sun Microsystems. Chapter 2 describes this software as well as Java’s technical design in more detail.

    What Is Executable Content?

    Executable content is a general term that characterizes the important difference between the content that a Java-enabled Web browser downloads and the content a non–Java-enabled browser can download. Simply put: In a non-Java Web browser, the downloaded content is defined in terms of Multipurpose Internet Mail Extensions (MIME) specifications, whichinclude a variety of multimedia document formats. This content, once downloaded by the user’s browser, is displayed in the browser. The browser may employ a helper application (such as in displaying images, sound, and video). The overall pattern for the use of this content is user choice, browser download, and browser display.

    A Java-enabled browser also follows this pattern, but adds another crucial step. First, the Java-enabled browser, following requests by the user, downloads content defined by MIME specifications and displays it. However, a Java-enabled browser recognizes a special hypertext tag called APPLET. When downloading a Web page containing an APPLET tag, the Java-enabled browser knows that a special kind of Java program called an applet is associated with that Web page. The browser then downloads another file of information, as named in an attribute of the APPLET tag, that describes the execution of that applet. This file of information is written in what are called bytecodes. The Java-enabled browser interprets these bytecodes and runs them as an executable program on the user’s host. The resulting execution on the user’s host then drives the animation, interaction, or further communication. This execution of content on the user’s host is what sets Java content apart from the hypertext and other multimedia content of the Web.

    The process of using executable content in a Java-enabled browser, for the user, is seamless. The downloading and start of the execution of content happens automatically. The user does not specifically have to request this content or start its execution. And, as will be explored more in the next chapter, this executable content is platform-independent: Java programmers need not create separate versions of the applets for different computer platforms, as long as the user has a Java interpreter (or Java-enabled browser) installed on his or her computer.

    Thus, when surfing the Web with a Java-enabled browser, you might find not only all the hypertext content that the pre-Java age Web offered, but also animated, executable, and distributed content. Moreover, this executable content can include instructions for handling new forms of media and new information protocols.

    How Java Changes the Web

    Java profoundly changes the Web because it brings a richness of interactivity and information delivery not possible using previous Web software systems. Java makes it possible for programmers to create software that can be distributed across networks and run on many different kinds of computers. The resulting executable content shifts the site of activity from the Web server to the Web client (the Java-enabled browser).

    Figure 1.2 illustrates the technical difference between Java’s interactivity and hypertext selectivity and gateway programming. The figure illustrates how gateway programming allows for computation and response but not in realtime. Java’s interactivity is much richer and is centered on the client rather than the server.

  5. #5
    التسجيل
    03-08-2004
    الدولة
    تركيا
    المشاركات
    3,755

    مشاركة: SAMS PUBLISHING " JAVA UNLEASHED " VOL 1

    Java Origins and Direction

    According to Michael O’Connell’s feature article on the origins of Java in the July 7, 1995 issue of SunWorld Online (http://www.sun.com/sunworldonline/swol-07-1995/swol-07-java.html), the development of Java began at Sun Microsystems in California by a team which included Java creator James Gosling even as the World Wide Web was being developed in Switzerland in 1991. The goal of this early development team was to develop consumer electronic products that could be simple and bug-free. What was needed was a way to createplatform-independent code and thus allow the software to run on any Central Processing Unit (CPU).

    As a starting point for a computer language to implement this platform-independence, the development team focused first on C++. However, the team could not get C++ to do everything they wanted in order to create a system to support a distributed network of communicating heterogeneous devices. The team abandoned C++ and developed a language called Oak (later renamed Java). By the fall of 1992, the team had created a project named Star 7 (*7), which was a personal hand-held remote control.

    The development team was incorporated as FirstPerson, Inc., but then lost a bid to develop a television set-top box for Time-Warner. By the middle of 1994, the growth in the Web’s popularity drew the team’s attention. They decided they could build an excellent browser using Java technology. With a goal of bringing their CPU-independent, real-time programming system to the Web, they built a Web browser.

    The browser, called WebRunner, was written using Java and completed early in the fall of 1994. Executives at Sun Microsystems were impressed and saw the technology and commercial possibilities that could result from a new browser: tools, servers, and development environments.

    On May 23, 1995, Sun Microsystems, Inc. formally announced Java and HotJava at SunWorld ’95 in San Francisco. Throughout the summer of 1995, interest in Java grew rapidly. The first wave of developers downloaded and used the alpha release of Java and the HotJava browser and experimented with this new software. The alpha release of Java was the basis for the entries in the first Java contest, with prizes awarded in September 1995. In late September, the pre-beta release of Java was announced. The pre-beta release was Sun’s move toward stabilizingthe language so that programmers could begin investing their efforts into more significantapplications.

    By the end of 1995, Java had gained the attention of the major players in the online world. Sun licensed Java to Netscape Communications, Inc. for use in its very popular Netscape Navigator browser. In addition, other major computer software and network players announced products involving Java, including Borland, Mitsubishi Electronics, Dimension X, Adobe, Lotus, IBM, Macromedia, Natural Intelligence, Oracle, and Spyglass. Most dramatic was Microsoft’s announcement on December 7, 1995 of their intent to license Java. Microsoft’s announcement was particularly dramatic, because, during the summer and fall of 1995, Bill Gates, chairman and CEO of Microsoft, had downplayed Java’s role, calling Java “just another language.” However, Microsoft’s year-end licensing announcement clearly showed that Microsoft considers Java part of an overall Internet strategy.

    Java’s Current Status and Timeline

    A JAVA ONLINE BIBLIOGRAPHY</FONT>You can connect to a bibliography of online articles and key press releases tracing the history and current status of Java at http://www.december.com/works/java/bib.html.

    Java was essentially not a player in the online world in the spring of 1995. However, by the end of that year, it had rocketed to a (perhaps over-hyped) prominence. Along the way, it passed through its alpha and beta stages and grabbed the attention of Web information providers.

    At SunWorld in May 1995, Sun unveiled Java and HotJava to the world and Netscape announced that it would license Sun’s Java programming language for its Netscape Navigator browser. By summer, Java and HotJava were in alpha stages of development. The Alphas were released for Sun Solaris 2.3, 2.4 and 2.5 SPARC-based and Microsoft Windows NT. Ports were underway for Microsoft Windows 95, and MacOS 7.5 and, in third-party projects, for other platforms and operating systems, including Windows 3.1, Amiga, NeXT, Silicon Graphics, and Linux.

    By the end of 1995, in the wake of the splashy launch of Microsoft Windows 95, there was much debate about the possibility of a “Java terminal” or an “Internet PC” (IPC), a device which would provide an inexpensive view into the Internet. An IPC would have minimal hardware and software in it and be specifically dedicated to supporting a Java-enabled Web browser, which could be continuously upgraded. Potentially, such an IPC could be a cheap, efficient way to encounter Web information. Widespread use of such IPCs could overthrow years of “API lock” on personal computing communications based on the Microsoft Windows/Intel (“Wintel”) standards.

    For the most current information on Java’s software releases for different platforms, see Sun Microsystem’s Java site: http://java.sun.com/ or other Java information sources at http://www.december.com/works/java/info.html.

  6. #6
    التسجيل
    03-08-2004
    الدولة
    تركيا
    المشاركات
    3,755

    مشاركة: SAMS PUBLISHING " JAVA UNLEASHED " VOL 1

    Java Future Possibilities

    Java technology is not necessarily limited only to the Web. Java technology can be deployed in embedded systems, such as handheld devices, telephones, and VCRs. Mitsubishi Electronics has been working to use Java technology in these devices.

    The association of Netscape and Sun Microsystems that brought Java technology into Netscape browsers by late 1995 will be sure to have significance for Net software. With Netscape Navigator’s widespread installed base, the use of Java in applications could rapidly increase. Therefore, other Web browser manufacturers might be compelled to also license Java in order to keep pace with the information environment on the Web.

    The market for third-party object and tool libraries for Java is also a potential bonanza. Software layers on top of “raw” Java will enable developers to use more sophisticated tools to create applications and users to more easily build and incorporate Java applets in their Web pages. Chapter 2 describes how Java’s nature as an object-oriented programming language makes it particularly amenable for creating reusable, extensible software components.

    By integrating Java with Virtual Reality Modeling Language (VRML) (http://www.vrml.org/), developers can create virtual worlds that are not only three-dimensional but also animated and interactive. Dimension X ( http://www.dnx.com) has developed a Java-VRML mix called Iced Java which has the potential to take Web communication and interaction to an even richer level.

    Illustrations of Java’s Potential

    Java is a new programming language, and programmers outside of Sun Microsystems have just begun to explore its potential. Since the public release of Java in its alpha and beta versions, however, many good examples of Java have already been developed. The rest of this chapter shows you examples of the kinds of functionality that Java can support, with an emphasis on the unique way Java enables the distribution of animated, executable content. Information on developing applications which can achieve this potential of Java is in later parts of this book.

    ALPHA, BETA, JAVA</FONT>The initial, or alpha, release of Java is incompatible with later releases: the alpha bytecodes won’t run in beta or later Java-enabled browsers; also, the alpha Java language used an HTML APP tag rather than the APPLET tag of the beta and later versions of Java. The development sections of this book focus on the beta version of Java which is upward compatible with later versions of Java.

    Animation

    Java’s applications put animated figures on Web pages. Figure 1.3 shows a still image of Duke, the mascot of Java, who tumbles across a Web page displayed in the browser. Duke tumbles across the page, cycling through a set of graphic images that loop while the user has this page loaded.

    <A href="file:///D:/Java%20Unleashed/049-5g/01/01jun03.gif">[img]file:///D:/Java%20Unleashed/figicon.gif[/img]FIGURE 1.3.

    Tumbling Duke, mascot of Java. (Courtesy of Arthur van Hoff, Sun Microsystems)

    Animation isn’t limited to cartoon figures, however. Pages can have animated logos or text that moves or shimmers across the screen. Java animations also need not just be a decorative pre-generated figure, but can be a graphic that is generated based on computation. Figure 1.4 shows a bar chart applet.

    [img]file:///D:/Java%20Unleashed/figicon.gif[/img]FIGURE 1.4.



    A bar chart applet. (Courtesy of Sun Microsystems)

    Interaction

    While the animations shown can be static images that are drawn or generated, or animated images that can behave according to a preset algorithm (such as the tumbling Duke in Figure 1.3), animation can also be made interactive, where the user has some input on its appearance. Figure 1.5 shows a three-dimensional rendering of chemical models. Using the mouse, you can spin these models and view them from many angles. Unlike the source code for the graph applet shown in Figure 1.4, of course, the source code for the chemical modeling is more complicated. To the user, however, the chemical models seem three-dimensional, giving an insight into the nature of the atomic structure of these elements as no book could.

    [img]file:///D:/Java%20Unleashed/figicon.gif[/img]FIGURE 1.5.



    Three-dimensional chemical models. (Courtesy of Sun Microsystems)

    The chemical models in Figure 1.5 respond to user clicks of the mouse. Another variation on this animation involves providing the user with a way to interact with an interface to get feedback. The “impressionist” drawing canvas in Figure 1.6 is an excellent example of this. Paul Haeberli at Silicon graphics developed an “impressionist” Java applet at http://reality.sgi.com/grafica/impression/imppaint.html. He originally developed this technique for creating this kind of graphic in 1988 for a Silicon Graphics IRIS workstation. Later patented, this technique drives his Java applet. The result is that you can draw using various size brushes on a canvas and reveal one of several pictures.

    [img]file:///D:/Java%20Unleashed/figicon.gif[/img]FIGURE 1.6.



    Interactive impressionist drawing. (Courtesy of Paul Haeberli at Silicon Graphics)

    Another variation on interactivity is real-time interactivity. Figure 1.7 shows an interactive application that involves moving graphics that the user manipulates. This is the game of Tetris, in which you can try to line up the falling tile shapes to completely fill the rectangle. Using designated keys for playing, you interact with the interface to steer the falling shapes. This Tetris implementation demonstrates the possibilities for arcade-like games using Java technology.

  7. #7
    التسجيل
    03-08-2004
    الدولة
    تركيا
    المشاركات
    3,755

    مشاركة: SAMS PUBLISHING " JAVA UNLEASHED " VOL 1

    Interactivity and Computation

    The Tetris game described in the previous section, for example, demonstrates how interactivity and animation can work together. Both applets customized their animated output based on user input, so both applets were actually performing computation. However, an example that shows this computational capability in more concrete terms is in Figure 1.8, a simple spreadsheet.

    This spreadsheet works in much the same manner as the other applets, but emphasizes that the computational possibilities can enable users to have an environment in which to work instead of just a puzzle to solve. The spreadsheet shown enables you to change the contents of any of the 24 cells (A1 through D6) by replacing its label, value, or formula. (Not all cells are shown in the figure.) This is just like a real spreadsheet, which is more of an environment in which the user can work than a fixed game such as the crossword puzzle. This subtle difference is a profound one: using Java, a user can obtain an entire environment for open-ended interaction rather than a fixed set of options for interaction—opening up the Web page into a Web stage.

    [img]file:///D:/Java%20Unleashed/figicon.gif[/img]FIGURE 1.8.



    A simple spreadsheet. (Courtesy of Sami Shaio, Sun Microsystems)



    This ballistic simulator shown in Figure 1.9 (http://jersey.uoregon.edu/vlab/Cannon2/) enables you to explore how a canon operates. You can adjust the muzzle angle and velocity, gravitational field strength, wind speed, and the density of the projectile. The purpose of this applet is to helpstudents understand the relation between muzzle velocity and gravitational potential and drag.

    [img]file:///D:/Java%20Unleashed/figicon.gif[/img]FIGURE 1.9.



    A virtual canon. (Coding by Sean Russell, Software Manager, University of Oregon; Graphic images by Amy Hulse)

    Just as the user can download a canon, so too can a user download a “kit” for doing almost anything. Patrick A. Worfolk of the Geometry Center, University of Minnesota) has created a simulation that users can use to discover the properties of Lorenz equations (http://www.geom.umn.edu/~worfolk/apps/Lorenz/). The user can see the results of the numerical integration (the equations in the bottom of Figure 1.10) as well as graphical representations of their numerical solution.

    [img]file:///D:/Java%20Unleashed/figicon.gif[/img]FIGURE 1.10.



    Numerical Simulation of the Lorenz Equations. (Courtesy of The Geometry Center, University of Minnesota)

    Communication

    The preceding examples demonstrate many informational, animation, and computational applications of Java. Another application area is communication among people.

    Paul Burchard has created a system for users to share “chats” over the Web using a Java applet ( http://www.cs.princeton.edu/~burchard/www/interactive/chat/express.html).

    Not only do users see each other’s text, but they can follow each other on tours of the Web. Figure 1.11 shows this “chat touring” applet in action.

    [img]file:///D:/Java%20Unleashed/figicon.gif[/img]FIGURE 1.11

    Of course, communication takes place all the time on nearly all Web pages through text or other media. But a Java-enabled browser can also display multimedia. Figure 1.12 illustrates a player piano applet—you see the keyboard play and hear the music at the same time.

    [img]file:///D:/Java%20Unleashed/figicon.gif[/img]FIGURE 1.12

    Java can also be used to support mass communication in new ways. The Nando Times is a Web-based news service that has been very innovative in news delivery on the Web. Using Java, this news agency now provides a tickertape of headlines across its front page. The text under the Nando banner in Figure 1.13 scrolls continuously to show the world, national, sports, and political top stories at the moment. The four pictures under the labels for these categories also change, giving a “slide show” that is very effective in displaying new information without requiring the user to select it for viewing. This transforms the Web into something people can watch to get new information.

    [img]file:///D:/Java%20Unleashed/figicon.gif[/img]FIGURE 1.13

    Similarly, Figure 1.14 shows how current information feeds can act as surveillance for specific activities. The figure shows an applet from The Sports Network (www.sportsnetwork.com). This provides you with a life sportswire pop-up window. You can follow NFL and NHL action live, as it happens. As the scores change, this display changes, so that the sports-minded can keep up with the current games and scores. Like the Nando Times news feed, this sports feed changes the Web into something to watch in addition to something to interact with.

    Applications and Handlers

    In addition to applets like the ones shown here, Java programmers can also create applications, or standalone programs, that don’t require the Java-enabled browser to run. (The HotJava browser itself is such an application, written using Java.) Applications could thus conceivably be new browsers or interfaces that interact with other network or local resources.

    [img]file:///D:/Java%20Unleashed/figicon.gif[/img]FIGURE 1.14

    Another kind of software program available with Java is a handler. A protocol handler enables a Java programmer to specify how a Java browser should interpret a particular type of protocol. The HotJava browser knows how to interpret the Internet protocols such as HTTP, FTP, Gopher, and others because of the browser distribution code. But if new protocols are invented, a Java programmer can specify how they should be handled by creating a protocol handler.

    Another type of handler is a content handler. This handler translates a particular specification for a file type based on Multipurpose Internet Mail Extensions (MIME). This content handler will specify how the HotJava browser should handle a particular type of file type. By creating a specification in a content handler, all Java-enabled browsers will be able to view this special format.

    The handlers and applications that Java makes possible have the potential to dramatically extend what can be browsed on the Web. No longer will information developers have to be concerned about making sure their users have the proper software to view a particular type of file or handle a new kind of protocol. The protocol and content handlers, like the executable content Java makes possible as applets, can be distributed as needed to requesting Java-enabled browsers.

  8. #8
    التسجيل
    03-08-2004
    الدولة
    تركيا
    المشاركات
    3,755

    مشاركة: SAMS PUBLISHING " JAVA UNLEASHED " VOL 1

    What Java Might Make Possible

    The previous examples illustrate only some of the potential of Java. A few of these examples are “toy” demonstrations meant to show the possibilities of Java. What kind of communication might Java foster? The Nando Times example shows an innovative application for providing information in a way that lets you to sit back and observe rather than selecting hypertext links.

    Java opens up a new degree of interactivity and customizability of interaction for the Web. Earlier Web development techniques of creating pages and linking them together will still be necessary in a Java-flavored Web. However, Java creates possibilities for richer kinds of content to be developed. The user can interact with and change the appearance of a Web page along with the state of a database using a Java-enabled browser. Thus, Java profoundly changes the texture of the Web in the following ways:

    • Java creates places to stop on the paths of the Web: A well-done Java application on a single hypertext page can engage a user for a long time. Rather than just text, sound, images, or videos to observe, a Java page can offer a place to play, learn, or communicate and interact with others in a way that isn’t necessarily based on going somewhere else on the Web through hyperlinks. If the hypertext links of the Web are like paths, the Java pages are like the towns, villages, and cities to stop on these paths and do something other than just observe or “surf.”
    • Java increases the dynamism and competitiveness of the Web: Just as new browser technology prompted Web developers to create still more applications and pages to exploit these features, so too does Java technology promise a new round of content development on the Web.
    • Java enriches the interactivity of the Web: Java’s interactivity is far richer, more immediate, and more transparent than the interactivity possible through gateway programming. Gateway programming still should have a role in Web applications, just as page design and multimedia presentation will still play a role. However, Java’s interactivity brings new possibilities of what can happen on the Web. With Java, transactions on the Web can be more customized, with immediate and ongoing feedback to the user.
    • Java transforms the Web into a software delivery system: Java’s essential design as a language to deliver executable content makes it possible for programmers to create software of any kind and deliver it to users of Java-enabled browsers. Rather than having to focus on the interface, the Java programmer focuses on the interaction desired and lets the built-in features of the graphics take care of the rest of the implementation. The result is that very simple programs like the drawing and spreadsheet applications can be created quickly and distributed worldwide.
    The true potential of Java to transform the Web is still in its initial stages. New potential applications for commerce, information delivery, and user interaction still await the imagination and skill of future Java developers.

    Summary

    Java is a programming language designed to deliver executable content over networks. A user or programmer should know what kinds of interaction Java can make possible and what its true potential can be: enlivening the Web, enriching the display of information in the form of animation and interactive applications.

    • Java enriches the interactivity possible on the Web. Rather than making just informational content possible, Java can support interactive content in the form of software that can be downloaded and run on any computer host with the Java interpretation environment installed.
    • Java developed from ideas about platform-independent executable code. Sun Microsystems researchers have developed Java to be a powerful programming and information delivery system for use with the Web.
    • Java makes animation, interaction, computation, distributed applications, and new forms of communication possible. Through protocol and content handlers, Java has the potential to make new formats and new protocols available for use on the Web.
    • Java transforms the Web into a software delivery system where users have things to do rather than just places to go. Java may change the surfing behavior of Web users into playing and learning behavior in new interactive environments.

  9. #9
    التسجيل
    03-08-2004
    الدولة
    تركيا
    المشاركات
    3,755

    مشاركة: SAMS PUBLISHING " JAVA UNLEASHED " VOL 1

    Chapter 2

    Java’s Design Is Flexible and Dynamic

    The Java programming language is uniquely suited for distributing executable content over networks. Java also offers a set of functions similar to many other programming languages. This chapter presents an overview of the technical design of Java. I begin with a minimal example of a “hello world” Java program. This should help you understand how Java and HTML connect. Using this information, you can then try out some of the Java programs shown in later parts of this book.

    Java also has specialized characteristics. In the second part of this chapter, I discuss in more technical detail how Java supports executable, distributed applications.

    A Hello to Java

    The first part of understanding the technical details of Java is learning how Java interacts with the Web’s hypertext. The example shown in this section demonstrates how a special tag of the hypertext markup language (HTML) associates a Java program called an applet to a page on the Web. Viewed through a Java-enabled Web browser, a page with a Java applet can come alive with animation or interaction.

    Java’s Connection to the Web

    As a language for delivering information on the Web, Java connects to the Web’s hypertext markup language (HTML) using a special tag called APPLET. Figure 2.1 summarizes this connection:

    1. In response to a request from a user of a Web browser, a document on a Web server written in HTML is downloaded to the user’s browser.
    2. If the HTML document contains an APPLET tag and the user’s Web browser is Java-enabled, the browser looks for the value of the Code attribute which identifies the Java bytecodes defining the applet.
    3. The applet bytecodes are downloaded from the Web server (or possibly some other Web server or network site identified by attributes of the APPLET tag) and placed on the user’s host computer.
    4. The user’s Java-enabled browser interprets these bytecodes and runs the applet in the user’s browser. The applet commonly will provide a visual indication that it is operating and possibly accept input from some combination of the user’s cursor position, mouse buttons, or keyboard. Once the applet is downloaded, it need not be downloaded again, even if the applet code defines repeated loops or other interaction. The user might use a downloaded applet several times over the course of an online session without any more network retrievals.
    [img]file:///D:/Java%20Unleashed/figicon.gif[/img]FIGURE 2.1.



    Java’s connection to the Web through the APPLET tag.

    A technical understanding of Java also requires a familiarity with HTML. HTML is the markup language used to create the documents displayed in Web browsers. HTML is not a layout language for describing how a page of hypertext should look (although there are many features of HTML that can be used to manipulate a page’s appearance). Rather, HTML tags the structure of a document and the meaning of text, so that a browser can display it in a scheme based on that browser’s design and the user’s preferences for the font size, style, and other features.

    An HTML document consists of text and tags that mark the structure of the document. Tags in an HTML document are delimited by the brackets < and >. Some tags always appear in a pair, as a start and end tag. For example, you can identify the title of an HTML document by placing the tags <TITLE> and </TITLE> around the text of the document’s title. Other tags don’t require a corresponding ending tag. For example, you can identify a paragraph start using the <P> tag.

    Some tags have attributes, which qualify the tag’s meaning. For example, the APPLET tag has the attributes Code as well as Height and Width.

    Here is a simple HTML document:

    <HTML><HEAD> <TITLE>Example HTML Document</TITLE></HEAD><BODY> <P> This is the body of the document. <OL> <LI>This is the first item in an ordered list. <LI>This is the second item. </OL></BODY></HTML>When a Web browser interprets these HTML tags and text, it displays the document without the brackets < and >. A text-only browser renders this simple HTML example as

    Example HTML DocumentThis is the body of the document. 1. This is the first item in an ordered list. 2. This is the second item.The document http://www.december.com/works/wdg/quickref.html contains HTML tags presented in a reference table, showing many more features of HTML that are available. The simple HTML example shown here is recognized by Sun’s HotJava and other Java-enabled browsers and should be enough to get you started in understanding how HTML connects to Java and testing simple applets.

    A Simple Java Program

    The APPLET tag in an HTML document identifies the name of a Java program called an applet to be included in a Web page. The name of the applet is called its class name. This name is associated with the executable bytecodes that run the applet.

    For example, the following HTML example demonstrates how you can include an applet in a Web document. If you want to test this, put the following lines in a file called HelloWorld.html:

    <HTML><HEAD> <TITLE>HelloWorld</TITLE></HEAD><BODY> <P>”This is it!” <APPLET Code=”HelloWorld.class” Width=”600" Height=”300"> </APPLET></BODY></HTML>Note that there is an open APPLET tag, <APPLET>, and a close APPLET tag, </APPLET>. The attributes shown here are Code, to identify the class file which contains the Java bytecodes and the Width and Height attributes, measured in pixels, to describe how much room should be reserved on the Web page for the applet.

  10. #10
    التسجيل
    03-08-2004
    الدولة
    تركيا
    المشاركات
    3,755

    مشاركة: SAMS PUBLISHING " JAVA UNLEASHED " VOL 1

    THE APPLET TAG SYNTAX</FONT>Java uses an APPLET tag to place executable content in an HTML document. General Format

    <APPLET Codebase = “path to directory containing class files” Code = “name of class file” Width = “width of applet in pixels” Height = “height of applet in pixels”> <PARAM Name=”parameter name” Value=”value of parameter”> <PARAM Name=”parameter name” Value=”value of parameter”></APPLET>The parameter values are given to the applet for use in its computations.

    Here is a sample use of the APPLET tag:

    <APPLET Codebase = “http://java.sun.com/applets/applets/TumblingDuke/” Code = “TumbleItem.class” Width = “400” Height = “95”> <PARAM Name=”maxwidth” Value = “100”> <PARAM Name=”nimgs” Value = “16”> <PARAM Name=”offset” Value = “-57”> <PARAM Name=”img” Value = “http://java.sun.com/applets/applets/TumblingDuke/&Acirc;images/tumble”></APPLET>

    Of course, you need to create the Java source code for the applet named HelloWorld. You can find more details on programming in Java in Chapter 12, “Java Language Fundamentals.” For now, here is a minimal Java applet as a simple demonstration:

    import java.awt.Graphics;/** A first hello. */public class HelloWorld extends java.applet.Applet { public void init() { resize(600, 300); } public void paint(Graphics context) { context.drawString(“Hello, world!”, 50, 100); }}THE HelloWorld JAVA SOURCE CODEThe source code for HelloWorld is on the CD-ROM that accompanies this book. I also provide the source code for the HelloWorld and other introductory Java applets at my book support Web page for Presenting Java at http://www.december.com/works/java.html.

    You can place Java code in a file named HelloWorld.java. Next, you have to compile the Java source code using the Java compiler, javac. At the operating system prompt ($), enter:

    $ javac HelloWorld.javaIf there are no errors, the compiler will create a file named HelloWorld.class that contains the bytecodes for the HelloWorld applet.

    So at this point, you have the following:

    • A file called HelloWorld.html. This is the hypertext markup language (HTML) source file.
    • A file called HelloWorld.java. This is the Java language source file.
    • A file called HelloWorld.class. This is the Java bytecode file.
    Figure 2.2 summarizes the Java source code and compilation relationships.

    If you have a Java-enabled browser, you can test this applet. Use the browser to open the file HelloWorld.html. Alternatively, you can also use the applet viewer supplied with the Java Developer’s Kit (JDK) to view applets without having to make an HTML page to reference them. Figure 2.3 shows what this example looks like in Netscape Navigator.

    [img]file:///D:/Java%20Unleashed/figicon.gif[/img]FIGURE 2.2.



    Java source code and compilation relationships.

    [img]file:///D:/Java%20Unleashed/figicon.gif[/img]FIGURE 2.3.



    Java browser display of the HelloWorldapplet.

    Java Technical Overview

    The preceding example concretely demonstrates the connection of Java applets to the Web through the APPLET tag. But this is only a view of Java from a very beginning perspective. To help you understand Java’s design and potential, this section provides a technical and conceptual overview of the language and its role in online communication.

    Java is an object-oriented programming language that is used in conjunction with Java-enabled Web browsers. These browsers can interpret the bytecodes created by the Java language compiler. The technical design of Java is architecture neutral. The term architecture in this sense refers to computer hardware. For example, your computer’s architecture could be an IBM personal computer with an Intel 386 chip. Programmers can create Java programs without having to worry about this underlying architecture of a user’s computer. Instead, the HotJava browser is customized to the user’s architecture. The HotJava browser interprets the bytecodes for the particular architecture of the user. This is a key characteristic of Java’s technical design.

    The Network Communication Support Ring Around Java

    Java’s technical characteristics also place it within the larger context of online communication. We can step back from the Java source and bytecode files and look at the “big picture” of how Java fits into cyberspace.

    The operation of Java and Java-enabled browsers on the Web requires the interoperation of a variety of network systems. Of course, you don’t have to understand the interoperation of all of these systems to use Java or a Java-enabled browser. But, stepping back a bit from the applet-scale view of Java, we can look at its place in a “support ring” of networks and applications.

    The goal of Java is to bring executable content to the Web. When installed, a Java-enabled browser can provide an interface to animated and interactive applications. To view and interact with these applications, you must have a computer with a Java-enabled browser installed. If you want to download content from all over the Web, of course you also must have an Internet connection.

    Beginning with the widest context for the operation of the Java technology, let’s take a look at the systems necessary to support Java when delivering information globally (again, Java can be used on local networks not requiring the Internet, collapsing the set of support rings described here considerably):

    1. Cyberspace is the mental model people have for communicating or interacting online or through computers. Cyberspace activity includes variety of information, communication, and interaction. Cyberspace can be thought of as consisting of non-networked and networked regions. The networked region in cyberspace includes activity on connected local, regional, and global computer networks. The non-networked region might be standalone personal computer applications like word processors or CD-ROMs that contain no network references.
    2. The Internet computer network serves as a vehicle for data communication for many information dissemination protocols. Through gateways, many other networks in cyberspace can exchange data with the Internet. Because of this and also because of the large amount of information available on it, the Internet serves as a common ground for the networked region of cyberspace.
    3. The Web is an application that relies on a client/server model for data communication for distributing hypermedia. While the Web can operate on local networks that have no connection to the Internet, the Web is popularly known for its collection of information that is available globally through the Internet.
    4. A Web client, known as a browser, is a software program that interprets and displays information disseminated using a variety of Internet information protocols. A Web browser is a user’s interface into the Web. A pre-Java Age (Mosaic class) browser usually operates in conjunction with a variety of helper applications to display multimedia. A Java-enabled browser can dynamically learn new protocols and media content types, so that it need not rely on these helper applications. However, a Netscape 2.0 browser, while Java-enabled, still makes use of helper applications, because the entire content of the Web isn’t Java-ized.
    5. HTML is used to create hypertext for the Web and marks the semantic structure of Web documents. HTML consists of tags and entities that identify the structure and meaning of text in documents. Documents contain references to other resources using a system of Uniform Resource Locators (URLs).
    6. The HTML APPLET tag associates Java applications with HTML documents. This tag occurs in an HTML document and identifies a Java applet that will be placed in that document.
    7. A Java programmer prepares a file of human-readable Java source code. This source code defines an applet, which is a class in the hierarchy of classes that make up the Java language.
    8. A Java programmer compiles a Java source code and makes the resulting bytecodes available for use through a reference to them in an APPLET tag in an HTML document.
    9. HotJava, or any other Java-enabled browser, downloads hypertext as well as the executable bytecodes of the applet. The browser interprets and displays the applet, allowing a user to view or interact with the applet.
    Figure 2.4 summarizes the support rings for Java as it is used for worldwide distribution of information.

  11. #11
    التسجيل
    03-08-2004
    الدولة
    تركيا
    المشاركات
    3,755

    مشاركة: SAMS PUBLISHING " JAVA UNLEASHED " VOL 1

    Again, you don’t have to know how to set up the entire range of networks, software, and equipment in Java’s “support ring.” All you need is to install a Java-enabled browser on your Internet-accessible system. From your point of view as a user, your main focus is your browser, or the interior fourth ring, of Figure 2.4. A Java programmer, in contrast, inhabits the seventh ring, and tries to meld the user’s experience of the Web’s hypertext with the specialized content Java makes possible.

    You can use Figure 2.4 to help place yourself in cyberspace as you fulfill different roles as an information user or producer.

    Characteristics of Java as a Programming Language

    While users may want to have some awareness of how Java fits into online communication, programmers need to understand more specific technical characteristics of Java. The description in this section introduces many terms programmers should learn.

    According to the information provided by Sun Microsystems (http://java.sun.com/), Java is a

    “ …simple, object-oriented, distributed, interpreted, robust, secure, architecture neutral, portable, high-performance, multithreaded, and dynamic language.”

    This characterization identifies the key technical features of Java as shown in the following sections.

    Simple

    The developers of Java based it on the C++ programming language, but removed many of the language features that are rarely used or often used poorly. C++ is a language for object-oriented programming and offers very powerful features. However, as is the case with many languages designed to have power, some features often cause problems. Programmers can create code that contains errors in logic or is incomprehensible to other programmers trying to read it. Because the majority of the cost of software engineering is often code maintenance rather than code creation, this shift to understandable code rather than powerful but poorly understood code can help reduce software costs. Specifically, Java differs from C++ (and C) in these ways:

    1. Java does not support the struct, union, and pointer data types.
    2. Java does not support typedef or #define.
    3. Java differs in its handling of certain operators and does not permit operatoroverloading.
    4. Java does not support multiple inheritance.
    5. Java handles command-line arguments differently than C or C++.
    6. Java has a String class as part of the java.lang package. This differs from the null-terminated array of characters as used in C and C++.
    7. Java has an automatic system for allocating and freeing memory (garbage collection), so it is unnecessary to use memory allocation and de-allocation functions as in C and C++.
    Object-Oriented

    Like C++, Java can support an object-oriented approach to writing software. Ideally, object-oriented design can permit the creation of software components that can be reused.

    Object-oriented programming is based upon modeling the world in terms of software components called objects. An object consists of data and operations that can be performed on that data called methods. These methods can encapsulate, or protect, an object’s data because programmers can create objects in which the methods are the only way to change the state of the data.

    Another quality of object-orientation is inheritance. Objects can use characteristics of other objects without having to reproduce the functionality in those objects that supports those characteristics. Inheritance thus helps in software re-use, because programmers can create methods that do a specific job exactly once.

    Another benefit of inheritance is software organization and understandability. By havingobjects organized according to classes, each object in a class inherits characteristics from parent objects. This makes the job of documenting, understanding, and benefiting from previous generations of software easier, because the functionality of the software has incrementally grown as more objects are created. Objects at the end of a long inheritance chain can be very specialized and powerful. Figure 2.5 summarizes the general qualities of data encapsulation, methods, and inheritance of an object-oriented language.

    Technically, Java’s object-oriented features are those of C++ with extensions from Objective C for dynamic method resolution.

    Distributed

    Unlike the languages C++ and C, Java is specifically designed to work within a networked environment. Java has a large library of classes for communicating using the Internet’s TCP/IP protocol suite, including protocols such as HTTP and FTP. Java code can manipulate resources via URLs as easily as programmers are used to accessing a local file system using C or C++.

    Interpreted

    When the Java compiler translates a Java class source file to bytecodes, this bytecode class file can be run on any machine that runs a Java interpreter or Java-enabled browser. This allows the Java code to be written independently of the users’ platforms. Interpretation also eliminates the compile and run cycle for the client because the bytecodes are not specific to a given machine but interpreted.

    Robust

    Robust software doesn’t “break” easily because of programming bugs or logic errors in it. A programming language that encourages robust software often places more restrictions on the programmer when he or she is writing the source code. These restrictions include those on data types and the use of pointers. The C programming language is notoriously lax in its checking of compatible data types during compilation and runtime. C++ was designed to be more strongly typed than C; however, C++ retains some of C’s approach toward typing. In Java, typing is more rigorous: a programmer cannot turn an arbitrary integer into a pointer by casting, for example. Also, Java does not support pointer arithmetic but has arrays instead. These simplifications eliminate some of the “tricks” that C programmers could use to access arbitrary areas of memory. In particular, Java does not allow the programmer to overwrite memory and corrupt other data through pointers. In contrast, a C programmer often can accidentally (or deliberately) overwrite or corrupt data.

    Secure

    Because Java works in networked environments, the issue of security is one that should be of concern to developers. Plans are in the works for Java to use public-key encryption techniques to authenticate data. In its present form, Java puts limits on pointers so that developers cannot forge access to memory where not permitted. These aspects of Java enable a more secure software environment. The last section of this chapter outlines the layers of Java’s security in more detail.

    Architecture Neutral

    The Java compiler creates bytecodes that are sent to the requesting browser and interpreted on the browser’s host machine, which has the Java interpreter or a Java-enabled browser installed.

    Portable

    The quality of being architecture neutral allows for a great deal of portability. However, another aspect of portability is how the hardware interprets arithmetic operations. In C and C++, source code may run slightly differently on different hardware platforms because of how these platforms implement arithmetic operations. In Java, this has been simplified. An integer type in Java, int, is a signed, two’s complement 32-bit integer. A real number, float, is always a 32-bit floating-point number defined by the IEEE 754 standard. These consistencies make it possible to have the assurance that any result on one computer with Java can be replicated on another.

    High-Performance

    Although Java bytecodes are interpreted, the performance sometimes isn’t as fast as direct compilation and execution on a particular hardware platform. Java compilation includes an option to translate the bytecodes into machine code for a particular hardware platform. This can give the same efficiency as a traditional compile and load process. According to Sun Microsystems testing, performance of this bytecode to machine code translation is “almost indistinguishable” from direct compilation from C or C++ programs.

    Multithreaded

    Java is a language that can be used to create applications in which several things happen at once. Based on a system of routines that allow for multiple “threads” of events based on C. A. R. Hoare’s monitor and condition paradigm, Java presents the programmer with a way to support real-time, interactive behavior in programs.

    Dynamic

    Unlike C++ code, which often requires complete recompilation if a parent class is changed, Java uses a method of interfaces to relieve this dependency. The result is that Java programs can allow for new methods and instance variables in objects in a library without affecting their dependent client objects.

  12. #12
    التسجيل
    03-08-2004
    الدولة
    تركيا
    المشاركات
    3,755

    مشاركة: SAMS PUBLISHING " JAVA UNLEASHED " VOL 1

    Java Software Components

    Another aspect of the technical make-up of the Java environment is the software components that comprise its environment. See the Sun Microsystems Java site (http://java.sun.com/) for complete details on obtaining the Java Developer’s Kit (JDK). Programmers need to learn the vocabulary of the pieces of the JDK as well as terms for what can be created with it.

    Java Language Constructs

    Java is the programming language used to develop executable, distributed applications for delivery to a Java-enabled browser or the Java Interpreter. A Java programmer can create the following:

    • applets: Programs that are referenced in HTML pages through the APPLET tag and displayed in a Java-enabled browser. The simple “hello world” program shown at the start of this chapter is an applet.
    • applications: Standalone programs written in Java and executed independently of a browser. This execution is done using the Java interpreter, java, included in the Java code distribution. The input and output of these applications need not be through the command line or text only. The HotJava browser itself is a Java application.
    • protocol handlers: Programs that are loaded into the user’s HotJava browser and interpret a protocol. These protocols include standard ones such as HTTP orprogrammer-defined protocols.
    • content handlers: A program loaded into the user’s HotJava browser, which interprets files of a type defined by the Java programmer. The Java programmer provides the necessary code for the user’s HotJava browser to display/interpret this special format.
    • native methods: Methods that are declared in a Java class but implemented in C. These native methods essentially allow a Java programmer to access C code from Java.
    Java Distribution Software

    The Java Development Kit available from Sun Microsystems includes the following pieces:

    • Java Applet Viewer. This lets you run and test applets without having to create an HTML page to refer to it. Note that the beta release of the JDK included an applet viewer instead of an updated HotJava browser.
    • Java Compiler. This is the software used to translate the human-readable Java source code to machine-readable bytecodes. The Java compiler is invoked using javac command.
    • Java Language Runtime. This is the environment for interpreting Java applications.
    • Java Debugger API and Prototype Debugger. This is a command-line debugger that uses this API.
    The Java Application Programming Interface (API)

    The Java Application Programming Interface (API) is a set of classes that are distributed with the JDK and which programmers can use in Java applications. The documentation of the API that is provided online is key reference material for Java programmers. The API consists of the packages in the Java language. The API documentation includes a list of

    • All packages. These include:
      java.applet
      java.awt
      java.awt.image
      java.awt.peer
      java.io
      java.lang
      java.net
      java.util
    • All classes in a package. At the package level, information available includes:
      Interfaces
      Classes
      Exceptions
    • Documentation on each class. This includes:
      Variables
      Constructors
      Methods
    The Java Virtual Machine Specification

    A document available from the Sun Microsystems Java site (http://java.sun.com/) called “The Java Virtual Machine,’ specifies how the Java language is designed to exchange executable content across networks. The aim of this specification is to describe Java as a non-proprietary, open language that may be implemented by many companies and sold as a package.

    The Java Virtual Machine specification describes in abstract terms how Java operates. This leaves the details of implementation up to the programmers who creates Java interpreters and compilers. The Java Virtual Machine specification also concretely defines the specific interchange format for Java code. This is called “The Java Interchange Specification.”

    The other part of the Virtual Machine specification defines the abstractions that can be left to the implementor. These abstractions are not related to the interchange of Java code. These include, for example, management of runtime data areas, garbage collection algorithms, the implementation of the compiler and other Java environment software, and optimization algorithms on compiled Java code.

    Java Security

    Because a HotJava browser downloads code across the network and then executes it on the user’s host, security is a major concern for Java-enabled browser users and Java programmers.

    HotJava includes several layers of security, including the following:

    • The Java language itself includes tight restrictions on memory access very different from the memory model used in the C language. These restrictions include removal of pointer arithmetic and removal of illegal cast operators.
    • A bytecode verification routine in the Java interpreter verifies that bytecodes don’t violate any language constructs (which might happen if an altered Java compiler were used). This verification routine checks to make sure the code doesn’t forge pointers, access restricted memory, or access objects other than according to their definition. This check also ensures that method calls include the correct number of arguments of the right type, and that there are no stack overflows.
    • A verification of class name and access restrictions during loading.
    • An interface security system that enforces security policies at many levels.
    • At the file access level, if a bytecode attempts to access a file to which it has no permissions, a dialog box will pop up enabling the user to continue or stop the execution.
    • At the network level, future releases will have facilities to use public-key encryption and other cryptographic techniques to verify the source of the code and its integrity after having passed through the network. This encryption technology will be the key to secure financial transactions across the network.
    • At runtime, information about the origin of the bytecode can be used to decide what that code can do. The security mechanism can tell if a bytecode originated from inside a firewall or not. You can set a security policy that restricts code that you don’t trust.
    Summary

    The Java programming language is uniquely designed to deliver executable content across networks. As a language, it flexibly offers features for programmers to create a variety of software. Java also assures interoperability among platforms as well as security:

    • The Java programming language works in conjunction with a special kind of browser and bytecode interpreter. Java can exist within the context of World Wide Web communication and therefore “sits on top of” a set of applications on networks for data communications to support information retrieval.
    • The Java language is object-oriented and specially designed to support distributed, executable applications.
    • In operation, the Java language compiler creates bytecodes that are downloaded across the network to a user’s computer. The user’s computer runs these bytecodes.
    • Components of Java software include the HotJava browser, the Java interpreter, the Java compiler, and tools for developing Java applications.
    • Java’s designs for security are tailored for distributing executable content on networks.

  13. #13
    التسجيل
    03-08-2004
    الدولة
    تركيا
    المشاركات
    3,755

    مشاركة: SAMS PUBLISHING " JAVA UNLEASHED " VOL 1

    Chapter 3

    Java Transforms the World Wide Web

    The World Wide Web has dramatically changed the online world and continues to grow in popularity. As a communication system, the Web can give information providers the ability to distribute and collect information globally and instantly. For users, the Web is a dynamic view into the works and ideas of millions of people and organizations worldwide. With origins in ideas about nonlinear thinking, the Web is an information integrator on the Internet and plays a major role in online cyberspace.

    What Java brings to the Web is a new way of communicating. Instead of relying on the Web servers to provide information and functionality, Java’s executable content makes Java-enabled Web browsers “smart.”

    This chapter briefly explores how Java transforms the World Wide Web. The Web supports a range of communication, information, and interaction using hypertext for organizing information. Multimedia used with hypertext, called hypermedia, can enrich the Web’s information. Special programming techniques used with the Web’s hypertext, such as gateway programming or languages such as Java or Virtual Reality Modeling Language, can expand the Web’s possibilities for interactivity, information delivery, and communication.

    To learn Java’s power as it can be used for the global distribution of information, you should first understand what the Web is and the significance of Java’s changes to it. If you are a seasoned Web user, you probably have already realized from the previous two chapters how Java extends the Web’s potential; you might want to skip to Chapter 4 to begin looking at specifics. This chapter takes a close look at the Web and Java’s part in it.

    Overview of the Web

    The World Wide Web was originally developed to meet the information needs of researchers in the high-energy physics community. Today, the World Wide Web offers a system for distributing hypermedia information locally or globally. Technically, the World Wide Web enables a seamless, global system of multimedia communication. This information is organized associatively and delivered according to user requests. This section briefly surveys the historical origins of the Web and how the confluence of ideas in network technology has reached fruition in the global Web of today. Java is just the latest installment of a series of innovations in hypertext and Web communication.

    Ideas Leading to the Web

    Vannevar Bush described a system for associatively linking information in his July 1945 article in The Atlantic Monthly, “As We May Think.” (This article is available on the Web at http://www.isg.sfu.ca/~duchier/misc/vbush/.)

    The Origins of Hypertext

    Bush called his system a memex (memory extension), and proposed it as a tool to help the human mind cope with information. Having observed that previous inventions had expanded human abilities for dealing with the physical world, Bush wanted his memex to expand human knowledge in a way that took advantage of the associative nature of human thought.

    In 1965, Ted Nelson coined the term hypertext to describe text that closely followed Bush’s model, in that Nelson’s text was not constrained to be sequential. Hypertext, as Nelson described, links documents to form a web of relationships that draw on the possibilities for extending and augmenting the meaning of a “flat” piece of text with links to other texts. Hypertext is more than just footnotes that serve as commentary or further information about a text; rather, hypertext extends the structure of ideas by making “chunks of” ideas or information available for inclusion in many parts of multiple texts. Nelson also coined the term hypermedia, which is hypertext not constrained to be text. Hypermedia can include expressions of multimedia—pictures, graphics, sound, and movies.

    The Origins of the Web

    Vannevar Bush’s and Ted Nelson’s ideas about information systems showed up in another project in the late 1980s. In March 1989, Tim Berners-Lee, a researcher at the Conseil European pour la Recherche Nucleaire (CERN) European Laboratory for Particle Physics in Geneva, Switzerland, proposed a hypertext system to enable efficient information-sharing for members of the high-energy physics community. Berners-Lee had a background in text processing, real-time software, and communications, and had previously developed a hypertext system he called “Enquire” in 1980. Berners-Lee’s 1989 proposal, called “HyperText and CERN,” circulated for comment. The following were important components of the proposal:

    • A user interface that would be consistent across all platforms and that would enable users to access information from many different computers
    • A scheme for this interface to access a variety of document types and information protocols
    • A provision for “universal access,” which would enable any user on the network to access any information
    By late 1990, an operating prototype of the World Wide Web ran on a NeXT computer, and a line-mode user interface (called “WWW”) was completed. The essential pieces of the Web were in place, although not widely available for network use.

    Throughout the early 1990s, interest in the Web grew and spread worldwide. In March 1991, the WWW interface was used on a local network, and by May of that year, it was made available on central CERN machines. On January 15, 1992, the WWW interface became publicly available from CERN, and the CERN team demonstrated the Web to researchers internationally throughout the rest of the year.

  14. #14
    التسجيل
    03-08-2004
    الدولة
    تركيا
    المشاركات
    3,755

    مشاركة: SAMS PUBLISHING " JAVA UNLEASHED " VOL 1

    Mosaic: The First “Killer” App

    In 1993, interest in the Web grew very rapidly. A young undergraduate who was then at the University of Illinois at Urbana-Champaign named Marc Andreessen worked on a project for the National Center for Supercomputing Applications (NCSA), and lead a team that developed a browser for the Web called Mosaic. The group released an alpha version of Mosaic for the X Window System in February 1993 that was among the first crop of graphical interfaces to the Web. Mosaic, with its fresh look and graphical interface presenting the Web using a point-and-click design, fueled great interest in the Web and online information. By the end of 1993, attendees at the Internet World conference and exposition in New York City were eager to learn about graphical interfaces to the Web. The New York Times hailed Mosaic as the Internet’s “killer application.”

    In 1994, more commercial players got into the Web game. Companies announced commercial versions of Web browser software, including Spry, Inc. Marc Andreessen and colleagues left NCSA in March to form, with Jim Clark (former chairman of Silicon Graphics), a company that later became known as Netscape Communications Corporation ( http://home.netscape.com/). By May 1994, interest in the Web was so intense that the first international conference on the World Wide Web, held in Geneva, overflowed with attendees. By June 1994, there were 1,500 known public Web servers.

    By mid-1994, it was clear to the original developers of the Web at CERN that the stable development of the Web should fall under the guidance of an international organization. In July, the Massachusetts Institute of Technology (MIT) and CERN announced the formation of the World Wide Web Consortium, or W3C.

    The Web Today

    Today, the W3C ( http://www.w3.org/hypertext/WWW/Consortium/) guides the technicaldevelopment and standards for the evolution of the Web. The W3C is a consortium of universities and private industries, run by the Laboratory for Computer Science (LCS) at MIT collaborating with CERN ( http://www.cern.ch/), and Institut National de Recherche en Informatique et en Automatique (INRIA), a French research institute in computer science (http://www.inria.fr/).

    In 1995, the development of the Web was marked by rapid commercialization and technical change. Netscape Communication’s Mozilla browser continued to include more extensions of the HyperText Markup Language (HTML), and issues of security for commercial cash transactions garnered much attention. By May 1995, there were more than 15,000 known public Web servers, a tenfold increase over the number from a year before. Many companies had joined the W3C by 1995, including among others, AT&T, Digital Equipment Corporation, Enterprise Integration Technologies, FTP Software, Hummingbird Communication, IBM, MCI, NCSA, Netscape Communications, Novell, Open Market, O’Reilly & Associates, Spyglass, and Sun Microsystems.

    By mid-1995, the emergence of the Java and Virtual Reality Modeling Language (VRML) technologies placed the Web at the start of another cycle of rapid change and alteration. Java, in development for several years at Sun Microsystems, promises to make the Web far more interactive than ever before possible. (See Chapter 1, “Java Makes Executable Content Possible.”) Virtual Reality Modeling Language, which can allow developers to model three-dimensional scenes for delivery through special Web browsers, may also dramatically change what the Web has to offer. For more information on VRML, see Chapter 34, “VRML and Java.”

    A Definition of the World Wide Web

    Despite its rapid growth and technical developments, the Web in 1996 retains the essential functional components it had in its 1990 form. Its popularity as a view of the Internet, however, has muddied popular understanding of it, because the Web is sometimes viewed as equivalent to the Internet and browsers are sometimes thought of as equivalent to the Web rather than a view into it. However, the Web is a very distinct system from the Internet and its browsers. First, the Web is not a network, but an application system (a set of software programs). Second, the World Wide Web can be deployed and used on many different kinds of networks (not necessarily just Internet networks) and it can even be used on no network at all or on a local network unconnected to any other.

    A METAPHOR FOR THE WEB</FONT>Imagine a library in which all the spines of the books have been removed and the gravity in the building has been turned off, allowing the pages to float freely. If people could connect one page to another using very light threads taped to the pages, this would be similar to the way the Web’s hypertext is arranged. Pages free-float, so that users might encounter a work from any page within it, and reach other works by following the threads leading off a page.

    Here is a more technical definition of the Web:

    The World Wide Web is a hypertext information and communicationsystem popularly used on the Internet computer network with data communications operating according to a client/server model. Web clients (browsers) can access multiprotocol and hypermedia information.

    Figure 3.1 summarizes the technical organization of the Web based on this definition.

    [img]file:///D:/Java%20Unleashed/figicon.gif[/img]FIGURE 3.1.



    The technical organization of the Web.

    How Does Java Transform the Web?

    Java changes the Web by bringing more “intelligence” to Web browsers. Although Java-enabled browsers have user interfaces that are much the same as many other Web browsers, their technical operation marks a significant shift in focus. Java’s executable content requires Java-enabled browsers to be smart; that is, they must be able to interpret executable content.

    Java Supports Client-Side Interactivity

    A client-server model for networked computer systems involves three components: the client, the server, and the network. A client is a software application that most often runs on the end-user’s computer host. A server is a software application that most often runs on the information provider’s computer host. Client software can be customized to the user’s hardware system and it acts as an interface from that system to information provided on the server. The user can initiate a request for information or action through the client software. This request travels over the network to the server. The server interprets the request and takes some desired action. This action might include a database lookup or a change in recorded database information. The results of the requested transaction (if any) are sent back to the client for display to the user. All client/server communication follows a set of rules, or protocols, which are defined for the client/server system. Figure 3.2 summarizes these relationships, showing the flow of a request from a client to a server and the passing back of information from a server to a client. A client might access many servers employing the protocols both the server and client understand.

    The distributed form of “request” and “serve” activities of the client/server model allows for many efficiencies. Because the client software interacts with the server according to a predefined protocol, the client software can be customized for the user’s particular computer host. (The server doesn’t have to worry about the hardware particularities of the client software.) Forexample, a Web client (a browser) can be developed for Macintosh computers that can access any Web server. This same Web server might be accessed by a Web browser written for a UNIX workstation running the X Window system. This makes it easier to develop information, because there is a clear demarcation of duties between the client and the server. Separate versions of the information need not be developed for any particular hardware platform, because the customizations necessary are written into client software for each platform. An analogy to the client/server model is the television broadcast system. A customer can buy any kind of television set (client) to view broadcasts from any over-the-air broadcast tower (server). Whether the user has a wristband TV or a projection screen TV, the set receives information from the broadcast station in a standard format and displays it appropriate to the user’s TV set. Separate TV programming need not be created for each kind of set, such as for color or black-and-white sets or different size sets. New television stations that are created will be able to send signals to all the currently in-use television sets.

  15. #15
    التسجيل
    03-08-2004
    الدولة
    تركيا
    المشاركات
    3,755

    مشاركة: SAMS PUBLISHING " JAVA UNLEASHED " VOL 1

    Java brings another dimension to the client/server model. Of course, Java does follow the basic model: A Java-enabled browser is a client that sends requests to Web servers for information. The Java-enabled browser interprets and displays the information sent from the server. This information includes both the hypertext as well as any bytecodes. These bytecodes are Java’s new twist on this model. The Java clients execute the content distributed from the servers. These bytecodes, as described in Chapter 2, are also architecture-neutral, just like the other information sent from the Web server.

    Java Can Eliminate the Need for Helper Applications

    Helper applications include software that a (non-Java-enabled) Web browser invokes to display multimedia information to the user. For example, in order for the user to view movies, the Web browser must have movie display software installed and available. To display inline graphical images in an HTML document, the Web browser must be graphical—that is, employ a system such as X Window system, Macintosh Operating System, or Microsoft Windows as a graphical user interface.

    Instead of relying on helper applications, programmers developing applets for Java-enabled browsers can create content handlers to handle media formats.

    http://Java Adds to the Web’s Commun... and Potential

    The Java language and its browsers are part of the larger context for communication on the Web. Whether you write and distribute applets or just observe them, you take part in communication activities and traditions that have been developing on the Web for many years. Because Java is still so new, it has not yet appeared in all Web communication contexts. You’ll see more specific examples of Java used on the Web in later chapters of this book. This subsection briefly reviews the Web’s context and potential and how Java can be a part of it.

    Java and Communication Contexts on the Web

    Communication on the Web can take many forms and take place in many contexts. Genres, or traditional ways for communicating, have evolved on the Web. These genres correspond, in many ways, to offline human communication contexts:

    • Interpersonal:The Web provides a way for users to create a home page, which typically conveys personal or professional information. The practice of creating a home page emerged from the technical necessity of defining the “default” page that a Web browser displays when requesting information from a Web server when only the host name or a host and directory name is given. Home pages are thus traditionally the top-level page for a server, organization, or individual. When created by individuals, home pages often reveal detailed personal information about their authors and are often listed in directories of home pages. Also, individuals often follow the tradition of linking to colleagues’ or friends’ pages, creating electronic tribes. (Mathematically, these electronic tribes are defined by the cliques of home pages in the directed graph describing the Web.) When used interpersonally, personal home pages offer one-to-one communication, although the technical operation of all pages on the Web is one-to-many.
    • “applets” have not yet become prominent, but Java may enable individuals to create an executable “persona” with which other Web users can interact.
    • Group: As described in the interpersonal definition, cliques of personal pages can define a particular Web tribe or group. Similarly, people can form associations on the Web that are independent of geography and focused on interest in a common topic. Subject-tree breakdowns of information on the Web often evolve from collaborative linking and the development of resource lists and original material describing a subject. (See the following section’s discussion about locating subject-based information on the Web.) Similarly, groups of people associate on the Web based on common interests in communication.
    • Organizational: Many of the initial Web servers appearing on the Web belong to an organization, not individuals, so the home page for a server often identifies the institution or organization that owns the server. In this way, the genre of the Campus-Wide Information System (CWIS) evolved on Web servers of educational institutions. Similarly, commercial, governmental, and non-governmental organizations have followed the pattern established by CWISs to a large degree.
    • organizations now use Java in their Web pages to add interest and provide service to users. You will see examples of these pages in the next chapter.
    • Mass: Just as other media have been used for one-to-many dissemination of information (newspapers, radio, television), so too is the Web used for mass communication. Many commercial and non-commercial magazines and other publications are distributed through the Web. Moreover, as noted previously, all publicly available Web pages are potentially readable to anyone using the Web, and are thus potentially one-to-many communication.
    • is being used actively for mass communication, as shown in the example from the Nando Times in Chapter 1.
    The key concept to understand is that the Web as a communication system can be flexibly used to communicate in a variety of ways. The classification of the communication (in the categories listed) depends on who is taking part in the communication. The exact classification of any expression on the Web can be blurred by the potentially global reach of any Web page. Thus, a personal home page may be used interpersonally, but it may be accessed far more times on the Web than a publication created and intended for mass consumption. Java’s capability for delivering interactive content adds new possibilities to each of these categories.

    Java and the Web’s Potential

    The Web is a flexible system for communication that can be used in many contexts, ranging from individual communication on home pages through group communication and mass communication. In addition to these contexts, the Web also serves the following functions:

    • Information Delivery: A Web browser provides the user with a “viewer” to look into FTP space, Gopherspace, or hypertext information on the Web. The structure of hypertext enables user selectivity because of the many ways a user can choose to follow links in hypertext. Java adds the potential for new protocol handlers and content handlers.
    • Communication: People can use Web hypertext to create forums for sharing information, discussion, and helping group members make contact with each other. Java’s executable content introduces new forms of more interactive communication.
    • Interaction: Using gateway programming, a Web developer can build some degree of interactivity into an application, providing the user with a way to receive customized information based on queries. Gateway programs can also enable a user to change or add to an information structure. A higher degree of interactivity is possible using Java because of its executable content. (Chapter 1 surveys Java’s unique contribution to the Web’s interactivity.)
    • Computation: Using gateway programming, the Web can be used to provide an interface to other applications and programs for information processing. Based on user selections, a Web application can return a computed or customized result through a gateway program. Java programmers can create software for computation that can be distributed and executed.
    Figure 3.3 shows the important distinction between selectivity and gateway programming interactivity. When the user accesses the Web server on the left, content is presented using hypertext. The links in the hypertext pages give the user a great deal of choice, or selectivity, for encountering information in the database. However, no information is customized to user inputs or computed based on user requests. Although this server offers the user great flexibility in information retrieval because of the hypertext design of its pages, this server is not interactive.

    The key to the level of interactivity, as shown in the server on the right, is that the executable program accepts input from the user through a Web page. Based on these user inputs, this executable can compute a result and (possibly, also using information from the database) return this customized information result to the user. Moreover, the executable program also enables the user to (possibly) change the contents of the database, or make some other change in the database or files on the server. These changes might include altering the structure or contents of hypertext or the contents of other files. The construction of this executable program requires skills in gateway programming.

    Java adds still another level of interactivity. Instead of the server computing a result, the Java-enabled browser is the mechanism for computation.

    [img]file:///D:/Java%20Unleashed/figicon.gif[/img]FIGURE 3.3.



    Web selectivity and gateway interactivity.

    Summary

    • The Web emerged from ideas about the associative, nonlinear organization of information. Java is another step in this evolution.
    • The Web is a hypertext information and communication system popularly used on the Internet in a client/server model, offering hypermedia display capabilities through appropriate browsers, some of which require helper applications.
    • Java-enabled browsers bring client-side interactivity and computation to the Web and can eliminate the need for helper applications.
    • Communication on the Web can assume many forms and take place in many contexts, ranging from individual communication to group and mass communication. Java can potentially augment the Web’s communication contexts and functions.

صفحة 1 من 3 123 الأخيرةالأخيرة

ضوابط المشاركة

  • لا تستطيع إضافة مواضيع جديدة
  • لا تستطيع الرد على المواضيع
  • لا تستطيع إرفاق ملفات
  • لا تستطيع تعديل مشاركاتك
  •