★ wanayoo — archive 1999 http://javaboutique.internet.com/tutorials/JSP/part05/Nouvelle recherche | Portail wanayoo

Internet Trade Show List


Find a Web Host With:
CGI Access
DB Support
NT Servers
UNIX Servers
Telnet Access

advanced search
Internet News
Internet Investing
Internet Technology
Windows Internet Tech.
Linux/Open Source
Web Developer
ECommerce/ Marketing
ISP Resources
ASP Resources
Wireless Internet
Downloads
Internet Resources
Internet Lists
International
EarthWeb
Career Resources

Search internet.com
Advertise
Corporate Info
Newsletters
E-mail Offers
Be a Commerce Partner
Send a Press Release
Free Barter Account
Find a Web HostFind a Web Host
Find Romance
Software Store
Monitor Availability
Business Search
Find a Consultant
Internet Jobs
CreditCard Processing
FlashKit
Gif.com
HierMenusCentral
JavaBoutique
JavaScript.com
JavaScriptSource
WebDev Jobs
JustSMIL
ScriptSearch
StreamingMediaWorld
Web Hosts
WebDevelopersJournal WDVL
WebDeveloper.com
WebReference.com
XMLFiles.com
CGI
HTML
Java
JavaScript
Web Design and Promotion
Web Site Development
E-mail Address:


Can you receive
HTML e-mail?

Yes   No

Zip Code:


Tutorials : Server-Side Web Applications Using Servlets and JSP :
Reading HTTP Request Headers :

Contents
An Overview of Request Headers
Reading Request Headers from Servlets
Example: Printing all Headers

An Overview of Request Headers

When an HTTP client (e.g. a browser) sends a request, it is required to supply a request line (usually GET or POST). If it wants to, it can also send a number of headers, all of which are optional except for Content-Length, which is required only for POST requests. Here are the most common headers:

  • Accept The MIME types the browser prefers.
  • Accept-Charset The character set the browser expects.
  • Accept-Encoding The types of data encodings (such as gzip) the browser knows how to decode. Servlets can explicitly check for gzip support and return gzipped HTML pages to browsers that support them, setting the Content-Encoding response header to indicate that they are gzipped. In many cases, this can reduce page download times by a factor of five or ten.
  • Accept-Language The language the browser is expecting, in case the server has versions in more than one language.
  • Authorization Authorization info, usually in response to a WWW-Authenticate header from the server.
  • Connection Use persistent connection? If a servlet gets a Keep-Alive value here, or gets a request line indicating HTTP 1.1 (where persistent connections are the default), it may be able to take advantage of persistent connections, saving significant time for Web pages that include several small pieces (images or applet classes). To do this, it needs to send a Content-Length header in the response, which is most easily accomplished by writing into a ByteArrayOutputStream, then looking up the size just before writing it out.
  • Content-Length (for POST messages, how much data is attached)
  • Cookie (one of the most important headers; see separate section in this tutorial on handling cookies)
  • From (email address of requester; only used by Web spiders and other custom clients, not by browsers)
  • Host (host and port as listed in the original URL)
  • If-Modified-Since (only return documents newer than this, otherwise send a 304 "Not Modified" response)
  • Pragma (the no-cache value indicates that the server should return a fresh document, even if it is a proxy with a local copy)
  • Referer (the URL of the page containing the link the user followed to get to current page)
  • User-Agent (type of browser, useful if servlet is returning browser-specific content)
  • UA-Pixels, UA-Color, UA-OS, UA-CPU (nonstandard headers sent by some Internet Explorer versions, indicating screen size, color depth, operating system, and cpu type used by the browser's system)

For full details on HTTP headers, see the specifications at http://www.w3.org/Protocols/.

NEXT


This tutorial is now available as a book: Core Servlets and JavaServer Pages by Marty Hall, published by Sun Microsystems Press. Read all about it at CoreServlets.com


Server-Side Web Applications using Java Servlets versions 2.1/2.2 and JavaServer Pages (JSP) version 1.0: A Tutorial
© 1999-2000 Marty Hall.
All source code freely available for unrestricted use.
Created for work in the Research and Technology Development Center of the Johns Hopkins University Applied Physics Lab, for courses in the Johns Hopkins Part-Time MS Program in Computer Science, and for various industry seminars and on-site Java short courses.
Please note that this is a first draft of the tutorial, so please send corrections, comments, and suggestions to me at hall@apl.jhu.edu.
Reprinted with permission from the author. Click here to visit the original version


Applet Index
(sorted alphabetically)

A B C D E F G H I J K
L M N O P Q R S T U
V W X Y Z #s
The Java Source
(applets w/source code)

A B C D E F G H I J K
L M N O P Q R S T U
V W X Y Z

How to Add Java Applets to Your Site

New on the Java Boutique:

New Article:
AccelTree Fulcrum 1.2
If you look at most programs, you will discover that they essentially are comprised of code segments that are very standard in nature. For example, code to validate a data item in a database, or code to insert a record set in a set of tables. Fulcrum is a sophisticated template-based code management system that enables Java developers to maximize code reuse and simplify the programming process.
... [more articles]

New Tutorial:
Load Testing your Applications with Apache JMeter
This week Keld Hansen gives us a quick look into JMeterÂ’s capabilities in the web application and web service area. This versatile open source gem is simple to use and great for performing load testing on your applications.
... [more Tutorials]

Year in Review:
The Best of 2002
The year 2002 saw 201 new applets posted to JavaBoutique. Check out the 2 most popular apps from each month of 2002!
... [popular applets]

Elsewhere on internet.com:

WebDeveloper Java
Lots of Java information on webdeveloper.com

WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.

ScriptSearch Java
Hundreds of free Java code files to download.

internet.com logo










WebDev News

Web Services Show Promise, but How Much?

Sun Formally Unveils Solaris 9 for x86

Nokia Engages New Game Platform: N-Gage



Database Journal Launched!
Jupiter Media has announced the launch of Database Journal. DBJ offers SQL courses and other database related resources for beginner to expert developers.



JSP Code Generator for Dynamic XML Output
Free Open Source Code Builder that generates JSP pages that output given sample XML documents.
Download of the Week
DS BackLight
This applet displays a back-light effect over an animation. You can also insert an image and scroll-text over them.



JB User Poll
How do you get the majority of your programming questions answered?
The JavaBoutique Top 15:
1. ChompText
2. PingPong
3. DJPopMenu
4. NavBar
5. RushHour
6. 3DMaze
7. AnimLetters_anim
8. Encyclo
9. Distorter
10. Nibbly
11. Viewer
12. AScroll2
13. BMMenu
14. BSCOutline
15. BMI
Want more? Check out our Top 100!

Refer-It
Affiliate Program and Referral Directory.
New on internet.com
The Net's New Fighting Words: Sales Tax
It's either desirable and long overdue, or devastating and so complex as to be unworkable, depending on who's doing the talking.

Pattern Recognition: Marketing's Mirror World
Cool, selling and selling out. "Pattern Recognition," William Gibson's eagerly anticipated new novel, is about marketing. (Warning: minor spoilers.)

The Language of Web Services
Web services promise to replace long-winded integration processes with instantaneous, platform-independent messaging. But there is a catch.


100's of firms that help your Web site be found

Copyright 2003 Jupitermedia Corporation All Rights Reserved.
Legal Notices,  Licensing, Reprints, & Permissions,  Privacy Policy.
http://www.internet.com/