Home > Store > Programming > Java

Java™ Network Programming and Distributed Computing

Register your product to gain access to bonus material or receive a coupon.

Java™ Network Programming and Distributed Computing

Book

  • Your Price: $39.99
  • List Price: $49.99
  • Usually ships in 24 hours.

Description

  • Copyright 2002
  • Dimensions: 7-3/8x9-1/4
  • Pages: 496
  • Edition: 1st
  • Book
  • ISBN-10: 0-201-71037-4
  • ISBN-13: 978-0-201-71037-3

Java™ Network Programming and Distributed Computing is an accessible introduction to the changing face of networking theory, Java™ technology, and the fundamental elements of the Java networking API. With the explosive growth of the Internet, Web applications, and Web services, the majority of today’s programs and applications require some form of networking. Because it was created with extensive networking features, the Java programming language is uniquely suited for network programming and distributed computing.

Whether you are a Java devotee who needs a solid working knowledge of network programming or a network programmer needing to apply your existing skills to Java, this how-to guide is the one book you will want to keep close at hand. You will learn the basic concepts involved with networking and the practical application of the skills necessary to be an effective Java network programmer. An accelerated guide to networking API, Java™ Network Programming and Distributed Computing also serves as a comprehensive, example-rich reference.

You will learn to maximize the API structure through in-depth coverage of:

  • The architecture of the Internet and TCP/IP
  • Java’s input/output system
  • How to write to clients and servers using the User Datagram Protocol (UDP) and TCP
  • The advantages of multi-threaded applications
  • How to implement network protocols and see examples of client/server implementations
  • HTTP and how to write server-side Java applications for the Web
  • Distributed computing technologies such as Remote Method Invocation (RMI) and CORBA
  • How to access e-mail using the extensive and powerful JavaMail™ API
  • This book’s coverage of advanced topics such as input/output streaming and multi-threading allows even the most experienced Java developers to sharpen their skills. Java™ Network Programming and Distributed Computing will get you up-to-speed with network programming today; helping you employ innovative techniques in your own software development projects.

    The companion Web site, http://www.davidreilly.com/jnpbook, offers downloadable source code, a list of FAQs about Java networking, and useful links to networking resources.



    0201710374B03012002

    Sample Content

    Online Sample Chapter

    Transmission Control Protocol and Java

    Table of Contents



    Preface.


    Acknowledgments.


    1. Networking Theory.

    What Is a Network?

    How Do Networks Communicate?

    Communication across Layers.

    Advantages of Layering.

    Internet Architecture.

    Internet Application Protocols.

    TCP/IP Protocol Suite Layers.

    Security Issues: Firewalls and Proxy Servers.

    Summary.



    2. Java Overview.

    What Is Java?

    The Java Programming Language.

    The Java Platform.

    The Java Application Program Interface.

    Java Networking Considerations.

    Applications of Java Network Programming.

    Java Language Issues.

    System Properties.

    Development Tools.

    Summary.



    3. Internet Addressing.

    Local Area Network Addresses.

    Internet Protocol Addresses.

    Beyond IP Addresses: The Domain Name System.

    Internet Addressing with Java.

    Summary.



    4. Data Streams.

    Overview.

    How Streams Work.

    Filter Streams.

    Readers and Writers.

    Object Persistence and Object Serialization.

    Summary.



    5. User Datagram Protocol.

    Overview.

    DatagramPacket Class.

    DatagramSocket Class.

    Listening for UDP Packets.

    Sending UDP Packets.

    User Datagram Protocol Example.

    Building a UDP Client/Server.

    Additional Information on UDP.

    Summary.



    6. Transmission Control Protocol.

    Overview.

    TCP and the Client/Server Paradigm.

    TCP Sockets and Java.

    Socket Class.

    Creating a TCP Client.

    ServerSocket Class.

    Creating a TCP Server.

    Exception Handling: Socket Specific Exceptions.

    Summary.



    7. Multi-threaded Applications.

    Overview.

    Multi-threading in Java.

    Synchronization.

    Interthread Communication.

    Thread Groups.

    Thread Priorities.

    Summary.



    8. Implementing Application Protocols.

    Overview.

    Application Protocol Specifications.

    Application Protocols Implementation.

    Summary.



    9. HyperText Transfer Protocol.

    Overview.

    HTTP and Java.

    The Common Gateway Interface (CGI).

    Summary.



    10. Java Servlets.

    Overview.

    How Servlets Work.

    Using Servlets.

    Running Servlets.

    Writing a Simple Servlet.

    SingleThreadModel.

    ServletRequest and HttpServletRequest.

    ServletResponse and Http Response.

    ServletConfig.

    ServletContext.

    Servlet Exceptions.

    Cookies.

    HTTP Session Management in Servlets.

    Summary.



    11. Remote Method Invocation (RMI).

    Overview.

    How Does Remote Method Invocation Work?

    Defining an RMI Service Interface.

    Implementing an RMI Service Interface.

    Creating Stub and Skeleton Classes.

    Creating an RMI Server.

    Creating an RMI Client.

    Running the RMI System.

    Remote Method Invocation Packages and Classes.

    Remote Method Invocation Deployment Issues.

    Using Remote Method Invocation to Implement Callbacks.

    Remote Object Activation.

    Summary.



    12. Java IDL and CORBA.

    Overview.

    Architectural View of CORBA.

    Interface Definition Language (IDL).

    From IDL to Java.

    Summary.



    13. JavaMail.

    Overview.

    Installing the JavaMail API.

    Testing the JavaMail Installation.

    Working with the JavaMail API.

    Advanced Messaging with JavaMail.

    Summary.



    Index. 0201710374T03292002

    Preface

    Welcome to Java Network Programming and Distributed Computing. The goal of this book is to introduce and explain the basic concepts of networking and discuss the practical aspects of Java network programming.

    This book will help readers get up to speed with network programming and employ the techniques learned in software development. If you’ve had some networking experience in another language and want to apply your existing skills to Java, you’ll find the book to be an accelerated guide and a comprehensive reference to the networking API. This book does not require you to be a networking guru, however, as Chapters 1–4 provide a gentle introduction to networking theory, Java, and the most basic elements of the Java networking API. In later chapters, the Java API is covered in greater detail, with a discussion supplementing the documentation that Sun Microsystems provides as a reference.

    What You’ll Learn

    In this book, readers will learn how to write applications in Java that make use of network programming. The Java API provides many ways to communicate over the Internet, from sending packets and streams of data to employing higher-level application protocols such as HTTP and distributed computing mechanisms.Along the way, you’ll read about:

  • How the Internet works, its architecture and the TCP/IP protocol stack
  • The Java programming language, including a refresher course on topics such as exception handling
  • Java’s input/output system and how it works
  • How to write clients and servers using the User Datagram Protocol (UDP) and the Transport Control Protocol (TCP)
  • The advantages of multi-threaded applications, which allow network applications to perform multiple tasks concurrently
  • How to implement network protocols, including examples of client/server implementations
  • The HyperText Transfer Protocol (HTTP) and how to access the World Wide Web using Java
  • How to write server-side Java applications for the WWW
  • Distributed computing technologies including remote method invocation (RMI) and CORBA
  • How to access e-mail using the extensive JavaMail API
  • What You’ll Need

    A reasonable familiarity with Java programming is required to get the most out of this book. You’ll need to be able to compile and run Java applications and to understand basic concepts such as classes, objects, and the Java API. However, you don’t need to be an expert with respect to the more advanced topics covered herein, such as I/O streams and multi-threading. All examples use a text interface, so there’s no need to have GUI experience.

    You’ll also need to install the Java SDK, available for free from Sun Micro-systems (http://java.sun.com/j2se/). Java programmers will no doubt already have access to the SDK, but readers should be aware that some examples in this text will require JDK 1.1, and the advanced sections on servlets, RMI and CORBA, and JavaMail will require Java 2.

    A minimal amount of additional software is required, and most of the tools for Java programming are available for free and downloadable via the WWW. Chapter 2 includes an overview of Java development tools, but readers can also use their existing code editor. Readers will be advised when examples feature additional Sun Microsystems software.

    Companion Web SiteAs a companion to the material covered in this book, the book’s Web site offers the source code in downloadable form (no need to wear out your fingers!), as well as a list of Frequently Asked Questions about Java Networking, links to networking resources, and additional information about the book. The site can be found at http://www.davidreilly.com/jnpbook/.Contacting the Authors

    We welcome feedback from readers, be it comments on specific chapters or sections or an evaluation of the book as a whole. In particular, reader input about whether topics were clearly conveyed and sufficiently comprehensive would be appreciated. While we’d love to receive only praise, honest opinions are valued (as well as suggestions about coverage of new networking topics).

    Feel free to contact us directly. While we can’t guarantee an individual reply, we’ll do our best to respond to your query. Please send questions and feedback via e-mail to: jnpbook@davidreilly.com.

    David Reilly and Michael Reilly
    September 2001



    0201710374P03282002

    Index

    A

    Absolute filename, 233

    Abstract classes, 69

    accept() method, 161, 162

    AccessException class, 332

    ACK (acknowledgment) packet, 139

    Activatable class, 334-336, 345

    Activatable objects

       activation description, 335

       activation descriptor, 336-337

       activation ID, 335

       creating new instances, 338

       stub, 336

    Activatable remote object

       creation of, 368-369

       notification of, 366

       registering, 369-376

    ActivatableLightBulbServer application, 369-376

    ActivatableLightBulbServer class, 373

    ActivateFailedException exception, 339

    Activation, 334-339

       remote objects supporting, 334-336

       security manager, 373

    Activation descriptor

       associated with default activation group, 337

       associated with specified activation group, 336-337

       codebase of class represented by, 337

       creation of, 374-375

       hashcode, 337

       name of class represented by, 337

       object represented, 337

    Activation descriptor object, 336

    Activation group descriptor, 374

    Activation group ID, 337

    Activation groups, 338-339

    ActivationDesc class, 336-337

    ActivationDesc() method, 336-337

    ActivationException exception, 339

    ActivationGroup class, 338

    ActivationGroupDesc class, 338

    ActivationGroup.getSystem() method, 374

    ActivationGroupID class, 338

    ActivationGroupID() method, 338

    ActivationID class, 339

    ActivationSystem class, 374

    ActivationSystem interface, 339, 374

    ActivationSystem.registerGroup method, 374

    ActivatonGroup.createGroup() method, 374

    Active objects no longer active, 335

    Active Server Pages, 240

    activeCount() method, 197, 198

    activeGroupCount() method, 197

    Adapter class, 433

    addConnectionListener() method, 407, 410

    addFolderListener() method, 409, 410

    addFrom() method, 405

    addMessageChangedListener() method, 410

    addMessageCountListener() method, 410

    addReceipt() method, 405

    addRecipients() method, 405

    Address class, 404

    Address mask, 16

    Address Mask Request/Address Mask Reply ICMP message, 16

    addStoreListener() method, 409

    addTemperatureListener() method, 360

    addTransportListener() method, 415

    allowThreadSuspension() method, 197

    “allowUserInteraction” field, 257, 259

    AlreadyBoundException class, 332

    AltaVista search engine, 281, 285

    Apache JServ add-on, 293

    Apache JServ Web site, 293

    Apache Web server, 293

    Apache Web site, 293

    API (Application Program Interface), 37-38

    appendMessages() method, 410

    Applets, 43

       digitally signed, 39

       firewall restrictions, 355-356

       games, 41

       inability to bind to TCP ports, 354

       limitations, 33

       network access restrictions, 39

       network connection restrictions, 355

       RMI (remote method invocation), 354-356

       security policies limitations, 287

       security restrictions, 39

    Application layer, 8

    Application protocols

       implementation, 207-236

       lower-level (Open Systems Interconnection) model layers, 205

       RFC (Request For Comment) documents, 206

       specifications, 206-207

    Applications

       communicating through ports, 144

       interoperating, 205

       sequential access to data, 139

       stand-alone, 39

    Architecture evolution, 8-9

    ARP (Address Resolution Protocol), 14

    ARPANET, 8-9

    Array of characters, printing, 88

    ArrayOutOfBoundsException exception, 198

    autoexec.bat file, 295

    Automatic error control, 142-143

    Automatic garbage collection, 30-31

    available() method, 72

    AWT (Abstract Windowing Toolkit), 46, 358, 428

    AWTError class, 46

    B

    “Backwards” CGI script, 285

    badVariable variable, 290

    BEA Weblogic Web site, 294

    Berners-Lee, Tim, 224

    BindException exception, 165, 166

    bind() method, 331, 341

    Blocking I/O, 71

    Block-level synchronization, 188-189

    Blocks of code, locking, 188

    Boolean value, printing, 87

    Borland Enterprise Application Server Web site, 294

    Borland JBuilder, 52

    Borland Web site, 52

    Browsers, 18

       responding to requests from, 229

       runtime environments, 36

    Buffered stream

       InputStream object, 80

       sizing, 81

    Buffered writer, 103

    BufferedInputStream class, 80-81, 81, 255

    BufferedInputStream() method, 80, 81

    BufferedOutputStream class, 85-86, 155

    BufferedOutputStream() method, 85

    BufferedReader class, 89, 94, 95-96, 125, 153

    bufferedReader() method, 95

    BufferedWriter class, 102-103, 155, 297

    BufferedWriter() method, 103

    Buffering together write requests, 102-103

    Buffers

       push-back reader, 96

       reading data into, 95

       strings, 100-101

    writers, 99

    Byte stream, 108-109, 142

    ByteArrayInputStream class, 70, 125, 129

    ByteArrayOutput Stream class, 131

    ByteArrayOutputStream class, 75

    Bytecode, 31

    C

    C#, 53

    C++, 29

    C and error checking, 45

    Cache flag, 257, 259

    Caching requests, 260

    Callbacks

       local, 358

       object-oriented, 356-358

       remote, 358

       RMI (remote method invocation) implementation, 356-365

       running example, 364-365

    Catch statement, 48-49

    Catching exceptions, 45-47

    CGI (Common Gateway Interface), 240, 277-286

       parameters, 278

       variables and servlets, 300

    CGI scripts, 36, 240, 281

    Character array readers, 91

    Character array writers, 99

    Character value, printing, 88

    CharArrayReader() method, 91

    CharArrayWriter class, 99

    CharArrayWriter() method, 99

    checkAccess() method, 197

    checkError() method, 87

    Checksum, 13

    Class A IP addresses, 57, 58

    Class B IP addresses, 58

    Class C IP addresses, 58

    Class D IP addresses, 58, 63

    Class E IP addresses, 58

    ClassCastException exception, 112

    Classes

       abstract, 69

       capable of running as threads, 177

       definition at different locations, 350-351

       for following network resources, 34

       RMI (remote method invocation), 329-349

    ClassNotFoundException exception, 351

    Classpath environment variable, 50, 295

       JavaMail API, 402

    Client JVM, uniquely identifying, 339-340

    Client sockets, 148-157

       connections, 159

    Clients, 145-147

       codebase, 352

       connecting with resource, 256

       CORBA (Common Object Request Broker Architecture), 382-383

       ease of connecting to remote services, 152-153

       error set of status codes, 245

       MIME type in documentation check-in/check-out system, 307

       request header fields, 241-243

       requesting connection to server socket, 161-162

       RMI (remote method invocation), 328

       sending MIME-encoded data to, 302-305

    Client/server paradigm, 145-147

    clone() method, 348

    CloneNotSupportedException exception, 348

    close() method, 72, 76-77, 90, 98, 123, 150, 162, 407, 410-411

    Codebase directory, 351

    Command line

       parameter null value, 252

       passing system properties from, 50-51

    Commercial IDE packages, 52-53

    Communication

       between applications using ports, 144

       with Web server, 239

    Communication pipes, 189, 190-192

    Communication ports, 16, 144

    Comparing IP addresses, 63

    Computer games, 40-41

    Computers, 1

    Connected pipe reader, 92

    ConnectException class, 332

    ConnectException exception, 47, 166

    ConnectIOException class, 332

    ConnectionListener class, 429, 433, 434

    Connections

       request method, 273

       used for input or output, 257

    connect() method, 92, 100, 123, 149, 256, 407, 408

    Constants, 290

    “Content-encoding” header field, 257

    CONTENT_LENGTH environment variable, 300

    “Content-Length” field, 246, 257, 263

    “Content-Type” field, 246, 262

    Controlling threads, 178-183

    Cookie class, 309-311

    Cookies, 242, 308

       sending to browser, 247

       servlets, 309-311

       variables, 309

    CookieTest servlet, 309-311

    copyMessages() method, 411

    CORBA (Common Object Request Broker Architecture), 34, 38, 44

       architectural view, 380-383

       clients, 382-383

       distributed lightbulb service, 387

       exception handling, 386

       exporting servant, 391

       IDL (Interface Definition Language), 383

       IIOP (Internet Inter-ORB Protocol), 381-382

       multilanguage abilities, 380

       name service, 382-383

       ORB (object request broker), 381

       removing communication between objects, 395-396

       RMI (remote method invocation), 379

       robustness, 382

       schema, 382

       servant, 382

       services and clients, 380

       writing servant code, 388-392

    Country-code top-level domains, 60

    CPU (central processing unit), 169

    createGroup(..) method, 338

    create() method, 411

    createRegistry() method, 342

    createServerSocket() method, 344, 346

    createSocket() method, 344, 346

    Current machine IP addresses, 64-65

    Customized sockets, 345-347

    D

    -D flag, 50

    Daemon group, 199

    Daemon process, 147

    Daemon threads, 175-176

    Data

       out-of-sequence, 4

       undelivered and time queued for delivery, 155

    “DATA” command, 215

    Data input stream construction, 82

    Data link layer, 7

    Data marshaling, 320

    Data packets and UDP (User Datagram Protocol), 119-121

    Data streams, definition of, 67-68

    Data transmission with packets, 4-5

    Datagram packet sequence number, 139, 143

    DatagramPacket class, 119-121, 125, 131

    DatagramPacket() method, 120-121

    DatagramSocket class, 122-123, 125, 132, 147, 155

    DatagramSocket() method, 122

    DatagramSocket.receive method, 124

    DatagramSocket.setToTimeout() method, 143

    DataInputStream class, 81-83, 108, 125, 255

    DataInputStream() method, 82

    DataInputStream.readLine() method, 89, 96

    DataOutput interface, 109

    DataOutputStream class, 86-87

    DataOutputStream() method, 86

    Datatypes

       printing as text, 87

       reading, 81-83

       writing to file, 86

    “Date” header field, 257

    DayTime server, 159

    DaytimeClient application, 157-159

    DaytimeServer application, 163

    Deadlock, 181

    Debugging servlets, 306

    DejaNews Web site, 19

    DELETE HTTP requests, 290, 292-293

    delete() method, 411

    Delphi, 29

    Destination Unreachable ICMP message, 15

    destroy() method, 197, 290, 291

    Developers and firewalls, 23

    Development tools

       IDE (integrated development environment), 51-53

       SDK (system development kit), 53

       user interface, 51

    Devices, 1, 2

    DHCP (Dynamic Host Control Protocol) server, 58

    Digitally signed applets, 39

    disconnect() method, 123, 272

    displayEmails() method, 221

    Distributed garbage collection, 339-341

    Distributed systems, 43-44

    DNS (Domain Name System), 59-61

    DNS server, 61

    docroot variable, 230

    doDelete() method, 290

    doGet() method, 290

    Domain name resolution, 61

    Domain names, 60

    doOptions() method, 290

    doPost() method, 290

    doPut() method, 290

    doSomething() method, 368, 369

    doTrace() method, 290

    Dotted decimal format, 61, 63

    Double value, printing, 88

    Downloading JSDK (Java Servlet Development Kit), 294

    Dropped packets, 118

    Dynamic class loading, 332, 349-352, 364, 375

    Dynamically assigned IP addresses, 56, 58

    E

    Echo client, 135-138

    Echo Request/Echo Reply ICMP message, 15

    Echo server, 138

    Echo service, 132-134

    E-mail, 399

       retrieving messages, 423-427

       sending file as attachment, 435-438

       sending messages, 418-423

    E-mail clients, 18

    Emulation, 35

    Entity body, 247

       meta-information about, 247

       MIME content type, 246

       number of bytes, 246

    enumerate() method, 197-198

    Enumeration, unable to access next element, 47

    Environment variables, 50

    equals() method, 63, 249, 337, 338, 340, 344

    Error class exceptions, 45-46

    Ethernet address, 3

    Ethernet card, 2

    Event source

       defining interface, 359

       implementing interface, 359-362

       listeners, 356

    Events

       JavaMail, 429-430

       notifying object of, 356-358

       notifying waiting thread of, 192-193

    /examples/ directory, 295

    /examples/WEB-INF/servlets directory, 295

    Exception class and exceptions, 46-47

    Exception handlers, 44-50

       catch statement, 48-49

       finally statement, 48, 49

       IDL (Interface Definition Language), 386-387

       sockets, 165-167

       try statement, 48

    Exception objects, 45

    Exceptions

       catching, 45-47

       causes, 49-50

       definition of, 45

       Error class, 45-46

       Exception class, 46-47

       inheritance, 45

       Java API, 321

       java.rmi.server package, 348

       remote method, 333

       security restrictions, 50

       servlets, 308

       state of network connection, 49

       throwing, 45-47

       types, 45-47

    exists() method, 411

    “Expires” field, 246-247, 257

    ExportException exception, 348

    exportObject() method, 334-335, 348

    expunge() method, 411

    Extensions, 38

    External Internet mail service, 409

    F

    Faulting remote reference, 366-367

    fetch() method, 411

    FetchURL application, 253-256

    FetchURLConnection application, 260-263

    Fiber-optic cables, 3

    FieldInputStream class, 234

    FIFO queue, 76

    FileDataSource class, 438

    FileInputStream low-level input stream, 70

    FileInputStream object, 74

    FileInputStreamDemo application, 74

    File.listFiles() method, 235

    FileNameMap interface, 257-258

    Filenames, mapping MIME content types to, 257-258

    FileOutputStream class, 78, 112

    FileOutputStream low-level output stream, 75

    FileOutputStreamDemo application, 78-79

    FileReader class, 92, 234

    FileReader() method, 92

    Files

    MIME type, 307

       transferring, 18

    FileWriter class, 99

    FileWriter() method, 99

    Filter input streams

       BufferedInputStream class, 80-81

       DataInputStream class, 81-83

       LineNumberInputStream class, 84

       PushBackInputStream class, 84-85

       pushing back data for reading later, 84-85

    Filter output streams

       BufferedOutputStream class, 85-86

       buffering writes, 85-86

       DataOutputStream class, 86-87

       PrintStream class, 87-88

    Filter readers

       BufferedReader class, 95-96

       buffering characters, 95

       FilterReader class, 96

       line counter, 97

       LineNumberReader class, 97

       PushBackReader class, 96-97

    Filter streams, 68, 79-88

    Filtered writers, 102-104

    FilterInputStream class, 80

    FilterReader class, 96

    Filters

       socket streams, 153

       templates, 96, 103

    FilterWriter class, 103

    FilterWriter() method, 103

    finalize() method, 408, 411

    Finally statement, 48, 49

    Finding

       out about other addresses, 65-66

       RFC (Request For Comments) documents, 206-207

    Finger, 19

    Firewall tunneling, 355-356

    Firewalls, 21-22

       applet restrictions, 355-356

       developers, 23

    Flow control, 139-140

    flush() method, 77, 85, 98

    Folder class, 410-415

    Folder.close() method, 427

    FolderListener class, 429

    fork() command, 32

    Frames, 7

    FTP (File Transfer Protocol), 18, 206, 268

    G

    Games, 40-41

    Garbage collection, 30-31, 339-341

    Garbage collector, unable to free objects, 46

    Gateways, 2

    Generic socket error, 166

    GenericServlet class, 290

    “GET” command, 232

    GET HTTP requests, 229, 232-233, 239, 290-292

       sending, 278-281

       versions, 240

    GET method, 239-240, 277, 278

    getAbsoluteName() method, 412

    getAddress() method, 63, 121

    getAllbyName() method, 63

    getAllowUserInteraction() method, 257

    getBuffer() method, 101

    getByName() method, 63, 66

    getClassName() method, 337

    getClientHost() method, 345

    getContentEncoding() method, 257

    getContentLength() method, 257, 300

    getContent() method, 250, 257

    getContentType() method, 258

    getCount() method, 187

    getData() method, 121, 337

    getDate() method, 257

    getDebug() method, 417

    getDefaultAllowUserInteractionField() method, 257

    getDefaultFolder() method, 409

    getDefaultInstance() method, 416-417

    getDefaultRequestProperty() method, 257

    getDefaultSocketFactory() method, 346

    getDefaultUseCaches() method, 257

    getDoInput() method, 257

    getDoOutput() method, 257

    getDuration() method, 341

    getEncoding() method, 93, 101

    getErrorStream() method, 272

    getExpiration() method, 257

    getFailureHandler() method, 346

    getFile() method, 250

    getFileNameMap() method, 257-258

    getFlags() method, 405

    getFolder() method, 405, 409, 411, 417

    getFollowRedirects() method, 272

    getFrom() method, 405, 426

    getFullName() method, 411-412

    getGroupID() method, 337

    getHeaderFieldData() method, 258

    getHeaderFieldInt() method, 258

    getHeaderFieldKey() method, 258

    getHeaderField() method, 258

    getHeader() method, 300

    getHostAddress() method, 63, 64, 65

    getHost() method, 250

    getHostName() method, 63, 64

    getID() method, 335

    getInetAddress() method, 123, 150, 162

    getInitParameter() method, 305

    getInitParameterNames() method, 305

    getInput() method, 221

    getInputStream() method, 150, 153, 258

    getInstance() method, 417

    getKeepAlive() method, 151

    getLastModified() method, 258

    getLength() method, 121

    getLineNumber() method, 84, 97

    getLocalAddress() method, 123, 151

    getLocalHost() method, 63, 64-65

    getLocalPort() method, 123, 151, 162

    getLocation() method, 337

    getLog() method, 345

    getMajorVersion method, 306

    getMaxPriority() method, 198

    getMessageCount() method, 412

    getMessageNumber() method, 405

    getMessages() method, 412

    getMimeType method, 306

    getMinorVersion method, 306

    getMode() method, 412

    getName() method, 199, 412

    getNewMessageCount() method, 412

    getOutputStream() method, 150, 258

    getParameterValues() method, 302

    getParent() method, 199, 412

    getPasswordAuthentication() method, 417

    getPermanentFlags() method, 412

    getPermission() method, 258-259

    getPort() method, 123, 151, 250

    getProperties() method, 417

    getProperty() method, 417

    getProtocol() method, 250

    getProvider() method, 417

    getProviders() method, 417

    getRealPath() method, 307

    getReceiveBufferSize() method, 123, 151

    getReceivedDate() method, 405

    getRecipients() method, 405

    getRef() method, 250

    getRegistry() method, 342-343

    getReplyTo() method, 405

    getRequestMethod() method, 272

    getRequestProperty() method, 259

    getResponseCode() method, 272

    getResponseMessage() method, 272

    getRestartMode() method, 337

    getSendBufferSize() method, 123, 151

    getSentDate() method, 406

    getSeparator() method, 412

    getServletContext() method, 306

    getSession() method, 312

    getSocketFactory() method, 346

    getSoLinger() method, 151

    getSoTimeout() method, 123, 162

    getStore() method, 412, 417

    getSubject() method, 406, 426

    getSystem() method, 338

    getTcpNoDelay() method, 151

    getTransport() method, 417-418

    getType() method, 413

    getUnreadMessageCount() method, 413

    getURL() method, 259

    getURLName() method, 408, 413

    getUseCaches() method, 259

    getVMID() method, 341

    goodVariable variable, 290

    Gosling, James, 28

    Grouping threads, 194-200

    Guaranteed delivery, 138-139, 142

    guessContentTypeFromStream() method, 257, 259

    GUI applications and multi-threading, 172

    GUI design tools, 52

    H

    Handler class, 231

    Handler functions, 291

    Hardware, 1

       address, 3

       independence, 9

    hashCode() method, 250, 337, 338, 340, 344

    HEAD request, 239, 240

    Header fields

       assigning value, 260

       modifying and examining, 264-268

       name of nth, 258

       parsing as date, 258

       parsing as number, 258

    HelloWorld servlet, 295, 298-299

    HelloWorld.class file, 295

    “HELO” hostname identification command, 214

    Helper class, 395

    High ASCII characters, 89

    High-level filter streams, 71

    Host machine and unique VMID (virtual machine identifier), 340

    Hostnames, 14, 63, 65-66, 132

    Hosts, 61

    hosts.txt file, 60

    Host-to-IP-address mappings, 60

    HotJava, 28

    HTCPCP (HyperText Coffee Pot Control Protocol), 206

    HTML, 235

    HTTP (HyperText Transfer Protocol), 18-19, 224, 248

       CGI (Common Gateway Interface), 277-286

       connecting client and resource, 256

       HttpURLConnection class, 268-277

       operation of, 237-239

       reading responses, 256-268

       redirects, 272

       sending requests, 256-268

       session management, 312-313

       stateless model, 308, 312

       status codes, 302

       TCP (Transmission Control Protocol), 237

       URL class, 248-250

       URL-Connection class, 256-268

       Web browsers, 237

    HTTP clients

       identifying type, 243

       request header fields, 241-243

       TCP connection to Web server, 237-238

    HTTP requests

       issuing, 266

       servlet methods, 290

       tracking state, 312

       valid, 293

    HTTP response, 238

    HTTP servlets, 290

    HTTP servers

       connection, 238

       implementation, 224-236

       response header fields, 245-247

       status, 244-245

       transaction, 238

    HTTP/1.1, 224

       status codes and integer static constants, 303-304

    HTTP_ACCEPTED - HTTP status code (202) field, 269

    HTTP_BAD_GATEWAY - HTTP status code (502) field, 272

    HTTP_BAD_METHOD - HTTP status code (405) field, 271

    HTTP_BAD_REQUEST - HTTP status code (400) field, 271, 291

    HTTP_CLIENT_TIMEOUT - HTTP status code (408) field, 271

    HTTP_CONFLICT - HTTP status code (409) field, 271

    HTTP_CREATED - HTTP status code (201) field, 269

    HTTP_ENTITY_TOO_LARGE - HTTP status code (413) field, 271

    HTTP_FORBIDDEN - HTTP status code (403) field, 271

    HTTP:_GATEWAY_TIMEOUT - HTTP status code (504) field, 272

    HTTP_GONE - HTTP status code (410) field, 271

    HTTPHeaders application, 264-268

    HTTP_INTERNAL_ERROR - HTTP status code (501) field, 272

    HTTP_LENGTH_REQUIRED - HTTP status code (411) field, 271

    HTTP:_MOVED_PERM - HTTP status code (301) field, 270

    HTTP_MOVED_TEMP - HTTP status code (302) field, 270

    HTTP_MULT_CHOICE - HTTP status code (300) field, 270

    HTTP_NO_CONTENT - HTTP status code (204) field, 270

    HTTP_NOT_ACCEPTABLE - HTTP status code (406) field, 271

    HTTP_NOT_AUTHORITATIVE - HTTP status code (203) field, 270

    HTTP_NOT_FOUND - HTTP status code (404) field, 271

    HTTP_NOT_MODIFIED - HTTP status code (304) field, 270

    HTTP_OK - HTTP status code (200) field, 269

    HTTP_PARTIAL - HTTP status code (206) field, 270

    HTTP_PAYMENT_REQUIRED - HTTP status code (402) field, 271

    HTTP_PRECON_FAILED - HTTP status code (412) field, 271

    HTTP_PROXY_AUTH - HTTP status code (407) field, 271

    HTTP_REQ_TOO_LONG - HTTP status code (414) field, 272

    HTTP_RESET - HTTP status code (205) field, 270

    HttpResponse class, 302-305

    HTTP_SEE_OTHER - HTTP status code (303) field, 270

    HTTP_SERVER_ERROR - HTTP status code (500) field, 272

    HttpServlet class, 290, 297

    HttpServletRequest class, 300-302, 312

    HttpSession class, 312-313

    HTTP_UNAUTHORIZED - HTTP status code (401) field, 271

    HTTP_UNAVAILABLE - HTTP status code (503) field, 272

    HTTP_UNSUPPORTED_TYPE - HTTP status code (415) field, 272

    HttpURLConnection class, 268-277

       accessing HTTP-specific functionality, 273-277

       static fields, 269-272

       usage, 269-273

    HTTP_USE_PROXY - HTTP status code (305), 270-271

    HTTP_USER_AGENT environment variable, 300

    HTTP_VERSION - HTTP status code (505) field, 272

    Hubs, 2

    Hyperlinks, 224, 237

    Hypertext documents, 237

    I

    IANA (Internet Assigned Numbers Authority), 58, 59

    IANA (Internet Assigned Numbers Authority) Web site, 58

    IBM Web site, 52

    ICANN (Internet Corporation for Assigned Names and Numbers), 58

    ICANN (Internet Corporation for Assigned Names and Numbers) Web site, 58

    ICMP (Internet Control Message Protocol), 14-16

    IDE (integrated development environment), 51-53

    IDL (Interface Definition Language), 380

       attributes, 385

       datatypes, 384

       exception handling, 386-387

       interfaces, 384

       mapping schema to Java, 388

       modules, 384

       operations, 385-386

       overview, 383

       writing client code, 392

       writing CORBA service, 387

       writing servant code, 388-392

    idl2java.exe program, 388

    idlj compiler, 395

    idlj.exe, 388

    “If-Modified-Since” header, 242, 260

    IIS (Internet Information Server), 293

    IllegalArgumentException exception, 121, 336

    IllegalStateException exception, 410, 414

    implAccept() method, 162

    inactive() method, 335

    INBOX folder, 410, 425-426

    increaseCount() method, 186

    InetAddress class, 63-66, 131

    Informational set of status codes, 244

    Infrared, 3

    Inheritance

       exceptions, 45

       objects, 74

    init() method, 288, 290, 291

    Inner classes, 230, 429

    Input flag, 259

    Input streams, 68, 213

       blocking I/O, 71

       byte array not filled, 82

       closing, 72

       converting line of text to string, 83

       current position in, 72

       double value, 82

       float value, 82

       freeing resources, 72

       int value, 82-83

       length of data read, 82

       long value, 83

       low-level streams, 69-70, 73-75

       moving back to preset mark, 72

       next byte of data, 72

       nonzero byte, 82

       number of bytes to read, 72

       offset within array, 82

       pushing back array contents, 84

       pushing back byte to front of buffer, 85

       pushing back subset of array, 84-85

       readers, 93

       reading, but ignoring bytes, 72-73

       reading byte from, 82

       reading character from, 82

       reading from, 69-75, 84

       reading sequence of bytes to byte array, 72

       reading string with, 83

       sequentially reading, 70-71

       short value, 83

       sizing buffer, 84

       skipping over bytes, 83

       tracking number of lines read from, 84

    InputStream class, 71-75, 80, 253, 255, 256, 263

    InputStream object, 74, 258

    InputStreamReader class, 93, 94, 125

    InputStreamReader() method, 93

    InputStreamToReaderDemo application, 94

    Installi

    Updates

    Submit Errata

    More Information

    Unlimited one-month access with your purchase
    Free Safari Membership