Web
Programming
Unleashed
Bob Breedlove, et al.
CONTENTS
Chapter
1
An Overview of Internet Programming
A Short History of the Internet
The TCP/IP Protocol Model
The Network Layer
The Transport Layer
The Application Layer
Telnet
File Transfer Protocol (FTP)
Trivial File Transfer Protocol (TFTP)
Simple Mail Transfer Protocol (SMTP)
Network News Transfer Protocol (NNTP)
Gopher Protocol
HyperText Transfer Protocol
Multipurpose Internet Mail Extension
LAN Topologies
Ethernet LANs
Token Ring Topology
Repeaters, Bridges, and Routers
Internetworking-Linking LANs Together
Point-to-Point Links
SLIP and PPP
X.25 Links
Frame Relay Links
Integrated Digital Service Network (ISDN) Links
Asynchronous Transfer Mode Links
Routing in an Internetwork
IP Addresses and Domain Names
What Is an IP Address?
Special IP Addresses
Resolving Names to Addresses
The Client/Server Model
Sockets and Socket APIs
Applications, Plug-Ins, and Applets
Summary
Chapter
2
WWW Design Issues
You Don't Own the Resources
The Internet-More Concept than Reality
Router Tables: The Internet "Glue"
Domain Name Service: Helping the Humans Understand
Client/Server Tools
Internet Design Considerations
You Don't Make the Rules
The Resources Can Be Unreliable
Transaction Timing Is Unpredictable
Designing Your Application
Design the Complete Application
Determine Which Components Will Be Internet-Based
Public Interface Components
Multiple End-User Platform Requirements
Timing Issues
Connectionless Protocols: E-Mail
The Internet Can Be Unreliable and Can Change Without Notice
Design an Alternative Delivery Mechanism
Detecting and Reporting Failures
Dealing with Disasters
Security
Passing Through Multiple Machines
Anyone with a Scope
E-Mail Example
Encryption
Secure Web Servers
Encrypting Sensitive Information
Encrypting or Password-Protecting Documents
Unsecure Request, Secure Response
Verifying the Correct Client
International Considerations
I Don't Think We're in Kansas Anymore
Non-English Speakers
Other Cultures
Addresses and Phone Numbers
Dates and Number Formatting
Time Zones
Summary
Chapter
3
Security and Encryption
Security
General Internet Security
Web Security
General Programming Security
Java Security
JavaScript Security
VBScript Security
CGI Security
Firewalls
Types of Firewalls
Building Your Own Firewall
Bastion Hosts
Packet Filters
Proxy Gateways
Encryption and Digital Signatures
Legal Issues
Private Key Encryption
Public Key Encryption
SSL
S-HTTP
Shen
S/MIME
GSS-API
SET
Summary
Chapter
4
Developing Intranet Applications
The Purpose of Intranet Applications
You Own the Resources-Or Do You?
The Growth of Intranets
Application Scope
Capacity Planning
Leveraging Existing Resources
Security
Protecting Confidential Material
Security Versus Availability
Change Passwords Periodically
Dealing with Corporate Control Organizations
Network Naming and Addressing
Router Operations
Corporate Standards
LAN Groups at the Local Level
Accessing Mainframe Data
Data Mirroring
Screen Scraping
Intranet Style Guide
Web Page Organization
Navigation
Page Organization
Page Design
Use of Graphics
Summary
Chapter
5
Java and the Internet
Java History
Java's Place in the Object-Oriented Continuum
Defining Java
Java Applet Definition
The Benefits of Java
Java Is Object-Oriented
Java Is Multithreaded
Java Is Dynamic
Java Is Compacted
Java Is Marked and Swept
Java Is Processor-Independent
Java Is Verified
Java Is a Multiplatform Environment
The Negatives of Java
Summary
Chapter
6
Java Development Environments
Java Development Environments
The Java Developer's Kit (JDK)
How To Use the Java Developer's Kit
The
..\java\bin
Directory
Java Development Kit Closing Comments
Symantec Café
Installing Symantec Café
Café Desktop
Symantec Café and the Appletviewer
Symantec Café Closing Comments
The Borland Internet Products
Borland Latte
Borland C++ 5.0
The Borland Internet Products Closing Comments
The Java Workshop
Java Workshop Closing Comments
Summary
Chapter
7
Introduction to Java
Classes, Methods, Inheritance, and Method Overriding-The Discussion
Classes
Methods
Inheritance
Method Overriding
Classes, Methods, Inheritance, and Method Overriding-The Workshop
Method Overloading-The Discussion
Method Overloading-The Workshop
Interfaces-The Discussion
Interfaces-The Workshop
Introduction to Java Structure
Primitive Data Types
Booleans-The Discussion
Booleans-The Workshop
Integer Types
Character Literal
Float and Double
Casting
Casting Between Objects
Operators
Arithmetic Operators
Assignment Operators
Comparison, Logical, Incremental, and Decremental Operators
Bitwise Operators
Ternary Operator
Operator Precedence
Control Flow
The
if
Conditional
The
while
Loops
The
for
Loop
The
switch
Conditional
Scope
Arrays-The Discussion
Arrays-The Workshop
Summary
Chapter
8
Java Programming
Java Applets
Java Applet Example
HTML Tags for Java Applets
appletviewer
Applets (
java.applet.Applet
)
The Applet Life Cycle Discussion
The Applet Life Cycle Workshop
The
Logo
Version 1.0
Fonts, FontMetrics, and Colors
Animation
Animation in the PC Industry
Animation Workshop
A Summary of
anilogo
Optimizing Animation
UI and Java
Command Buttons
Check Boxes
Choice
Labels
Lists
Scrollbars
Text Fields
Text Areas
Putting Components in Containers
The UI and Java Workshop, Win Version 1.0
Frames
Frames Workshop
Summary
Chapter
9
Visual J++: Tools for the Internet and the Desktop
Introduction To Visual J++
Java + COM = First Class Citizen
Microsoft's Component Object Model (COM) and ActiveX
The Birth of ActiveX: An Overview of COM and OLE
OLE 1.0
OLE 2.0
ActiveX: Activating the Internet
Comparing Java and COM
Java and COM: Some Differences
Java and COM: Surprising Similarities
Advantages and Disadvantages: A Close Look at Java and ActiveX
Summary
Chapter
10
Extending Java Using ActiveX
The ActiveX Advantages
High Performance
Persistence
Huge Existing Code Base
Language Independence
Distributed
The Flip Side: ActiveX's Disadvantages
Platform-Dependent
Security Model
Network Performance
Browser-Dependent
What Does This Mean for the Web Developer?
ActiveX and the Intranet
ActiveX and the Internet
Combining Java and COM Using Visual J++
Summary
Chapter
11
Perl and the Internet
What Is CGI and What Can It Do?
Terminology
What Are the Benefits of Using CGI?
What Are the Negatives of Using CGI?
The Protocols
Environment Variables
Getting Information from the Server
Getting Form Data
Returning Information to the Client
Chapter
12
CGI and the Internet
Pseudo Code
The CGI Program
Initialization
Determining the Request Method
Sending the Form
Receiving Information from the User
System Processing
Sending a Reply to the User
Summary
Chapter
13
Using CGI in Internet Applications
What Is Perl?
What Are the Benefits of Using Perl?
Cost and Licensing
Availability
Interpreted Language
Language Capabilities
Use C Libraries
Specialized Extensions to Perl
Socket Capability
Perl Is Relatively Easy to Learn
Perl Has Built-In Debugging Facilities
Perl Help Is Readily Available
Perl Examples Are Readily Available
What Are the Negatives of Using Perl?
Interpreted Language
GNU CopyLeft License Agreement
What Can Perl Do?
CGI Scripts
Mail Processing
Automating Web Site Maintenance
Automating File Retrieval
Is Perl for You?
Chapter
14
The Perl Language
About the Perl Chapters
Writing Perl Scripts
Executing Perl Scripts
Perl Style
Perl Data Types
Perl Variable Naming Conventions
Scalar Values
Predefined Variables
Perl Syntax
Comments-Documenting the Script
Declarations
Simple Statements
Compound Statements
Loop Control
For
Loops
Foreach
Loops
Blocks
Goto
Perl Operators
Terms and List Operators (Leftward)
The Arrow Operator
Autoincrement and Autodecrement
Exponentiation
Symbolic Unary Operators
Binding Operators
Perl Built-In Functions
Perl Functions By Category
Alphabetical Listing of Perl Functions
Perl Regular Expressions
Regular Expressions
Perl Subroutines
Private Variables via
my()
Temporary Values via
local()
Passing Symbol Table Entries (
typeglob
s)
Pass By Reference
Prototypes
Overriding Built-In Functions
What's Next?
Summary
Chapter
15
Perl in Internet Applications
A CGI Shell
"Hello World" Interactive
Programming the GO Application
The GO Application
go.cgi
: The Heart of the GO Application
GET
Method
Printing Categories
Printing URLs
Handling Forms
Finalization Section
postlink.pl
: The Index Posting Program
Implementing PostLink
Initialization
Main Processing
The
From:
Line
Process the Message
Writing the Index Files
Security: Checking the
From:
Line
Finalization Section
Utility Programs
SetIndex
: Creating Link Files
SortIndex
: Sorting the Index Files
Summary
Chapter
16
Microsoft Implementation Approach
Communications Technology Background
Networks
Client/Server Systems
Modems
Overview of Windows Communications
Tools of the Trade
Windows Sockets (WinSock)
The Win32 Internet (WinInet) API
Microsoft's Internet Client/Server Architecture
The Internet Server API (ISAPI)
ActiveX Controls
The Messaging API (MAPI)
Internet Security Through Code Signing
Addressing Security Issues
Signing Your Code
Considering the Cash Factor
Summary
Chapter
17
Using the Win32 Internet (WinInet) API
Overview
Introducing the WinInet API
Advantages of Using the WinInet API
Handles and Functions
General-Purpose Internet Functions
What Is File Transfer Protocol (FTP)?
WinInet FTP Functions
The Gopher
WinInet Gopher Functions
HyperText Transfer Protocol (HTTP)
WinInet HTTP Functions
Sample Program: RAWHTML.EXE
The
CRawHtmlApp
Class
The
CRawHtmlDlg
Dialog Class Header (
HTMLDLG.H
)
The
CRawHtmlDlg
Dialog Class Implementation (
HTMLDLG.CPP
)
Initializing a WinInet Session
Getting a Protocol Handle
Opening the Desired File
Querying for Information
Reading the File Data
Summary
Chapter
18
JavaScript and the Internet
What Is JavaScript?
The Client-Side Features of JavaScript
Java Versus JavaScript
New Features of JavaScript in Netscape Navigator 3.0
The Server Side of JavaScript
When To Use JavaScript
The Limitations of JavaScript
Summary
Chapter
19
The JavaScript Language
Embedding JavaScript in HTML
Using the
<SCRIPT>
Tag
Handling Events
Variables and Literals
Defining Variables
Scope of Variables
Literally Literals
Expressions and Operators
Assignment Operators
Arithmetic Operators
Bitwise Operators
Logical Operators
Comparison Operators
String Operators
Order of Precedence
Control Statements and Functions
Conditional Statements
Loop Statements
Comments
Fundamentals of Objects
Objects and Their Properties
Defining Methods
Working with Objects
Creating New Objects
Defining Arrays
Built-In Objects and Functions
The
String
Object
The
Math
Object
The
Date
Object
Built-In Functions
Netscape Objects
The Navigator Object Hierarchy
The Importance of HTML Layout
The
Window
Object
The
location
Object
The
History
Object
The
document
Object
The
Form
Object
Event Handlers
The
forms
Array
Form
Object Methods
The
element
Objects
The
element
Methods
Windows and Frames
The
Window
Object Properties
The
Window
Object Methods
Dividing the Window into Frames
Summary
Chapter
20
JavaScript in Internet Applications
A Forms Example
A Windows Example
A Frames Example
Reading the Cookie File
Resources on the Web
Summary
Chapter
21
VBScript and the Internet
What Is VBScript?
What Can VBScript Do?
Learning VBScript
Security and VBScript
VBScript Versus Visual Basic and Visual Basic for Applications
How VBScript Enhances Browsers and HTML
Host Environments
Web Browsers
Other Internet Tools
Placing VBScript Code Within an HTML Document
Summary
Chapter
22
The VBScript Language
All About Variables
Creating Variables
The Contents of Variables
How Variables Are Stored
Constants
The Scope and Lifetime of a Variable
Arrays
Using Operators
Arithmetic Operators
Comparison Operators
Logical Operators
String Concatenation
Operator Precedence
Intrinsic Functions
Dates and Times
Advanced Math
The
MsgBox
Function
Input Boxes
Controlling the Flow of Code
Using Control Structures To Make Decisions
The
Select Case
Structure
Using Control Structures To Make Code Repeat
Building a Home for Your Code
Subroutines
Functions
Passing Arguments into Procedures
Event Procedures
Method Procedures
Where To Put Procedures
Intrinsic HTML Form Controls
An Introduction To HTML Forms
The Button Control
The Text Control
Using Objects and ActiveX Controls
ActiveX Controls
Summary
Chapter
23
VBScript Application Pages
Metric Conversion Application
Interactive Tutorial Application
Pace-Pal Application
Information Submittal Application
The Advantage of Validating Server-Bound Data
Browser Objects
Summary
Chapter
24
CGI Scripting with the UNIX Shell
How CGI Scripts Work, a Redux
Local Time and Who's Logged In
The Environment Wrapped Up in the CGI Transmission
Pages Based on Browser Software
Checking the Host Domain
How Fast Is Your Connection?
Remote
ping
A Form Front End
Another Example:
finger
Another Script Trick: Redirection
Summary
Chapter
25
HyperText Markup Language (HTML)
Body and Text Commands
The Basics: What Every HTML Document Needs
Basic Paragraph Text Tags
Text Styles
Color Values
Hyperlinks
Images
HTML Interactions and Enhancements
Forms
Tables
Multimedia: Audio, Video, Applications
Frames
Summary
Chapter
26
SGML
The Problem
The Solution
Standards
Portability
Form and Structure
Authoring Systems
Instance Components
Elements
Minimization
Attributes
Advantages of Structured Markup
Document Type Declaration
Coming Together-The SGML Authoring System
The Future of SGML
Chapter
27
Netscape Extensions
Trouble in Paradise
Structuring Netscape HTML
The
<HEAD>
Element
The
<BODY>
Element
Formatting, Paragraphing, and Other Wonders
Text Gone Haywire
You've Been Enlisted
Rulers of the Web
Images and Imagination
Image Sizing
Border Patrol and
Lebensraum
Image Mapping Made Easy
Tables and Their Possibilities
You've Been Framed
Aiming for a Window
JavaScript and Java
Miscellaneous
Summary
Chapter
28
Microsoft Internet Explorer-Only HTML Tags
The
<BODY>
of the Page
<BODY BACKGROUND= BGPROPERTIES=>
<BODY BGSOUND SRC=>
Paragraph and Text Style Tags
<STYLE> : </STYLE>
Using
<STYLE>
Attributes for an Entire Document
Using an External
<STYLE>
Sheet
Color Values
Tables
<TABLE>
<TD>
Multimedia: Audio, Video, Applications
<BGSOUND>
<MARQUEE> : </MARQUEE>
Frames and Floating Frames
<FRAMESET>
Floating Frames
Summary
Chapter
29
Shockwave and Lingo
What Is Shockwave?
System Requirements
Shockwave
Shockwave for Director (4.0
x
and 5)
Afterburner
Adding a Shocked Movie to an HTML Document
Broken Icons
JavaScript
Multiple Movies
Multiple Movies Utilizing Sound
Looping
Asynchronous Operations
Functions
Other Lingo Extensions
Director Commands Disabled for Shockwave
XObjects
,
XCMDs
,
XFCNs
Disabled Director 5 Commands
Work Arounds for Other Director-Disabled Features
Director Bandwidth Issues
Shockwave for Authorware
Afterburner
Using Afterburner for Authorware
Editing Map Files
The Elements of a Map File
Editing Map Files in Windows
Editing a Map File on a Mac
Allowing Windows and Macs to Share External Files
Speeding Up Mac and Cross-Platform Files
Using Transition
Xtras
Combining Windows and Mac Map Files
Referencing Files in Multiple Locations
Authorware Bandwidth Issues
New Shockwave-Specific Functions and Variables
Existing Authorware Functions
System Security
Invoking Security
The Security Dialog Box
Integrating Authorware into Browsers
Displaying an Alternate Image on Noncompatible Browsers
Shockwave for Freehand
Obtaining Shockwave and URL Managers
Embedding a Freehand Graphic on an HTML Page
The
EMBED
Tag
TOOLBAR
Activating a Link in Netscape
The URL
Xtra
Adding a URL
Attaching the URL to an Object
Editing, Copying, and Deleting URLs
Finding URL Associations
Afterburner for Freehand
Opening Compressed Graphics in Freehand
Using Fonts
Features Disabled for Shockwave for Freehand
Configuring Servers
UNIX
Mac
Webstar
Summary
Chapter
30
Creating an ActiveX Control To Activate a Web Page
Overview of ActiveX Controls
The OLE Controls 96 Specification
A Sample ActiveX Control:
JIGGLER.OCX
Creating an OLE Control Skeleton
Testing the Skeleton Control
Adding Functionality to the Skeleton
Customizing the Project Resources
The Property Page Dialog Resource
The
CJigglerCtrl
Class
The
CJigglerCtrl
Class Interface (
JIGGLERC.H
)
Implementing the
CJigglerCtrl
Class
The
CJigglerPropPage
Class
Testing the Control in the OLE Control Test Container
Using the New Control on a Sample Web Page
Creating a Simple HTML Web Page
Adding the
JIGGLER
Control to the Web Page
Programming the
JIGGLER
Control with VBScript
Summary
Chapter
31
VDOlive Technology
Finding Out How VDOlive Works
Installing a VDOlive Player
Installing a VDOlive Server
Creating Video Clips
Linking Video on WWW Pages
Watching Video Clips Over the Internet
Resources
Chapter
32
Creating Netscape Navigator Plug-Ins
Plug-In Design and Architecture
How It All Fits Together
LiveConnect
Runtime Loading
Plug-In Instances and Instance Data
Windows and Events
Seamless Web Page Embedding
Data Streams
Assisted Installation
Netscape's SDK
Navigator Plug-In Design Considerations
Choosing a Development Language
Navigator Version Compatibility
Planning for Bandwidth Limitations
Multiplatform Compatibility
Expanding To Java with LiveConnect
HTML
EMBED
Tag Attributes
Multiple MIME Types
MIME Contention
File Base Versus Streaming Plug-Ins
Streaming to the Navigator
Client Server Design
The Plug-In API
Who Is Calling Whom?
NP_Shutdown
A Quick Look at the Plug-In API Methods
Summary
Chapter
33
Pulling Web Information
What Do You Call "It?"
Evolving Capabilities
The PointCast Network (PCN)
Features and More Features
Pros of PCN
Cons of PCN
Freeloader, Inc.
The Toolbar
Channels and Subscriptions
Smarter Screen Saver
A Time Saver
Content
Pros of Freeloader
Cons of Freeloader
Zippo
Is Zippo the Same as Excite or PointCast?
How To Use Zippo's Direct Read News
Pros of Zippo
Cons of Zippo
My Yahoo!
The Personals
Pros of My Yahoo!
Cons of My Yahoo!
Instant Online News (ION) for 95
Another Ticker Tape?
Personal Excite
Event Reminders
Has More Than One Person Used Your Computer?
Pros of Personal Excite
Cons of Personal Excite
Personal NewsPage Direct from Netcom
Pros of Netcom's NewsPage Direct
Cons of Netcom's NewsPage Direct
The Rest of Them
MSNBC Personal News Page
c|net: The Community Network
Infoseek Personal
Intel
ZD Net Personal View
Timecast and RealAudio Player Plus
Introducing Timecast: The RealAudio Guide
RealAudio Plus
Our Friends from Yesterday-Usenet's Beginnings
Where Are We Headed Next?
Chapter
34
International Considerations
Marketing Today
Marketing Changes
International Concerns
Defining an International Web Site
Who's Speaking What?
Your Competitive Advantages
Multilingual Web Browsers and Other Tools