Web application architecture principles protocols and practices 2nd Edition Leon Shklar instant download
Web application architecture principles protocols and practices 2nd Edition Leon Shklar instant download
https://ebookgate.com/product/web-application-architecture-
principles-protocols-and-practices-2nd-edition-leon-shklar/
https://ebookgate.com/product/wordpress-web-application-
development-2nd-edition-rakhitha-nimesh-ratnayake/
https://ebookgate.com/product/practical-poetics-in-
architecture-1st-edition-leon-van-schaik/
https://ebookgate.com/product/programming-principles-and-
practices-using-c-2nd-edition-bjarne-stroustrup/
https://ebookgate.com/product/brain-injury-treatment-theories-
and-practices-1st-edition-jose-leon-carrion/
Network defense and countermeasures principles and
practices 2nd Edition Chuck Easttom
https://ebookgate.com/product/network-defense-and-
countermeasures-principles-and-practices-2nd-edition-chuck-
easttom/
https://ebookgate.com/product/clinical-application-of-
neuromuscular-techniques-volume-1-the-upper-body-2nd-edition-
leon-chaitow-nd-do/
https://ebookgate.com/product/water-chlorination-and-
chloramination-practices-and-principles-2nd-edition-american-
water-works-association/
https://ebookgate.com/product/game-audio-programming-principles-
and-practices-somberg/
https://ebookgate.com/product/web-engineering-principles-and-
techniques-woojong-suh/
Table of Contents
Title Page
Copyright Page
Dedication
About the Authors
Preface to the Second Edition
Acknowledgements
CHAPTER 1 - Introduction
2
4.1 Standard Generalized Markup Language
4.2 HTML
4.3 HTML Rendering
4.4 Summary
4.5 Bibliography
3
7.11 Web Links
7.12 Endnotes
8.1 Pre-History
8.2 JavaScript
8.3 Cascading Style Sheets
8.4 DHTML
8.5 AJAX
8.6 Case Study: 5-Star Rating
8.7 Summary
8.8 Bibliography
8.9 Web Links
8.10 Endnotes
4
11.4 Benefits and Drawbacks of Using Rails
11.5 Whither Enterprise Java?
11.6 Summary
11.7 Bibliography
11.8 Web Links
11.9 Endnotes
CHAPTER 14 - Conclusions
Index
5
This book delivers a thorough and rigorous introduction to fundamental architectural elements of the web;
this knowledge is a critical foundation for any development engineer working on our advanced web
applications. Just as important, this book provides a challenging, non-trivial example application
demonstrating current best practices which the reader can work through to connect theory to practice. For our
engineers coming from other backgrounds to advanced web development, this book has been a very efficient,
effective learning tool and I would recommend it highly to others who desire a deep understanding of web
architecture and applications.
6
7
Copyright © 2009 John Wiley & Sons Ltd, The Atrium, Southern Gate, Chichester,
West Sussex PO19 8SQ, England
Telephone (+44) 1243 779777
Email (for orders and customer service enquiries): [email protected]
Visit our Home Page on www.wiley.com
All Rights Reserved. No part of this publication may be reproduced, stored in a retrieval system or transmitted
in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except
under the terms of the Copyright, Designs and Patents Act 1988 or under the terms of a licence issued by the
Copyright Licensing Agency Ltd, Saffron House, 6-10 Kirby Street, London EC1N 8TS, UK, without the
permission in writing of the Publisher. Requests to the Publisher should be addressed to the Permissions
Department, John Wiley & Sons Ltd, The Atrium, Southern Gate, Chichester, West Sussex PO19 8SQ,
England, or emailed to [email protected], or faxed to (+44) 1243 770620.
Designations used by companies to distinguish their products are often claimed as trademarks. All brand
names and product names used in this book are trade names, service marks, trademarks or registered
trademarks of their respective owners. The Publisher is not associated with any product or vendor mentioned
in this book.
This publication is designed to provide accurate and authoritative information in regard to the subject matter
covered. It is sold on the understanding that the Publisher is not engaged in rendering professional services. If
professional advice or other expert assistance is required, the services of a competent professional should be
sought.
John Wiley & Sons Inc., 111 River Street, Hoboken, NJ 07030, USA
Jossey-Bass, 989 Market Street, San Francisco, CA 94103-1741, USA
Wiley-VCH Verlag GmbH, Boschstr. 12, D-69469 Weinheim, Germany
John Wiley & Sons Australia Ltd, 42 McDougall Street, Milton, Queensland 4064, Australia
John Wiley & Sons (Asia) Pte Ltd, 2 Clementi Loop #02-01, Jin Xing Distripark, Singapore 129809
John Wiley & Sons Canada Ltd, 6045 Freemont Blvd, Mississauga, Ontario, L5R 4J3, Canada
Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not
be available in electronic books.
Shklar, Leon
Web application architecture : principles, protocols, and practices / Leon Shklar and Rich Rosen. - 2nd ed.
p. cm.
Includes bibliographical references and index.
ISBN 978-0-470-51860-1 (pbk.)
8
1. Web site development. 2. Application software-Development. 3. Web sites-Design. 4. Software
architecture.
I. Rosen, Rich. II. Title.
TK5105.888.S492 2009
005.1’2-dc22
2008052051
A catalogue record for this book is available from the British Library
ISBN 978-0-470-51860-1
Typeset in 10/12.5 Times by Laserwords Private Limited, Chennai, India
Printed and bound in Great Britain by Bell and Bain, Glasgow
9
To my beautiful girls: my wife Rita and daughter Victoria.
To the memory of my parents, Hasya and Arcady Shklar, and my grandparents, Tasya and Boris
Korkin.
Leon Shklar
To my parents, Arthur and Toby, and to Celia. Also, to the memory of my high school maths teacher, Jack
Garfunkel, who instilled in his students the value of thinking things through logically, and the value of writing
not for those who already know what you’re talking about, but for those who don’t.
Rich Rosen
10
About the Authors
Leon Shklar currently works for Thomson Reuters where he is the head of technology for Reuters Media.
Previously, Leon headed up the development team for the online edition of the Wall Street Journal at Dow
Jones. Prior to joining Dow Jones, he spent six years at Bell Communications Research and almost as long in
the world of dot-coms and Internet software. Leon holds a Ph.D. in Computer Science from Rutgers
University.
Rich Rosen is a senior developer in the Fixed Income Systems Group at Interactive Data Corporation.
Previously, he was an Application Architect at Dow Jones. Rich began his career at Bell Labs, where his work
with relational databases and the Internet prepared him for the world of Web application development. He is
a co-author of Mac OS X for Unix Geeks, 4th Edition (O’Reilly). Rich holds an M.S. in Computer Science from
Stevens Institute of Technology.
11
Preface to the Second Edition
The expression “web time” connotes a world in which rapid change is the norm, where time is exponentially
condensed. Technological advances that once upon a time might have taken years to transpire now occur in a
matter of months or even days. What’s more, these advances often result in radical paradigm shifts that
change the way we interact with our technology, and with the world at large.
The first edition of this book was published in 2003. Since then, there have been many technological
advances and paradigm shifts, causing some of what we wrote to become dated. New frameworks such as
Ruby on Rails have arisen as a reaction to increasing complexity in the application development process.
AJAX has taken client-side interactivity to a new level, blazing new frontiers in web application functionality.
Search has become a fundamental part of our everyday web experience. Even the core protocols and markup
languages representing the foundation of web technology have evolved since we first wrote about them over
five years ago. Back then, who could have imagined the ascendance of today’s most popular web applications,
such as YouTube, Facebook, eBay, and Wikipedia, or the advances in real-time interactivity that are now
commonplace?
For the second edition of this book, we provide new material covering these changes in the web technology
landscape, while striving to bring existing content up-to-date. We have included new chapters on search
technology and client-side interactivity (JavaScript, DHTML, and AJAX). We have added a second sample
application implemented using Ruby on Rails as a complement to the original Struts application, which has
been updated for the new edition. The chapters on Internet protocols, markup languages, server and browser
architecture, and application development approaches have all been revised and enhanced. It is our hope that
this updated edition will provide readers with deeper insights into the principles, protocols, and practices
associated with the design and development of web applications.
Leon Shklar
Rich Rosen
October 31, 2008
12
13
Acknowledgments
I am grateful to my wife Rita for inspiration and music, and for still being around after all the work that went
into the two editions of this book. My special thanks to our daughter Victoria for her insightful ideas
throughout the project.
Leon Shklar
Ongoing and everlasting thanks to my wife, Celia, for the joy her singing brings into my life, and for enduring
the continued insanity associated with the writing process. Thanks also to my parents and to Celia’s parents
for their love and support.
Rich Rosen
We would both like to thank the following people for their help:
• our editor, Jonathan Shipley, and his assistants, Georgia King and Claire Jardine, for their
professionalism and flexibility throughout the project;
• our technical reviewers, Sue Fitzgerald, Ciara n O’Leary, Ilmi Yoon, Roger Beresford, Yuanzhu
Peter Chen, Ray Cheung and Wei Ding, for taking the time to examine the text and provide us
with valuable insights and advice;
• our colleagues, Otis Gospodnetich and Keith Kim, for their comments and suggestions for the
search chapter, and Heow Eide-Goodman for his comments and suggestions for the chapters on
development approaches and Rails application development.
14
CHAPTER 1
Introduction
IN THIS CHAPTER
OBJECTIVES
15
1.1 History and Pre-History of the Web
Back in 1989, at CERN (the scientific research laboratory near Geneva, Switzerland), Tim Berners-Lee
presented a proposal for an information management system that would enable the sharing of knowledge and
resources over a computer network. We now know this system as the worldwide web (the web). Building on
the foundation of existing Internet protocols and services, it lives up to its name as a ubiquitous network
providing information and communication services to hundreds of millions of people around the world.
From the very beginnings of Internet technology, many people shared the dream of using the Internet as a
universal medium for exchanging information over computer networks. Internet file-sharing services (such as
FTP and Gopher) and message forum services (such as Netnews) provided increasingly powerful mechanisms
for information exchange and brought us closer to fulfilling those goals.
Ted Nelson’s Xanadu project aspired to make that dream a reality, but the goals were lofty and never fully
realized. Nelson coined the term “hypertext” as a way of describing “non-sequential writing - text that
branches and allows choice to the reader.” Unlike the static text of print media, hypertext was intended for use
with an interactive computer screen. It is open, fluid and mutable, and can be connected to other pieces of
hypertext by “links”.
It took Tim Berners-Lee to “marry together” (in his words) the notion of hypertext with the power of the
Internet, bringing those initial dreams to fruition in a way that the earliest developers of both hypertext and
Internet technology might never have imagined. His vision was to connect literally everything, in a uniform
and universal way. Berners-Lee originally promoted the web as a virtual library, a document control system for
sharing information resources among researchers. On-line documents could be accessed via a unique
document address, a universal resource locator (URL). These documents could be cross-referenced via hypertext
links.
From its humble beginnings, the web has expanded exponentially to serve a wide variety of purposes for a
wide variety of people:
• Given its origins, it seems natural that educational institutions and research laboratories were
among the very first users of the web, employing it to share documents and other resources across
the Internet.
• Popular adoption of the web by individuals followed gradually, originally through on-line services,
such as America On-line (now AOL) that slowly but surely integrated with the web and the
Internet. Initially, personal usage of the web was limited to e-mail and web surfing. Eventually,
people began building their own web sites where they posted everything from on-line photo albums
to personal journals that would become known as “blogs.”
• Over time, businesses saw the potential of the web and began to employ it for e-commerce,
providing an on-line medium for buying and selling goods interactively. As more and more people
were connected to the web, the draw of a new source of revenue and the fear that competitors would
get there first and undercut traditional revenue streams made e-commerce increasingly important to
business. E-commerce applications are now being used for everything - from displaying catalogs of
16
available merchandise to providing the means for customers to purchase goods and services securely
on-line.
• As the impact of e-commerce grew, the back-end applications supporting e-commerce became
increasingly important to the companies using it. The front-end, customer-facing web sites needed
to be up to date, synchronized with inventory systems so that customers would know what items
were or weren’t immediately available. Automated fulfillment systems connected to the on-line
ordering mechanisms became commonplace. With that, secure login and registration, including
collection of credit card information and payment processing, became an absolute requirement for
viable e-commerce sites.
• With the maturing of the web, a tug of war arose between sites offering free and paid content.
Google was successful in tilting the balance in favor of free content supported by ads. Even the Wall
Street Journal, which pioneered the notion of paid subscriptions for on-line content, has been
opening up more and more of its content to non-subscribers. Critical technological challenges for
free sites include tracking visitor behavior, providing adaptive personalization, and offering advanced
community-building tools.
The web did not come into existence in a vacuum. It was built on top of core Internet protocols that had
been in existence for many years prior to the inception of the web. Understanding the relationship between
web technology and the underlying Internet protocols is fundamental to the design and implementation of
true web applications. In fact, it is the exploitation of that relationship that distinguishes a web page or web
site from a web application.
17
1.2 From Web Pages to Web Sites
The explosive growth of the web at least partially can be attributed to its grass-roots proliferation as a tool for
personal publishing. The fundamental technology behind the web is relatively simple. A computer connected to
the Internet running a web server was all that was necessary to serve documents. Both CERN and the National
Center for Supercomputer Applications (NCSA) at the University of Illinois had developed freely available web
server software. A small amount of HTML knowledge (and the proper computing resources) got you
something that could be called a web site. Early web sites were just loosely connected sets of pages, branching
hierarchically from a home page; now, a web site is much more than just a conglomeration of web pages.
When the web was in its infancy, academic institutions and technology companies owned the only
computers that were connected to the Internet and could run server software. In those days, personal
computers sitting on people’s desks were still a rarity. If you wanted access to any sort of computing power,
you used a terminal that let you “log in” to a large server or mainframe over a direct connection or dial-up
phone line.
Still, creating and posting web pages quickly became popular among people that had access to scarce
computing power. The original HTML language was simple enough that, even without the more
sophisticated tools we have at our disposal today, it was an easy task for someone to create a web page. (Some
would say too easy.) In the end, all that was needed to create first generation web pages was a simple text
editor.
There is a big difference between a bunch of web pages and a web site. A web site is more than just a group
of web pages that happen to be connected to each other through hypertext links:
• First, there are content-related concerns. Maintaining thematic consistency of content is important
in giving a site some degree of identity.
• There are also aesthetic concerns. In addition to having thematically related content, a web site
should also have a common look and feel across all of its pages, so that site visitors know what they
are looking at. This means utilizing a common style: page layout, graphic design, and typographical
elements.
• Then there are architectural concerns. As a site grows in size and becomes more complex, it is
critically important to organize its content. This includes not just the layout of content on individual
pages, but also the interconnections between the pages (site navigation). If the site becomes so
complex that visitors cannot navigate their way through, even with the help of site maps and
navigation bars, then it needs to be reorganized and restructured.
18
1.3 From Web Sites to Web Applications
Initially, what people shared over the Internet consisted mostly of static information found in files. They
might edit those files, but there were few truly dynamic information services.
Granted, there were a few exceptions: search applications for finding files in on-line archives and services
that provided information about the current weather, or the availability of cans from a soda-dispensing
machine. (One of the first web applications that Tim Berners-Lee demonstrated at CERN was designed to
look up numbers in an on-line phone book using a web browser.) However, for the most part, the information
resources on the web were static documents.
The advent of the dynamic web, which resulted from the proliferation of dynamic information services,
changed all that. The new services ranged from CGI scripts to search engines to packages that connected web
applications to relational databases. No longer was it sufficient to build a web site (as opposed to a motley
collection of web pages). It became necessary to design a web application.
What is a “web application?” It is a client-server application that uses a web browser as its client program. It
delivers interactive services through web servers distributed over the Internet (or an intranet). A web site
simply delivers content from static files. A web application can present dynamically tailored content based on
request parameters, tracked user behaviors, and security considerations.
Web applications power information portals, retail sites, and corporate intranets. They not only provide
information and interact with site visitors, but also collect and update information, maintain access controls,
and support on-line transactions.
A prime example of a dynamic web application is an on-line shopping site. Site visitors browse on-line
catalogs, search for items they want to purchase, add those items to an on-line shopping cart, and place their
orders through a secure interface that encrypts personal information. To enable this functionality, the web
application communicates with warehouses that maintain catalog and inventory information, storing this
information in a database. Users can search the on-line database to obtain information about products. The
application provides a way for users to select items to be added to their shopping carts, maintains shopping
cart contents for the duration of the browser session, and records order information in the database. It
communicates with outside financial institutions to verify credit card and address information, fulfills the
order by directing warehouses to ship the purchased items, and sends confirmation e-mails to purchasers
allowing them to track shipment of their orders.
19
1.4 Web 2.0: On-line Communities and Collaboration
Since 2000, another major trend has arisen in the on-line world, incorporating applications that support user-
generated content, on-line communities, and collaborative mechanisms for updating on-line content. This
trend is often referred to as Web 2.0, because it is closely tied to advances in web technology that herald a new
generation of web applications.
In many respects, Web 2.0 is a harking back to the web as a network for presenting personal hyperlinked
information. Information flow on the web is no longer one way, from the web site to the surfer. Site visitors
contribute information of their own, ranging from reviews and ratings for movies, music, and books to
personal journals, how-to information, and news for popular consumption. These journals go by the name
blogs (short for “web logs”) and the whole blogging movement has resurrected the idea of the personal web
page and elevated its status.
Personal blogs and community web sites encouraging user input may bear a resemblance to the more
personal web of old, but the technology behind them does not. Whereas individual owners could easily
maintain the simple static web sites of old, this has become impractical given the enormous volume and
increasingly malleable nature of content out there today. Blogs, user forums, and collaborative community
sites may look like the simpler web sites of the past, but the underlying functionality supporting them is based
on sophisticated web application technology incorporating user authentication, access control, and content
management services.
20
1.5 The Brave New World of AJAX
Another radical change in the web application landscape was the advent of AJAX (an acronym that stands for
Asynchronous JavaScript and XmlHttpRequest). While the technology advances behind it accumulated
gradually, AJAX represents a paradigm shift that has changed the way web applications are conceived and
developed.
Tim Berners-Lee’s original concept of HTTP was that of a simple stateless request - response protocol.
Such a protocol allows for independent processing of requests and responses, without requiring a persistent
connection. This simplicity fostered wide acceptance of the HTTP protocol but imposed significant
limitations. The only method available for updating page content was to replace the entire page. This
limitation was unsatisfying to those who were used to client-server applications that communicated with their
associated servers directly and continuously. For instance, in such an application, a server-side change to a
value in a spreadsheet cell could immediately be reflected on the screen without refreshing the whole
spreadsheet.
HTTP, and the web experience in general, have evolved in a number of ways since their inception,
introducing elements that allow web transactions to transcend the limitations of a stateless request-response
protocol (e.g., cookies and JavaScript). AJAX is the latest such element, essentially allowing what amounts to
an “end-run” to communicate with a web server indirectly: instead of submitting a direct request to see a new
page from the server, a subordinate background request is submitted (usually through a JavaScript object
called XmlHttpRequest) and the response to that request is used to dynamically modify the content of the
current page in lieu of replacing its content entirely.
The main impact of AJAX is that the web experience is brought closer to that of client-server applications,
allowing for a more immediate dynamic interaction between the user and the web application.
21
1.6 Focus of This Book
The purpose of this book is to provide a guide for learning the underlying principles, protocols, and practices
associated with designing flexible and efficient web applications. Our target audience is senior undergraduate
or graduate students who have already learned the basics of web development and professional developers who
have had some exposure to web application development and want to expand their knowledge.
We expect our readers to have some familiarity with HTML and JavaScript - not at the level of experienced
web designers but enough to create web pages and embed simple JavaScript code to submit forms to a web
server. We recommend at least some exposure to Internet protocols, such as Telnet, FTP, SMTP, HTTP and
SSL. We appreciate that many of our readers may not be familiar with Linux or Unix operating systems.
However, it is helpful to have some understanding of the command-line interfaces provided by interactive
shells, as some of our examples employ such an interface.
As we have said, there is a major difference between web pages, web sites, and web applications. There are
excellent resources dedicated to web page and web site design, and the References section at the end of this
chapter lists some of the best that we know. When we examined the current literature available on the subject
of web application development, we found there were three main categories of book currently available.
• technical overviews
• reference books
• focused tutorials.
Technical overviews are usually very high level, describing technology and terminology in broad terms. They
do not go into enough detail to enable the reader to design and build serious web applications. They are most
often intended for managers who want a surface understanding of concepts and terminology without going
too deeply into specific application development issues. Frequently, such overviews attempt to cover
technology in broad brushstrokes; their subject may be Java, XML, e-commerce, or Web 2.0. Such books
approach the spectrum of technology so broadly that the coverage of any specific area is too shallow for serious
application developers.
Reference books are useful, naturally, as references, but not for the purpose of learning about the technology.
They are great to keep on your desk to look things up once you are already deeply familiar with the
technology, but they are not oriented toward elucidation and explanation.
The focused tutorials concentrate on the usage of specific platforms and products to develop web
applications. Books in this category provide in-depth coverage of very narrow areas, concentrating on how to
use a particular language or platform without necessarily explaining the underlying principles. Such books may
be useful in teaching programmers to develop applications for a specific platform, but they do not provide
enough information about the enabling technologies, focusing instead on the platform-specific
implementation. Should a developer be called upon to rewrite an application for another platform, the
knowledge acquired from these books is rarely transferable to the new platform.
Given the rate of change of the web technologies, today’s platform of choice is tomorrow’s outdated legacy
system. When new development platforms emerge, developers without a fundamental understanding of the
22
inner workings of web applications have to learn the new platforms from the ground up. The challenge is their
lack of understanding of what the systems they implemented using specialized application programming
interfaces (APIs) did behind the API calls. What is missing is the ability to use fundamental technological
knowledge across platforms.
What was needed was a book that covered the basic principles of good application design, the underlying
protocols associated with web technology, and the best practices for creating scalable, extensible, maintainable
applications. With this in mind, we endeavored to write such a book.
The need for such a book is particularly apparent when interviewing job candidates for web application
development positions. Too many programmers have detailed knowledge of particular languages and
interfaces but they are lost when asked questions about the underlying technologies and how they relate to real
problems (e.g., why is it necessary for a server to add a trailing slash to a URL and redirect the request back to
itself?). Such knowledge is not purely academic - it is critical when designing and debugging complex systems.
Too often, developers with proficiency only within a specific application development platform (such as
Active Server Pages, Cold Fusion, PHP, or Perl CGI scripting) are not capable of transferring that proficiency
directly to another platform. The fundamental understanding of core technologies is critical to enable
developers to grow with the rapid technological advances in web application development.
What do we have in mind when we refer to the general principles that need to be understood in order to
properly design and develop web applications? We mean the core protocols and languages associated with web
applications. This includes HyperText Transfer Protocol (HTTP) and HyperText Markup Language (HTML),
which are fundamental to the creation and transmission of web pages, but it also includes older Internet
protocols such as Telnet and FTP, and the protocols used for message transfer such as SMTP and IMAP. A
web application architect must also be familiar with JavaScript, XML, relational databases, graphic design and
multimedia. Web application architects must be well-versed in application server technology and have a
strong background in information architecture.
If you find people with all these qualifications, please let us know: we would love to hire them! Rare is the
person who can not only design a web site but can also perform all the other tasks associated with web
application development: working with graphic designers, creating database schemas, producing interactive
multimedia programs, and configuring e-commerce transactions. More realistically, we can seek someone who
is an expert in one particular area (e.g., e-commerce transactions or browser programming) but who also
understands the wider issues associated with designing web applications.
We hope that, by reading this book, you can acquire the skills needed to design and build complex
applications for the web. There is no “one easy lesson” for learning the ins and outs of application design.
Hopefully, this book will enhance your ability to design and build sophisticated web applications that are
scaleable, maintainable, and extensible.
We examine various approaches to the process of web application development, covering both client-side
presentation technology and server-side application technology. On the client side, we look at both markup
languages and programming languages, from HTML and XML to CSS and JavaScript. On the server side, we
look at the full range of approaches, starting with Server Side Includes (SSI) and CGI, covering template
languages such as Cold Fusion and ASP, examining the intricacies of Java Platform, Enterprise Edition (Java
EE), and finally looking at newer “rapid development” approaches such as Ruby on Rails. At each level, we
23
concentrate not only on the particular development platform, but also on the underlying principles that span
multiple platforms.
24
1.7 What Is Covered in This Book
• Chapter 2: Core Internet Protocols - This chapter offers an examination of the underlying
Internet protocols that form the foundation of the web. It offers some perspectives on the history of
TCP/IP, as well as some details about using several of these protocols in web applications.
• Chapter 3: Birth of the Web: HTTP - The HTTP protocol is covered in detail in this chapter,
with explanations of how requests and responses are transmitted and processed.
• Chapter 4: HTML and Its Roots - In the first of two chapters about markup languages, we go
back to SGML to learn more about the roots of HTML (and of XML). Rather than providing a
tutorial on web design with HTML, the focus is on HTML as a markup language and its place in
web application development.
• Chapter 5: XML Languages and Applications - This chapter covers XML and related
specifications, including XML Schema, XPath, XSLT, and XSL FO, as well as XML applications
such as XHTML and WML.
• Chapter 6: Web Servers - The operational intricacies of web servers is the topic of this chapter,
with in-depth discussion of what web servers must do to support interactions with clients such as
web browsers and HTTP proxies.
• Chapter 7: Web Browsers - As the previous chapter dug deep into the inner workings of web
servers, this chapter provides similar coverage of the inner workings of web browsers.
• Chapter 8: Active Browser Pages: From JavaScript to AJAX - Here we cover the mechanisms for
providing dynamic interactivity in web pages, including JavaScript, DHTML, and AJAX.
• Chapter 9: Approaches to Web Application Development - This chapter contains a survey of
available web application approaches, including CGI, Servlets, PHP, Cold Fusion, ASP, JSP, and
frameworks such as Struts. It classifies and compares these approaches to help readers make
informed decisions when choosing an approach for their project, emphasizing the benefits of using
the Model-View-Controller (MVC) design pattern in implementing applications.
• Chapter 10: Web Application Primer: Virtual Realty Listing Services - Having examined the
landscape of available application development approaches, we decide on Struts along with the Java
Standard Tag Library (JSTL). We give the reasons for our decisions and build a sample employing
the principles we have been discussing in previous chapters. We then suggest enhancements to the
application as exercises to be performed by the reader, including the introduction of an
administrative interface component, using Hibernate for object-relational mapping, and using Java
Server Faces for presentation.
• Chapter 11: Web Application Primer: Ruby on Rails - In this chapter, we revisit the Virtual
Realty Listing Services application and implement its administrative interface using the Ruby on
Rails framework. We describe the general structure of a Rails application, walk through the process
of building an application in Rails, and compare the Java EE - Struts approach with Rails in terms
25
of both ease of development and flexibility of deployment.
• Chapter 12: Search Technologies - Here we describe not only the process of indexing site content
for internal search functionality, but also the mechanisms for structuring a site’s content for optimal
indexing by external search engines. Jakarta’s Lucene and other tools are covered.
• Chapter 13: Trends and Directions - Finally, we look to the future, providing coverage of the
most promising developments in web technology, as well as speculating about the evolution of web
application frameworks.
Chapter 2 starts us off with a study of the core protocols supporting Internet technology, in general, and
the web in particular. Although some might see this as review, it is a subject worth going over to gain both a
historical and a technological perspective.
26
1.8 Bibliography
Berners-Lee, Tim, 2000. Weaving the Web: The Original Design and Ultimate Destiny of the World Wide Web.
New York: HarperBusiness.
Gehtland, Justin, Galbraith, Ben and Almaer, Dion, 2006. Pragmatic AJAX: A Web 2.0 Primer. Raleigh (NC):
Pragmatic Bookshelf.
Hadlock, Kris, 2007. AJAX for Web Application Developers. Indianapolis (IN): SAMS Publishing (Developer’s
Library).
Nelson, Theodor Holm, 1982. Literary Machines 931 . Sausalito (CA): Mindful Press.
Rosenfeld, Louis and Morville, Peter, 2006. Information Architecture for the World Wide Web, 3rd Edition.
Sebastopol (CA): O’Reilly & Associates.
Williams, Robin and Tollett, John, 2005. The Non-Designer’s Web Book, 3rd Edition. Berkeley (CA): Peachpit
Press.
27
CHAPTER 2
IN THIS CHAPTER
• TCP/IP
• Telnet
• Electronic mail
• Messaging
• Security and encryption
• FTP and file server protocols
• And then came the web ...
OBJECTIVES
As we mentioned in the previous chapter, Tim Berners-Lee did not come up with the worldwide web in a
vacuum. The web as we know it was built on top of core Internet protocols that had been in existence for many
years. Understanding the ideas behind those underlying protocols is important for the discipline of building
robust web applications.
In this chapter, we examine the core Internet protocols that make up the TCP/IP protocol suite, which is the
foundation for the web protocols that are discussed in Chapter 3. We begin with a brief historical overview of
the forces that led to the creation of TCP/IP. We then go over the layers of the TCP/IP stack, and show
where various protocols fit into it. Our description of the client-server paradigm used by TCP/IP applications
is followed by discussion of the various TCP/IP application services, including Telnet, electronic mail (e-
28
mail), message forums, live messaging, and file servers. While some of these protocols and services may be
deprecated, if not obsolete, knowledge of how they work and what they do provides critical insights into the
present and future of web protocols and web applications.
29
2.1 Historical Perspective
The roots of web technology can be found in the original Internet protocols (known collectively as TCP/IP)
developed in the 1980s. These protocols were an outgrowth of work to design a network called the
ARPANET.
The ARPANET was named for the Advanced Research Projects Agency (ARPA) of the US Department of
Defense (DoD). It came into being as a result of efforts in the 1970s to develop an open, common,
distributed, and decentralized computer networking architecture. The DoD’s goal was to resolve numerous
problems with existing network architectures.
First and foremost among these problems was that the typical network topology was centralized. A
computer network had a single point of control directing communication between all the systems belonging to
that network. From a military perspective, such a topology had a critical flaw: destroy that central point of
control and all possibility of communication was lost.
Another issue was the proprietary nature of existing network architectures. Most of them were developed
and controlled by private corporations, who had a vested interest both in pushing their own products and in
keeping their technology to themselves. Furthermore, the proprietary nature of the technology limited the
interoperability between different systems. It was important, even then, to ensure that the mechanisms for
communicating across computer networks were not proprietary or controlled in any way by private interests,
lest the entire network become dependent on the whims of a single corporation.
Thus, the DoD funded an endeavor to design the protocols for the next generation of computer
communications networking architectures. Establishing a decentralized, distributed network topology was
foremost among the design goals for the new networking architecture. Such a topology would allow
communications to continue without disruption, even if any one system was damaged or destroyed. In such a
topology, the network “intelligence” would not reside in a single point of control. Instead, it would be
distributed among many systems throughout the network.
To facilitate this (and to accommodate other network reliability considerations), ARPANET employed a
packet-switching technology, whereby a network “message” could be split up into packets, each of which might
take a different route over the network, arrive in completely mixed-up order, and still be reassembled and
understood by the intended recipient.
To promote interoperability, the protocols needed to be open: readily available to anyone who wanted to
connect their system to the network. An infrastructure was needed to design the set of agreed-upon protocols,
and to formulate new protocols for new technologies that might be added to the network in the future. An
Internet Working Group (INWG) was formed to examine the issues associated with connecting heterogeneous
networks in an open, uniform manner. This group provided an open platform for proposing, debating, and
approving protocols.
The Internet Working Group evolved over time into other bodies, such as the Internet Activities Board
(IAB), later renamed the Internet Architecture Board, the Internet Assigned Numbers Authority (IANA), the
Internet Engineering Task Force (IETF) and the Internet Engineering Steering Group (IESG). These bodies
30
defined the standards that “govern” the Internet. They established the formal processes for proposing new
protocols, discussing and debating the merits of these proposals, and ultimately approving them as accepted
Internet standards.
Proposals for new protocols (or updated versions of existing protocols) are provided in the form of Requests
for Comments, also known as RFCs. Once approved, the RFCs are treated as the standard documentation for
the new or updated protocol.
31
2.2 TCP/IP Architecture
The original ARPANET was the first fruit borne of the DoD endeavor. The protocols behind the
ARPANET evolved over time into the TCP/IP Suite, a layered taxonomy of data communications protocols.
The name TCP/IP refers to two of the most important protocols within the suite, Transmission Control
Protocol (TCP) and Internet Protocol (IP), but the suite is comprised of many other significant protocols and
services.
32
2.2.1 Protocol layers
The protocol layers (above the “layer” of physical interconnection) associated with TCP/IP are:
Because this taxonomy contains layers, implementations of these protocols are often known as a protocol
stack.
The Network Interface layer is responsible for the lowest level of data transmission within TCP/IP,
facilitating communication with the underlying physical network.
The Internet layer provides the mechanisms for intersystem communications, controlling message routing,
validity checking, and composition and decomposition of message headers. The protocol known as IP (which
stands, oddly enough, for Internet Protocol) operates on this layer, as does the Internet Control Message
Protocol (ICMP), which handles the transmission of control and error messages between systems. Ping is an
Internet service that operates through ICMP.
The Transport layer provides message transport services between applications running on remote systems.
This is the layer in which the Transmission Control Protocol (TCP) operates. TCP provides reliable, connection-
oriented message transport. Most of the well-known Internet services make use of TCP as their foundation.
However, some services that do not require the reliability (and overhead) associated with TCP make use of
User Datagram Protocol (UDP). For instance, streaming audio and video services would gladly sacrifice a few
lost packets to get faster performance out of their data streams, so these services often operate over UDP,
which trades reliability for performance.
The Application layer is the highest level within the TCP/IP protocol stack. It is within this layer that most
of the services we associate with the Internet operate.
33
2.2.2 Comparison with OSI model
During the period that TCP/IP was being developed, the International Standards Organization (ISO) was
working on its own layered protocol scheme, called Open Systems Interconnection (OSI). While the TCP/IP
taxonomy consists of five layers (if you include the physical connectivity medium as a layer), OSI had seven
layers: Physical, Data Link, Network, Transport, Session, Presentation, and Application.
There is some parallelism between the two models. TCP/IP’s Network Interface layer is sometimes called
the Data Link layer to mimic the OSI reference model, while the Internet layer corresponds to OSI’s
Network layer. Both models share the notion of a Transport layer, which serves roughly the same functions in
each model. The Application layer in TCP/IP combines the functions of the Session, Presentation, and
Application layers of OSI.
OSI never caught on and, while some people waited patiently for its adoption and propagation, it was
TCP/IP that became the ubiquitous foundation of the Internet as we know it today.
34
2.2.3 The client - server paradigm
TCP/IP applications tend to operate according to the client-server paradigm. This simply means that, in these
applications, servers (also called services and daemons, depending on the lingo of the underlying operating
system) execute by waiting for requests from client programs to arrive and processing those requests.
Client programs can be applications used by human beings, or they could be servers that need to make their
own requests that can only be fulfilled by other servers. More often than not, the client and the server run on
separate machines, and communicate via a connection across a network.
Over the years, user interfaces to client programs have evolved from command-line interfaces (CLI) to graphical
user interfaces (GUI).
Command-line programs have their origins in the limitations of the oldest human interface to computer
systems: the teletype keyboard. In the earliest days of computing, even simple text-based CRT terminals were
not available - let alone today’s monitors with advanced graphics capabilities. The only way to enter data
interactively was through a teletypewriter interface, one character at a time. A command-line interface (CLI)
prompts the user for the entry of a “command” (the name of a program) and its “arguments” (the parameters
passed to the program). The original PC-DOS operating system and Unix shells use command-line interfaces.
Screen-mode programs allow users to manipulate the data on an entire CRT screen, rather than on one line.
This means that arrow keys can be used to move a cursor around the screen or to scroll through pages of a text
document. Screen-mode programs are still restricted to character-based interfaces.
GUI programs make use of a visual paradigm that offers users a plethora of choices. For most, this is a
welcome alternative to manually typing in the names of files, programs, and command options. The graphics
are not limited to just textual characters, as in screen-mode programs. The GUI paradigm relies on windows,
icons, mouse, pointers, and scrollbars (WIMPS) to display graphically the set of available files and
applications.
Whether command-line or GUI-based, client programs provide the interface by which end users
communicate with servers to make use of TCP/IP services. Although debates rage as to whether GUIs or
CLIs are “better”, each has advantages and disadvantages for different types of users.
Under the hood, communications between client and server programs take the form of request- response
interactions. The imposition of this constraint on Internet communication protocols means that even the
most primitive command-line interface can make use of TCP/IP services. More sophisticated GUI-based
client programs often hide their command-line details from their users, employing point-and-click and drag-
and-drop functionality to support underlying command-line directives.
After the server acknowledges the success of the connection, the client sends commands on a line-by-line
35
basis. There are single-line and block commands. A single-line command, as the name implies, includes an
atomic command directive on a single line. A block command begins with a line indicating the start of the
command and terminates with a line indicating its end. For example, in the Simple Mail Transfer Protocol
(SMTP), a line beginning with the word HELO initiates an SMTP session, while a line containing just the
word DATA begins a block that ends with a line containing only a period. The server then responds to each
command, usually beginning with a line containing a response code.
A stateful protocol allows a client to support a sequence of commands. The server is required to maintain
the “state” of the connection throughout the transmission of successive commands, until the connection is
terminated. The sequence of transmitted and executed commands is often called a session. Most Internet
services (including SMTP) are session-based and make use of stateful protocols.
HTTP
HTTP is a stateless protocol (see Chapter 3). An HTTP request usually consists of a single
command and a single response. There is no built-in ability to maintain state between
transmitted commands.
Early implementations of client - server architectures did not make use of open protocols. This meant that
client programs had to be as “heavy” as the server programs. A “lightweight” client (also called a thin client)
could only exist in a framework where common protocols and application controls were associated with the
client machine’s operating system. Without such a framework, many of the connectivity features had to be
included directly in the client program, adding to its “weight”. One advantage of using TCP/IP for client-
server applications was that the protocol stack was installed on the client machine as part of the operating
system and the client program itself could be more of a thin client.
Web applications are a prime example of thin clients. Rather than building a custom program to perform
desired application tasks, web applications use the web browser, a program that is already installed on most
end-user systems. You cannot create a client much thinner than a program that users already have on their
desktops!
TCP/IP client programs open a socket, which is simply a TCP connection between the client
machine and the server machine. Servers listen for connection requests that come in through
specific ports. A port is not a physical interface between the computer and the network, but is
simply a numeric reference within a request that indicates which server program is its intended
recipient.
There are established conventions for matching port numbers with specific TCP/IP services.
For example, Telnet services listen for connection requests on port 23, SMTP servers listen to
port 25, and web servers (by default) listen to port 80.
36
37
2.3 TCP/IP Application Services
In this section, we discuss some of the common TCP/IP application services, including Telnet, e-mail,
message forums, live messaging, and file servers. Where appropriate, we compare the original TCP/IP services
with modern counterparts.
38
2.3.1 Telnet
The Telnet protocol operates within the Application layer. It was developed to support Network Virtual
Terminal functionality, which means the ability to “log in” to a remote machine over the Internet. The latest
specification for the Telnet protocol is defined in Internet RFC 854.
Before the advent of personal computers, access to computing power was limited to those who could
connect to a larger server or mainframe computer, either through a dial-up phone line or through a direct
local connection. Whether you phoned in remotely or sat down at a terminal connected directly to the server,
you used a command-line interface to log in. You connected to a single system and your interactions were
limited to that system.
With the arrival of Internet services, you could use the Telnet protocol to log in remotely to systems that
were accessible over the Internet. As we mentioned earlier, Telnet clients are configured by default to connect
to port 23 on the server machine, but the target port number can be overridden in most client programs. This
means you can use a Telnet client program to connect and “talk” to another TCP-based service if you know its
address and its port number, have proper authentication credentials, and understand the format of its
transactions with the server.
Secure Shell
The Telnet protocol is now considered a poor mechanism for connecting to remote systems,
because Telnet servers and clients transmit all their data (including passwords) unencrypted.
Secure Shell (SSH) establishes connections and transfers data over secure channels, encrypting
transmitted data and promoting security (see Section 2.3.5).
39
2.3.2 E-mail
Electronic mail, or e-mail, was probably the first “killer app” in what we now call cyberspace. Since the
Internet had its roots in military interests, naturally the tone of e-mail started out being formal, rigid, and
business-like. Once the body of people using e-mail expanded, and once these people realized what it could be
used for, things lightened up.
Electronic mailing lists provided communities where people with like interests could exchange messages.
These lists were closed systems, in the sense that only subscribers could post messages to the list or view
messages posted by other subscribers. Obviously, lists grew and list managers had to maintain them. Over
time, automated mechanisms were developed to allow people to subscribe (and, even more importantly, to
unsubscribe) without human intervention. These mailing lists evolved into message forums, where people could
publicly post messages on an electronic bulletin board for everyone to read.
These services certainly existed before the birth of the Internet. But in those days, users read and sent their
e-mail by logging in to a system directly (usually via telephone dial-up or direct local connection) and running
programs on that system (usually with a command-line interface). The methods for using these services varied
greatly from system to system, and e-mail connectivity between disparate systems was hard to come by. With
the advent of TCP/IP, the mechanisms for providing these services became more consistent, and e-mail
became uniform and ubiquitous.
The transmission of e-mail is performed through the SMTP protocol. The reading of e-mail is usually
performed through either POP or IMAP.
SMTP
As an application layer protocol, Simple Mail Transfer Protocol (SMTP) normally runs on top of TCP, though
it can theoretically use any underlying transport protocol. The latest specification for the SMTP protocol is
defined in Internet RFC 821 and the structure of SMTP messages is defined in Internet RFC 822. The
application called “sendmail” is an implementation of the SMTP protocol for Unix systems.
SMTP, like other TCP/IP services, runs as a server, service, or daemon. In a TCP/IP environment, SMTP
servers usually run on port 25. They wait for requests to send e-mail messages, which can come from local
system users or from across the network. They are also responsible for evaluating the recipient addresses found
in e-mail messages, determining whether they are valid, and whether their final destination is another
recipient (e.g., a forwarding address or the set of individual recipients subscribed to a mailing list).
If the message embedded in the request is intended for a user with an account on the local system, then the
SMTP server delivers the message to that user by appending it to their mailbox. Depending on the
implementation, the mailbox can be anything from a simple text file to a complex database of e-mail
messages. If the message is intended for a user on another system, then the server must figure out how to
transmit the message to the appropriate system. This may involve direct connection to the remote system or it
may involve connection to a gateway system. A gateway is responsible for passing a message on to other
gateways or sending it directly to its ultimate destination.
40
Before the advent of SMTP, the underlying mechanisms for sending mail varied from system to system.
Once SMTP became ubiquitous as the mechanism for e-mail transmission, these mechanisms became more
uniform. Applications responsible for transmitting e-mail messages, such as SMTP servers, are known as Mail
Transfer Agents (MTAs). Likewise, the applications responsible for retrieving messages from a mailbox,
including POP servers and IMAP servers, are known as Mail Retrieval Agents (MRAs).
E-mail client programs are engineered to allow users to read and send mail. Such programs are known as
Mail User Agents (MUAs). MUAs talk to MRAs to read mail and to MTAs to send mail. In a typical e-mail
client, once the user has composed and submitted a message, the client program directs it to the SMTP
server. First, the client connects to the server by opening a TCP socket to port 25 (the SMTP port) of the
server (even if the server is running on the user’s machine). Figure 2.1 shows an example of an interaction
between a client and an SMTP server.
The client program identifies itself (and the system on which it is running) to the server via the HELO
command. The server decides (based on this identification information) whether to accept or reject the
request. If the server accepts the request, it waits for the client to send further information. One line at a time,
the client transmits commands to the server, sending information about the originator of the message (using
the MAIL command) and each of the recipients (using a series of RCPT commands). Once all this is done,
the client tells the server it is about to send the actual data: the message itself. It does this by sending a
command line consisting of the word DATA. Every line that follows, until the server encounters a line
containing only a period, is considered part of the message body. Once it has sent the body of the message,
the client signals the server that it is done, and the server transmits the message to its destination (either
directly or through gateways). Having received confirmation that the server has transmitted the message, the
client closes the socket connection using the QUIT command.
41
Originally, SMTP servers executed in a very open fashion: anyone knowing the address of an SMTP server
could connect to it and send messages. In an effort to discourage spamming (the sending of indiscriminate
mass semi-anonymous e-mails), many SMTP server implementations allow the system administrator to
configure the server so that it only accepts connections from a discrete set of systems, perhaps only those
within their local domain. Additionally, SMTP servers can use an extension to the SMTP protocol called
SMTP-AUTH to restrict the ability to send e-mail only to authenticated users.
When building web applications that include e-mail functionality (specifically the sending of e-mail), make
sure your configuration includes the specification of a working SMTP server system, which will accept your
requests to transmit messages. To maximize application flexibility, the address of the SMTP server should be
a parameter that can be modified at run time by an application administrator.
MIME
Originally, e-mail systems transmitted messages in the form of standard ASCII text. If a user
wanted to send a file in a non-text or “binary” format (e.g., an image or sound file), it had to be
encoded before it could be placed into the body of the message. The sender had to
communicate the nature of the binary data directly to the receiver, e.g., “The block of encoded
binary text below is a GIF image.”
Multimedia Internet Mail Extensions (MIME) provided a uniform mechanism for
including encoded attachments within a multipart e-mail message. MIME supports the
definition of boundaries separating the text portion of a message (the “body”) from its
attachments, as well as the designation of attachment encoding methods, including “Base64”
and “quoted-printable.” MIME was originally defined in Internet RFC 1341, but the most
recent specifications can be found in Internet RFCs 2045 through 2049.
MIME also supports the notion of content typing for attachments (and for the body of a
message). MIME-types are standard naming conventions for defining the type of data
contained in an attachment. A MIME-type is constructed as a combination of a top-level data
type and a subtype. There is a fixed set of top-level data types, including text, image, audio,
video, and application. The subtypes describe the data in enough detail to select an appropriate
processing program. For example, there are specific programs for processing text/html,
text/plain, image/jpeg, and audio/mp3 files.
POP
The Post Office Protocol (POP) gives users direct access to their e-mail messages stored on remote systems.
POP3 is the most recent version of the POP protocol, first defined in Internet RFC 1725 and revised in
Internet RFC 1939. Most of the popular e-mail clients (including Microsoft Outlook and Mozilla
Thunderbird) use POP3 to access user e-mail. (Even proprietary systems, such as Lotus Notes, offer
administrators the option to configure remote e-mail access through POP.)
Before the Internet, people read and sent e-mail by logging in to a system and running command-line
programs. User messages were usually stored locally in a mailbox file on that system. Even with the advent of
42
Internet technology, many people continued to access e-mail by establishing a Telnet connection to the
system containing their mailbox and running command-line programs (e.g., from a Unix shell) to read and
send mail. (Some people who prefer command-line programs still do!)
Let us look at the process by which POP clients communicate with POP servers to provide user access to e-
mail. First, the POP client must connect to the POP server (which usually runs on port 110), so it can identify
and authenticate the user to the server. This is usually done by sending the user name (user id) and password
one line at a time, using the USER and PASS commands. (Sophisticated POP servers may make use of the
APOP command, which allows the secure transmission of the user name and password as a single encrypted
entity across the network.)
Once connected and authenticated, the POP protocol offers the client a variety of commands it can
execute. Among them is the UIDL command, which responds with an ordered list of message numbers,
where each entry is followed by a unique message identifier. POP clients can use this list (and the unique
identifiers it contains) to determine which messages in the list qualify as “new” (i.e., not yet seen by the user
through this particular client). Having obtained this list, the client can execute the command to retrieve a
message (RETR n). It can also execute commands to delete a message from the server (DELE n) or retrieve
just the header of a message (TOP n 0).
Message headers contain metadata about a message, such as the addresses of its originator and recipients, its
subject, etc. Each message contains a header block (see Figure 2.2) containing a series of lines, followed by a
blank line indicating the end of that block.
The information that e-mail clients include in message lists (e.g., the From, To, and Subject of each
message) comes from the message headers. As e-mail technology advanced, headers began representing more
sophisticated information, including MIME-related data (e.g., content types) and attachment encoding
schemes.
Figure 2.3 provides an example of a simple command-line interaction between a client and a POP server.
GUI-based clients often hide the mundane command-line details from their users. The normal sequence of
operation for most GUI-based POP clients today is as follows:
1. Get the user id and password (the client may already have this information or may need to
prompt the user).
2. Connect the user and verify identity.
3. Obtain the UIDL list of messages.
4. Compare the identifiers in this list to a list that the client keeps locally, to determine which
messages are “new”.
5. Retrieve all the new messages and present them to the user in a selection list.
6. Delete the newly retrieved messages from the POP server (optional).
Although this approach is simple, it is inefficient. All the new messages are always downloaded to the
client. This is inefficient because some of these messages may be quite long or have extremely large
attachments. Users must wait for all of the messages (including large or unwanted messages) to download
before viewing any of the messages they want to read. The current proliferation of spam makes this even more
important today than it was in the past. It would be more efficient for the client to retrieve only message
43
headers and display the information in a message list. It could then allow users the option to selectively
download desired messages for viewing or to delete unwanted messages without downloading them. A web-
based e-mail client helps remove some of this inefficiency.
IMAP
Some of the inefficiencies of the POP protocol can be alleviated by the Internet Message Access Protocol
(IMAP). IMAP was intended as a successor to POP, offering sophisticated services for managing messages in
remote mailboxes. IMAP servers provide support for multiple remote mailboxes or folders, so that users can
move messages from an incoming folder (the “inbox”) into other folders kept on the server. In addition, they
also provide support for saving sent messages in one of these remote folders and for multiple simultaneous
operations on mailboxes. IMAP servers commonly listen on TCP port 143.
IMAP4, the most recent version of the IMAP protocol, was originally defined in Internet RFC 1730, but
the most recent specification can be found in Internet RFC 2060. The approach used by IMAP differs in
many ways from that of POP. POP clients download e-mail messages from the server. The default behavior
for many POP clients is to delete messages from the server following the download; in practice, many users
elect to leave viewed messages on the server, rather than deleting them after viewing. This is because many
44
people who travel extensively want to check e-mail while on the road, but want to see all of their messages
(even the ones they’ve seen) when they return to their “home machine.” While the POP approach “tolerates”
but does not encourage this sort of user behavior, the IMAP approach eagerly embraces it. IMAP was
conceived with “nomadic” users in mind: users who might check e-mail from literally anywhere, who want
access to all of their saved and sent messages wherever they happen to be. IMAP not only allows the user to
leave messages on the server, it provides mechanisms for storing messages in user-defined folders for easier
accessibility and better organization. Moreover, users can save sent messages in a designated remote folder on
the IMAP server. While POP clients support saving of sent messages, they usually save those messages
locally, on the client machine.
IMAP e-mail client programs work very similarly to POP e-mail clients. In fact, many e-mail client
programs allow users to operate in either POP or IMAP mode. However, the automatic downloading of the
content and attachments for incoming messages does not occur by default in IMAP clients. Instead, an IMAP
client downloads only the header information associated with new messages, requesting the body of an
individual message only when user expresses interest in seeing it.
POP vs IMAP
Although it is possible to write a POP client that downloads only the header information until
the user expressly looks at a message, most do not. POP clients tend to operate in “burst”
mode, getting all the messages on the server in one “shot.” While this may be in some respects
inefficient, it is useful for those whose on-line access is not persistent. By getting all the
messages in one burst, users can work off-line with the complete set of downloaded messages,
connecting to the Internet again only when they want to send responses and check for new
mail.
IMAP clients assume the existence of a persistent Internet connection, allowing discrete
actions to be performed on individual messages, while maintaining a connection to the IMAP
server. Thus, for applications where Internet connectivity may not be persistent (e.g., a
handheld device where Internet connectivity is paid for by the minute), POP might be a better
choice than IMAP.
Because IMAP offers many more options than POP, the possibilities for what can go on in a user session
are much richer. After connection and authentication, users can check new messages, recently seen messages,
unanswered messages, flagged messages, and drafts of messages yet to go out. They can view messages either
in their entirety or in part (e.g., header, body, attachment). They can delete or move messages to other folders.
They can also respond to messages or forward them to others.
IMAP need not be used strictly for e-mail messages. Because security features allow mailbox folders to be
designated as “read only”, IMAP can be used for “message board” functionality as well. However, such
functionality is usually reserved for message forum services.
Today, web-based e-mail systems, such as Hotmail, Yahoo! Mail, and Gmail, provide users with the means to
45
Other documents randomly have
different content
knew he was a just man, and would punish the rich as well as the
poor, if they did wrong. King Henry the Fourth died in 1413, in the
fourteenth year of his reign.
20. Henry the Fifth is famed as the conqueror of France. He went
to war with that country, on the same pretext that Edward the Third
did before; and with better success, for the French king was at last
glad to make peace by agreeing that Henry should be king of France
after his death.
21. The greatest victory gained by the English, was at the battle of
Agincourt. King Henry married the French king’s daughter, but he
died soon afterwards, in 1422, having reigned nine years; and
leaving an infant son; and in a little while the king of France died
too, and he also left a son.
22. Then there was a dispute which of these princes should be
king of France, and a new war was begun which lasted many years,
during which the English lost all that the armies of Henry the Fifth
had won.
23. In the mean time the young king, Henry the Sixth, grew up so
weak in mind and sickly in body, that he was not able to govern the
country; therefore, his ministers and the queen, a French princess,
named Margaret of Anjou, had to manage every thing for him.
24. But many people did not like the queen, and began to say that
her husband had no right to the throne as his grandfather was a
usurper; but that Richard, Duke of York, ought to be king of
England; while others said that, as the Parliament had consented to
let the family of the Duke of Lancaster reign, it was lawful for them
to keep the crown; and that although king Henry was not fit for a
ruler, the rights of his son, prince Edward, ought to be protected.
25. The Duke of York was then governor of Ireland, but when he
heard of these disputes, he came back, and was placed at the head
of the government here, instead of the queen.
26. I think you will now quite understand why there was a civil
war in England. Every nobleman in the country took one side or the
other, and the friends of the Duke of York wore a white rose or
ribbon rosette; while those who supported the king, or House of
Lancaster, wore a crimson one; as people now wear different colored
ribbons at an election, to show which party they belong to; and this
is why these wars are called the Wars of the Roses.
QUESTIONS.
EDWARD IV.
1. The civil wars may be said to have lasted thirty years, from the
first battle at St. Alban’s, in 1455, to the battle of Bosworth, in 1485;
for although there were intervals of peace, the quarrel between the
house of York and Lancaster was not finally settled till the two
families were united by the marriage of Henry the Seventh, who was
heir of the House of Lancaster, with Elizabeth, the grand-daughter of
Richard, Duke of York, and heiress of that family.
2. During that thirty years, the country was, as you may suppose,
in a very unhappy condition. Every Baron wanted to collect as many
men around him as he could, to defend his castle in case of siege;
so the countrymen left their rural labors and went to enlist in the
service of this or that nobleman, because they were sure of getting
plenty to eat and drink.
3. Thus the castle halls were crowded, but the fields were left
without sufficient laborers to plough and sow them, consequently
the crops were generally bad, and bread was at times, so dear, that
many poor families could get none at all, but were obliged to eat
herbs and berries that they found in the woods, which did not
nourish them, so that numbers died of want.
4. Many battles were fought in different parts of England, and the
queen was present at some of them, for it was she who conducted
the war, as the king was incapable of so much exertion, and
Margaret could not bear to see her young son Edward deprived of
his birthright.
5. Three victories had been gained by the Duke of York, when he
was killed at the battle of Wakefield; but this event did not put an
end to the contest, for his son Edward, who succeeded to his title,
continued the war and, in the end, became king of England, while
poor king Henry was kept a prisoner in the Tower, where he died in
1471.
6. Edward owed his success chiefly to the Earl of Warwick, the
richest and most powerful nobleman in England, and considered as
the last of the great feudal Barons, for it is said that he maintained
no less than thirty thousand people at his own expense, who were
ready to devote their lives to his service.
7. He had a great many castles in different parts of England, and a
noble mansion in Warwick lane, London, which still bears that name,
although it presents a very different appearance from what it did
when this mighty Earl lived there like a sovereign prince, and the
place was crowded with his armed retainers.
8. Edward had been very well received by the citizens of London,
and crowned, with their consent, long before the death of king
Henry.
9. Two battles were fought soon after his accession to the throne,
one at Towton the other at Hexham; and it was after the latter, that
a story is told how queen Margaret wandered about in a forest with
her little boy, till they were both half dead with hunger and fatigue,
when she met with a robber, and instead of trying to avoid him, told
him who she was, and begged he would protect her child.
10. The man took them to a cave, and gave them food and
shelter, until he found an opportunity of getting them on board a
vessel that was going to Scotland.
11. People were now in hopes there would be peace; but the new
sovereign was so unwise as to quarrel with the Earl of Warwick, who
became his enemy, and resolved to deprive him of the crown he had
helped him to win.
12. Then the war was begun again, and went on for several years
longer, till Warwick was killed at the battle of Barnet, on Easter
Sunday, 1471, just ten years after the battle of Towton.
13. On the day of this battle, queen Margaret, and her son, prince
Edward, then a youth of eighteen, landed in England, for they had
lived in France some years, and were sadly grieved at the news of
Warwick’s defeat and death; but as they had a great many friends,
the queen determined upon trying another battle, which was a great
pity, for both herself and her son were made prisoners, and the
young prince was killed in king Edward’s tent, for making a spirited
answer to some insulting question put to him by the haughty
monarch.
14. The miserable mother was sent to the Tower, where her
husband had just died; but she was afterwards released, and
ransomed by her father; and she returned to live with him in France,
her native country.
15. And now, that we have done with the wars, we may begin to
think of something more pleasant. Have you ever heard it was in the
reign of Edward the Fourth that books were first printed in England?
16. The art of printing, which enables us to have so many nice
books to instruct and amuse us, had lately been invented in
Germany, and was brought here by an English merchant, named
William Caxton, who went to Cologne, on purpose to learn how to
print, and when he came back, he set up a printing-press in
Westminster Abbey, which, at that time, was a monastery.
17. We ought to be very much obliged to the clever person that
invented printing; for only think how very ignorant we should be,
and how much pleasure we should lose, if there were no books to
tell us any thing.
18. There were books, certainly, before that time; but they were
all written, and it took so long to copy them, that they were very
expensive, so that none but very rich people could have even a few
volumes.
19. Printed books were also, for a long time, much too dear to be
in general use, but people of rank soon began to be much better
educated than in former times, and their habits and manners
became much improved in consequence.
20. Then a great many of the old Norman castles had been
destroyed in the wars, which put an end, after a time, to the
customs of chivalry; and the nobles, instead of sending their sons to
be brought up for warlike knights, sent them to Oxford, or
Cambridge, to become scholars; or to Eton College, which had been
founded by Henry the Sixth.
21. King Edward died in 1483, when his eldest son, who is called
Edward the Fifth, although he never was really king, was only
thirteen years old; and he, and his younger brother, the Duke of
York, were under the guardianship of their uncle Richard, Duke of
Gloucester, who was a very bad man.
22. Instead of protecting the fatherless children entrusted to his
care, he only thought how he might take advantage of their youth to
obtain the crown himself; so he sent them both to the Tower, but
not as prisoners, for it was then used occasionally as a royal
residence, especially in times of public disturbances; so Richard told
the people the boys would be safe there; but in a little while it was
reported that they were dead, and it was thought he had caused
them to be murdered, which was most likely the truth, although
some people think they were not put to death, but were kept there
as prisoners for some years.
23. Richard the Third was not a very bad king, for he made some
laws that were very useful to the merchants who traded with foreign
countries, and he was the first who thought of having postmen, or
couriers, to carry letters, so that, wicked as he was, we cannot say
he did no good as a sovereign.
24. The post was, at first, only for government letters, and it was
a long time before any arrangements were made for private persons
to correspond by the same means; but this was done by degrees,
and in the time of Oliver Cromwell, the General Post Office was
established, when everybody had the benefit of this excellent
institution, which adds so much to people’s happiness; for who could
possibly be happy now, if they could not hear from their absent
friends?
25. Richard the Third reigned only two years, for he was disliked
by the nobility, and a conspiracy was formed against him by the
friends of the House of Lancaster, who were desirous of placing on
the throne the heir of that family, Henry Tudor, Earl of Richmond.
26. This young nobleman was living in exile, at the time, in
France. But he was soon informed of what was going on, and told
the French king, who lent him forty ships, and about five thousand
soldiers, with which he sailed directly for England, where he found
friends ready to join him with more troops.
27. The battle of Bosworth was fought on the 22nd of August,
1485, when Richard was killed, and the conqueror proclaimed king
on the field; and thus ended the Wars of the Roses.
QUESTIONS.
1461 TO 1558.
1. Henry the Seventh was not an amiable man, but he had many
qualities that were good and useful in a sovereign, and the country
prospered greatly under his government.
2. One of the conditions on which he succeeded to the throne,
was that he should marry the princess Elizabeth, daughter of Edward
the Fourth, and thus secure peace by uniting the families of York
and Lancaster:—the princess Elizabeth was a lady much beloved by
every body, and her many acts of benevolence were long
remembered in England, so that she was generally called the good
queen Bess.
3. The king wished to increase the wealth and prosperity of the
nation, and he took the best means of doing so by promoting
commerce. He made commercial treaties, that is, agreements about
trade, with foreign princes, by which he obtained many advantages
for the English merchants, just as our government has lately made a
treaty with the emperor of China, about our trade in his country.
4. No English ship had ever been to China then, nor even to India;
and America had not yet been discovered; but in the time of Henry
the Seventh, the Spaniards and Portuguese made longer voyages
than had ever been made before, and the celebrated Christopher
Columbus, whom I dare say you have often heard of, found out by
study, that there was an unknown land on the other side of the
Atlantic Ocean, and although people laughed at him, he at last
persuaded the king and queen of Spain to let him have ships, and
sailors, and money, to go in search of it, so he was the first that
found out the way to America, which, for a long time, was called the
New World.
5. Soon after this, the Portuguese found out the way to India by
sea; and then the English began to make voyages of discovery also,
and to find that the world had more countries in it than they had
ever dreamed of before.
6. Maps and charts, which had been known to the Greeks and
Romans, now began to be much improved, though they were still
incorrect, as you may suppose.
7. However, all these new discoveries, together with the invention
of printing, made people think more about learning, and less about
fighting than they used to do; especially as the nobility were
beginning to live more in the way they do now, and to have
handsome houses in London, instead of living always in their gloomy
old castles.
8. Their domestics were no longer slaves, but hired servants; their
tenants were not villeins, but free farmers, who paid rent for their
land; and the poor peasantry, no longer in bondage, were at liberty
to go where they pleased, and were paid for their daily labour.
9. You remember that in the feudal times all the land in the
country belonged to the king, the nobles, the knights, and the
bishops, and abbots.
10. But Edward the First made a law in favour of the sale and
purchase of all lands except those held immediately of the king; and
Edward the Third gave his own vassals leave to sell their estates.
11. Other laws were afterwards made, by which landed property
was made liable to seizure for debt, and might be given by will, or
sold at the pleasure of the owner. And Henry the Seventh, by
another law, further encouraged the sale of land, and the
consequent division of large estates.
12. Then many of the nobles, who had more land than they
wanted, sold some of it to wealthy merchants and others, who built
large mansions, to which they often gave their own family name, as
for instance, if the name of the proprietor happened to be Burton,
he would probably call his residence Burton Hall.
13. These country gentlemen formed quite a new class of people
in England, and they have ever since that time continued to increase
in wealth, rank, and importance.
14. A strange thing happened in the reign of Henry the Seventh,
which has made some people think the sons of Edward the Fourth
were not put to death in the Tower, as is generally believed, but you
shall hear the story.
15. A young man, called Perkin Warbeck, came to Ireland from
Flanders, and declared he was the younger of those two princes,
and the lawful heir to the throne, as his brother was dead.
16. He told a wonderful tale, how he had escaped from the Tower,
and related many adventures which he said had befallen him; so the
Irish people said they would fight for him, and try to take the crown
from king Henry; but as they could not raise a sufficient force by
themselves, Warbeck applied to the king of France, who also
promised to help him, and then he went to the Duchess of
Burgundy, who was Edward the Fourth’s sister, and, strange to say,
that lady declared she believed the young man was her brother’s
son, and persuaded the Flemings to lend him their aid.
17. But the king of France changed his mind; and made a treaty of
peace with king Henry, who ordered the English merchants not to
carry on any trade with Flanders while the Flemings continued to
favour the cause of Perkin Warbeck, so they deserted him too.
18. I have not the room to tell you the rest of his adventures, but
they ended in his being taken prisoner by the king, who had him put
to death as a traitor. Henry the Seventh reigned twenty-four years,
and was succeeded in 1509 by his son, Henry the Eighth.
19. The young king was married to Catharine of Arragon, the
daughter of the king of Spain, a beautiful and talented woman, who
deserved a better husband, for Henry was a sad tyrant in his family,
as well as over the nation.
20. The greatest man in the kingdom next to the king, was his
minister, Cardinal Wolsey, who governed the country for many years,
and was so rich, that he not only lived in as much splendour as the
king, but he built the palaces of Hampton-court and Whitehall, and
founded the College of Christ Church at Oxford.
21. A Cardinal is a priest of high dignity in the Catholic Church,
being next in rank to the Pope.
22. Wolsey was clever and learned; but he was very proud, so he
had many enemies, and at last fell into disgrace with the king, and
died of grief.
23. Soon after this Henry chose to be separated from his good
wife, Catharine, because he had seen a young lady named Anna
Boleyn, whom he thought he should like to marry; so he sent the
queen and his daughter Mary, away from court, and made Anna
Boleyn queen; but he soon began to dislike her, and said she had
done some very wicked things, as an excuse for sending her to the
Tower, where he had her head cut off; and then he married another
young lady, named Jane Seymour, who soon died. She left a little
baby, who was king Edward the Sixth; and Anna Boleyn also had a
baby, who was queen Elizabeth.
24. I must now tell you of a great change made by Henry the
Eighth, with regard to religion, and called the Reformation.
25. The church of England had, till this period, been the same as
that of Rome, and the people were Roman Catholics; but there were
a good many people in Germany, and in England also, who thought
that some of the forms of the Catholic religion were not right, and
ought to be altered, and these persons were called reformers, and
all who adopted their opinions took the name of Protestants,
because they protested against certain things.
26. Now Henry the Eighth had a disagreement with the Pope,
about his second marriage; so he determined to abolish the Catholic
religion, to seize on and destroy the monasteries and nunneries, and
to have Protestant clergymen to preach and read the prayers in the
churches.
27. It would be too long a story to tell you how he accomplished
all this; but it was done. There were nearly a thousand religious
houses, that is, convents, abbeys, and priories, in England, inhabited
by monks and nuns, clerks and friars, of different orders, who had
no other homes, nor any means of living, but on the property of the
establishments to which they belonged; and these were all
suppressed, together with many colleges and hospitals, which also
supported a great many poor people.
28. The poor were very sorry the convents were broken up, for
they had been accustomed to go there when they were in distress,
for food, clothing, or medicine; and now they did not know where to
get relief, as there were no workhouses; the hospitals, and all other
charitable institutions, except some alms-houses, having been
destroyed; nor was it till almost the middle of the reign of queen
Elizabeth that any provision was made by law for the destitute poor.
29. The manufactures of England were now fast increasing.
Manchester, Birmingham, and Sheffield, were beginning to be known
as manufacturing towns; the first, for woollens and cottons; the
others, for cutlery and hardware.
30. Pewter plates and dishes were made in large quantities, for
they were now used in the most respectable families instead of
wood; hats were also made in England in this reign; and a clock, the
first ever manufactured in this country.
31. But nothing was more useful than the improvements made in
gardening, for which we are indebted to the Flemings and Dutch,
who were the best gardeners in Europe, and who brought here
many kinds of vegetables for the table, such as cabbages, lettuces,
&c., and many fruits that had not been cultivated in England since
the time of the Romans, particularly cherries and currants.
32. Potatoes were not known until the reign of queen Elizabeth,
when Sir Walter Raleigh brought some from America, and planted
them, first in Ireland, little thinking, perhaps, that this root would, at
a future time, be almost the only food of the Irish people.
33. Henry the Eighth had three more wives, Anne of Cleves, whom
he divorced; Catherine Howard, whom he had beheaded, like poor
Anna Boleyn; and Catherine Parr, who outlived him.
34. He reigned thirty-eight years, and was succeeded by his son,
Edward the Sixth, who was only nine years old, and died before he
was sixteen; so that he can scarcely be reckoned among the kings of
England.
35. He was a pious and amiable prince, fond of learning, and
extremely charitable. He founded St. Thomas’s Hospital, for the sick
poor; and Christ’s Hospital and School, for the education of boys
who had lost their fathers.
36. He had a cousin, Lady Jane Grey, whom he was very fond of,
for she was about his own age, gentle and beautiful, and being fond
of study, was educated with him; so that it was no wonder he liked
her.
37. They were both Protestants; but Edward’s eldest sister, Mary,
was a Catholic; and as some of the great noblemen were
Protestants, they did not like to have a Catholic queen; so when the
young king was dying, they persuaded him to make a will, leaving
the crown to Lady Jane Grey, which was not right, because his father
had ordered, and the parliament confirmed his will, that, if he died,
Mary was to be queen. Edward the Sixth died in the seventh year of
his reign.
38. Lady Jane was married to young Lord Guildford Dudley, and
knew nothing about king Edward’s will till after he was dead, when
her husband’s father told her she was to be queen.
39. At first she refused, but was, at length, persuaded or
compelled to allow herself to be proclaimed; and very unhappy it
made her, so that she was very glad, at the end of ten days, to give
up the title of queen to her who had a better right to it.
40. Now Mary was a woman of a morose temper; and,
unfortunately, at that time, and long afterwards, people who differed
in religious opinions were very cruel to each other; so she would not
forgive poor Lady Jane Grey, but sent her and her husband to the
Tower, where they were both beheaded.
41. The reign of queen Mary lasted only five years, and there is
little to tell about it, except that she did all she could to restore the
Roman Catholic religion, and re-established some of the
monasteries; but they were suppressed again, after her death, by
her sister Elizabeth, who had been brought up in the Protestant
faith.
QUESTIONS.
QUEEN E L I Z A B E T H .— 1 5 5 8 TO 1603.
QUESTIONS.
TO 1689.
CROMWELL EXPELLING THE MEMBERS OF PARLIAMENT.
1. The people of Scotland did not like the union of the two
kingdoms, at first, because the king and many of the nobility went
away to live in London, which, as there was little trade, left Scotland
in a very poor condition; and it was a long time, indeed, not before
the people had experienced the great benefits of British trade and
commerce, that they began to feel as a part of the English nation;
but now that the English and Scots have become like one people, it
is certainly much happier and better for both.
2. James had not been king two years, when a conspiracy was
formed against the government, called the Gunpowder Plot. I cannot
tell you for certain by whom it was contrived, but it was a wicked
scheme to blow up the houses of parliament, when the king, and
most of the lords and commons were there assembled; but, happily,
it was discovered a short time before the meeting of parliament, and
all the greatest men in the country were saved from a dreadful
death.
3. James the First was not a good king, for he had a mistaken
notion that a king ought to do whatever he liked; and that, if he
wanted money he had a right to make new taxes, without the
consent of parliament, and, in fact, he thought it unnecessary to
have any parliament at all, and he taught his son Charles to be of
the same opinion, which was the cause of that monarch’s untimely
fate, and the civil wars that you will presently read about.
4. In the reign of James the First, there were such severe laws
against those who did not conform to the church of England, that
hundreds of people emigrated to America, and settled themselves in
colonies in a wild country, where at first they suffered many
hardships and privations; but these colonies, and others, afterwards
formed, gradually improved, till they became large flourishing states,
now called the United States of America.
5. James the First reigned twenty-two years, and was succeeded,
in the year 1625, by his son Charles, whose bad education led to all
the miseries of a long civil war, and to misfortunes that fell upon his
own head.
6. The quarrels between Charles and the parliament, arose from
his taking upon himself the power of raising money by taxes,
without the consent of the House of Commons; and in other things
he chose to act by his own will, although it might be quite contrary
to the laws of the country.
7. Many people were put in prison because they would not lend
him money when he desired it; and, at last, he dissolved the
parliament altogether, and said he would govern without one, and
then the people had no protection from his tyranny.
8. Those who were treated the worst were the Puritans, a
religious sect, whose form of worship was very similar to that of the
present Scottish Church, which is different from the English, as they
have no bishops, do not use prayer books, and have particular rules
about choosing their own clergymen.
9. The Scots who hold these opinions are called Presbyterians.
The Puritans dressed very plainly, like quakers, and had their hair cut
close, and on that account they obtained the name of Roundheads;
and those who took part against the king in the civil war, generally
adopted that fashion, and were distinguished by that name.
10. After a time, the king began to find that, if he continued to
govern by himself, there would certainly be a serious rebellion; so he
consented to have a new parliament, and there was an election
directly, and as many of the new members were Puritans, they
perhaps wanted the king to yield too much, and thus provoked him
not to give up so much as he ought.
11. I cannot tell how this might be; but a great many people at
length began to think it would be better to have a Republic, that is,
a government without a king, and many of the Puritans were of that
opinion.
12. Charles had undoubtedly brought all his troubles upon himself,
but it was now evident he must either give up his authority as a
sovereign, or fight to maintain it; so he chose the latter alternative,
and a war was commenced between the king and the parliament.
Each party raised a large army.
13. The queen, who was sister to the French king, went to France,
to raise money to pay soldiers to fight for her husband, and to bring
arms for them. He was supported by most of the English nobility,
while the principal commoners sided with the parliament.
14. The first general for the parliament was the Earl of Essex, who
resigned in favor of general Fairfax, but the greatest general of the
parliamentary army was a country gentleman named Oliver
Cromwell, who was very clever, both as a military officer and a
statesman; and, after the death of Charles, he became the ruler of
England.
15. The war caused a great deal of unhappiness in private
families; for, although it was principally the soldiers who fought,
everybody was interested in the question whether there should be a
king, or not; and such violent quarrels arose, that the nearest
relatives, even fathers and sons, and brothers often became
enemies, and many young men went to join one army, or the other;
so that sometimes two brothers might be on different sides; and
then think how dreadful it was, when a battle took place, that they
should be fighting against each other.
16. The Royalists, who were called Cavaliers, were known from
the Roundheads by their handsome style of dress, for they wore
colored doublets made of silk or satin, with lace collars falling over
them, and a short cloak over one shoulder. Their hair was curled in
long ringlets, and their broad hats adorned with long feathers.
17. There was as much difference in dress between the ladies as
the gentlemen, for the female Roundheads were very plain and prim
in their attire, while the Royalists were dressed in the gayest fashion.
18. I shall not enter into the particulars of the war. It is enough to
say that after it had gone on three years, the king was totally
defeated, at the battle of Naseby, in Northamptonshire, and soon
afterwards was made prisoner.
19. The Republicans then had it all their own way. The king was
brought to trial on a charge of having broken the laws of the
country; was condemned to death, and beheaded at Whitehall,
January 30th, 1649.
20. But the civil war did not end with the death of Charles the
First, for his son, prince Charles, who was in Holland at the time,
went to Scotland, where the generality of the people were not
disposed to have a republican government, so they made the prince
promise not to interfere with their religion, but to join the
Presbyterians, and then they proclaimed him king, and soon raising
an army, he marched into England.
21. A battle was fought at Worcester, where Cromwell gained a
great victory, and the young king had to make his escape, in
disguise, with a few friends, who were anxious to get him safely out
of the country; and many curious adventures they met with, for
parties of the republican soldiers were sent off in all directions in
pursuit of the fugitive prince, who was several times very nearly
caught.
22. His escape was chiefly owing to the fidelity of five brothers,
named Penderel, farmers and woodmen, who were tenants of a
gentleman that was warmly attached to the Royal family. They lent
him a woodman’s dress, called him Will Jones; and rode about with
him, to show him what houses he might safely go to for shelter and
entertainment.
23. On the third day after the battle, he was obliged to hide in a
wood, in Boscobel, on the borders of Staffordshire, where he met
with a friend, Major Carlis, who was hiding himself.
24. They heard soldiers about the wood, so they both got up into
an old oak tree, with some bread and cheese and beer, that one of
the Penderels had brought to Charles, and while they were there,
they heard the soldiers talking close under the tree, and saying how
glad they should be to find the king, and that they were sure he
must be somewhere thereabouts.
25. The tree was afterwards called the Royal Oak; and there is a
tree now on the same spot, raised from an acorn of the original one,
which is still distinguished by that name.
26. One time he travelled with a lady, as her groom, and when
they stopped at an inn, he went into the kitchen, where the cook
told him to wind up the jack, which he did so awkwardly, that she
scolded him.
27. He made an excuse, saying that where he came from, they did
not have roast meat very often, and never used a jack; but I dare
say, he laughed heartily afterwards, for he was always merry in the
midst of his troubles.
28. At last, after being at hide and seek for nearly two months, he
embarked at Shoreham, and reached the continent in safety.
29. Great Britain was now not a kingdom, for there was no king,
but it was a Republic, or Commonwealth, which is a government
managed by the people, or their representatives in parliament.
30. But Oliver Cromwell was an ambitious man, and wanted to
have all the power in his own hands; so he got the soldiers on his
side, and then told the members of parliament that it was time for
them to go out of office, that there might be a new election; and on
their refusal, he went to the House of Commons with a regiment of
soldiers, turned out the members, locked the doors, and took away
the keys.
31. He soon formed a new Parliament of men who were devoted
to his interest, and he was made chief ruler of the state, under the
name of Protector of the Commonwealth; but he might as well have
been called king, for he was almost as absolute a sovereign as any
that had yet reigned.
32. However, he made a good use of his power by promoting
trade, and foreign commerce, besides which, he had an excellent
army, and a good navy, so that England was considered of more
importance, by other nations, than it had ever been before.
33. The English Admiral, Blake, gained some great victories over
the Dutch at sea; and some conquests were made both in the East
and West Indies, particularly that of Jamaica, which was taken from
the Spaniards.
34. The English people obeyed Cromwell more from fear than
love, yet he had so many great qualities that he was respected, as
well as feared. Milton, the poet, was one of his secretaries, and was
much attached to him, as I believe most people were, who belonged
to his domestic circle, for Cromwell was kind and mild in his family,
although severe and determined in his public character.
35. There was not much merriment in England, while he was its
ruler, for the Puritans thought it sinful to dance, or feast, or sing, or
play at any games; so all the theatres and other places of public
amusement were ordered to be shut up, even at Christmas, which
had previously been a very gay time, when everybody, rich or poor,
used to make holiday for twelve days; and in every country mansion,
there was a good Christmas dinner, and plenty of fun afterwards, old
and young playing at forfeits, blindman’s buff, and other Christmas
gambols, in the great hall.
36. But these frolics were forbidden in Cromwell’s time, and if any
merry-hearted folks indulged in such doings, it was by stealth, and
they kept it secret.
37. The prim dress, and hats with high crowns, were worn by both
sexes; for if any persons had dressed in a gayer fashion, they would
have been taken for Royalists. Cromwell died six years after he was
made Protector, and ten from the death of Charles the First.
38. A great many improvements were made during the
Commonwealth; for instance, coffee, sugar, and India muslins, were
first brought to this country.
39. When Oliver Cromwell was dead, his son Richard was made
Protector; but he liked a quiet life, and soon gave up the
troublesome task of ruling the country; and as most people were
now of opinion it was better to have a king than not, the parliament
resolved to recall Charles, who was residing in Holland, and
messengers were sent to tell him that he would be restored to the
throne, on condition that all persons should have liberty to follow
their religious belief, and that no one should be punished for having
taken part against him, or his father, before.
40. He returned to England, and entered London in great state, on
the 29th of May, 1660, on which day, every year, you may always
Welcome to Our Bookstore - The Ultimate Destination for Book Lovers
Are you passionate about books and eager to explore new worlds of
knowledge? At our website, we offer a vast collection of books that
cater to every interest and age group. From classic literature to
specialized publications, self-help books, and children’s stories, we
have it all! Each book is a gateway to new adventures, helping you
expand your knowledge and nourish your soul
Experience Convenient and Enjoyable Book Shopping Our website is more
than just an online bookstore—it’s a bridge connecting readers to the
timeless values of culture and wisdom. With a sleek and user-friendly
interface and a smart search system, you can find your favorite books
quickly and easily. Enjoy special promotions, fast home delivery, and
a seamless shopping experience that saves you time and enhances your
love for reading.
Let us accompany you on the journey of exploring knowledge and
personal growth!
ebookgate.com