Web Server Programming
Buy Rights Online Buy Rights

Rights Contact Login For More Details

  • Wiley

More About This Title Web Server Programming

English

When the web transitioned from a publishing to an interactive e-commerce medium, standardised web-browsers entered widespread use and developers were able to rely on a relatively stable client component. Since then, server-side developments have blossomed and resulted in considerable ease of programming, efficiency and increasing sophistication of the server-side environment.
Focusing on various technologies that support the server-side processing of data from web-based forms, principally CGI style programs, scripting and Java solutions, this is a book tailored to the technical and computational components of running a commercial and successful website. To benefit most from this approach, you will have a working knowledge of HTML, some programming experience in Java or C++, and limited experience with databases. Its concentration on server-side to the exclusion of web-page design and client-side concerns will be welcomed by practitioners and students who want hands-on and in-depth guidance on:
* Setting up and running an Apache server
* Use of Perl for web CGI programming and support administrative tasks
* PHP Scripting - ideal for prototyping small web services
* Servlet technologies
* JSP - separating the issues of business programming and presentation
* XML - a few of its applications
* Advanced services with EJBs
* NET's new world order - a better model for client/server interaction
The unified presentation allows for evaluation and comparison and cuts down on tedious duplication of content. Use it as a map to navigate the strengths and niches of each of the tools to help judge which best suits your environment and requirements. Realistic examples help to ground this broad coverage of server technologies and will prove invaluable for web masters, systems administrators and students looking for careers requiring web programming skills. Please visit booksite: www.uow.edu.au/~nabg/WebServer

English

Neil Gray, University of Wollongong, Australia.

English

Preface xi

1 Introduction 1

1.1 Servers on the Internet 2

1.2 Serving static hypertext 6

1.3 Serving dynamically generated hypertext 8

1.4 Forms and CGI 11

1.5 A CGI program and examples 18

1.6 Client-side scripting 29

Exercises 32

Practical 32

Short answer questions 32

Explorations 33

2 HTTP 35

2.1 Requests and responses 36

2.1.1 Requests 38

2.1.2 Responses 40

2.2 Authorization 41

2.3 Negotiated content 43

2.4 State in a stateless protocol 44

Exercises 45

Short answer questions 45

Explorations 45

3 Apache 47

3.1 Apache’s processes 48

3.2 Apache’s modules 51

3.3 Access controls 54

3.4 Logs 58

3.5 Generation of dynamic pages 61

3.6 Apache: installation and configuration 64

3.6.1 Basic installation and testing 64

3.6.2 The httpd.conf configuration file 67

Exercises 71

Practical 71

Short answer questions 75

Explorations 76

4 IP and DNS 77

4.1 IP addresses 78

4.2 IP addresses and names 81

4.3 Name resolution 84

4.4 BIND 86

Exercises 89

Practical 89

Short answer questions 90

Explorations 90

5 Perl 91

5.1 Perl’s origins 92

5.2 Running Perl, and the inevitable ‘Hello World’ program 93

5.3 Perl language 94

5.3.1 Scalar variables 95

5.3.2 Control structures 98

5.4 Perl core functions 101

5.5 ’CS1’ revisited: simple Perl programs 103

5.5.1 Burgers 103

5.5.2 ls -l 105

5.6 Beyond CS1: lists and arrays 108

5.6.1 Basics of lists 108

5.6.2 Two simple list examples 112

5.7 Subroutines 118

5.8 Hashes 120

5.9 An example using a hash and a list 122

5.10 Files and formatting 123

5.11 Regular expression matching 126

5.11.1 Basics of regex patterns 128

5.11.2 Finding ‘what matched?’ and other advanced features 131

5.12 Perl and the OS 136

5.12.1 Manipulating files and directories 137

5.12.2 Perl: processes 140

5.12.3 A ‘systems programming’ example 143

5.13 Networking 150

5.14 Modules 153

5.15 Databases 154

5.15.1 Basics 154

5.15.2 Database example 158

5.16 Perl: CGI 163

5.16.1 ’Roll your own’ CGI code 164

5.16.2 Perl: CGI module(s) 171

5.16.3 Security issues and CGI 173

Exercises 174

Practical 174

Short answer questions 180

Explorations 181

6 PHP4 183

6.1 PHP4’s origins 183

6.2 PHP language 187

6.2.1 Simple variables and data types 187

6.2.2 Operators 191

6.2.3 Program structure and flow control 191

6.2.4 Functions 193

6.3 Simple examples 194

6.4 Multi-page forms 198

6.5 File uploads 207

6.6 Databases 216

6.7 GD graphics library 227

6.8 State 238

Exercises 248

Practical 248

Short answer questions 257

Explorations 257

7 Java Servlets 259

7.1 Servlet overview 259

7.2 A first servlet example 261

7.2.1 Form and servlet code 263

7.2.2 Installation, Compilation, Deployment 265

7.2.3 web.xml deployment files 268

7.3 Sun’s servlet-related classes 269

7.4 Web application example: ‘Membership’ 276

7.5 Client state and sessions 290

7.6 Images 304

7.7 Security features 306

Exercises 328

Practical 328

Short answer questions 336

Explorations 336

Contents vii

8 JSP: Java Server Pages 337

8.1 JSP overview 337

8.2 The ‘Guru’ – a JSP example 340

8.2.1 The scriptlet Guru 340

8.2.2 The tagged Guru 343

8.3 Membership example 344

8.4 JSP: page contents 352

8.4.1 JSP directives 354

8.4.2 jsp: tag library 355

8.5 Servlet, bean and JSP examples 356

8.6 Tag libraries 368

8.6.1 Defining a simple customized action tag 369

8.6.2 Using tag libraries 373

Exercises 375

Practical 375

Short answer questions 379

Explorations 380

9 XML 381

9.1 XML overview 381

9.2 XML and friends 384

9.3 XSL, XSLT and XML display 391

9.4 XML and XSL generating WML 403

9.5 Simple API for XML 412

9.6 DOM – the Document Object Model 422

Exercises 428

Practical 428

Short answer questions 432

Explorations 433

10 Enterprise Java 435

10.1 EJB background 437

10.1.1 Smart beans in smarter containers 437

10.1.2 Distributed objects 438

10.2 EJB basics 441

10.2.1 Servers, containers and beans 441

10.2.2 The life of a bean 444

10.2.3 Classes and interfaces 444

10.2.4 EJB clients and EJB deployment 446

10.3 Session bean examples 447

10.3.1 Stateless server 447

10.3.2 Stateful server 453

10.4 An Entity bean 456

10.5 Real-world EJB 470

Exercises 485

Practical 485

Short answer questions 485

Explorations 485

11 Future technologies? 487

11.1 (Lack of) Speed kills 487

11.2 Personal internet presence 489

11.3 Peer-to-peer 490

11.4 ... and on to ‘Web Services’ 492

11.4.1 The existing world of distributed objects 492

11.4.2 Steps towards a future world of distributed objects 495

11.4.3 UDDI, WSDL and SOAP 498

11.4.4 Web service promises 509

Exercises 512

Explorations 512

Appendices

A Minimalist guide to HTML and JavaScript 515

B Active Server Pages: ASP (scripting) 549

C .NET 573

Index 601

loading