aspose file tools*
The moose likes Servlets and the fly likes HTTP Protocol & Servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "HTTP Protocol & Servlets" Watch "HTTP Protocol & Servlets" New topic
Author

HTTP Protocol & Servlets

Gerardo Tagliani
Greenhorn

Joined: May 14, 2002
Posts: 2
How could I get all the information (example below) sent by a client using servlets?

Example:
GET /index.html HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */*
Accept-Language: pt-br
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Host: localhost
Connection: Keep-Alive
Carol Enderlin
drifter
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364
You can use request methods request.getHeaderNames() and request.getHeader(headerName).
Periakaruppan Thiagarajan
Ranch Hand

Joined: Jul 26, 2005
Posts: 65
getHeader(String name):
The method getHeader(String name) of request object is used to return the value of header given in request. The returned value of header is a string.

General Syntax:

request.getHeader("String")

In the above the returned value is a String.

For instance

String exfosys = request.getHeader("exforsys")

The above would retrieve the value of the HTTP header whose name is exforsys in JSP.

getHeaderNames():
The method getHeaderNames() of request object returns all the header names in the request. This method is therefore used to find the available headers. The value returned is as a enumerator of all header names.

General Syntax:

request.getHeaderNames();

In the above the returned value is an enumerator.

For example

Enumeration exforsys = request.getHeaderNames();

The above returns all header names under the enumerator exforsys.

Regards,
Pk
Gerardo Tagliani
Greenhorn

Joined: May 14, 2002
Posts: 2
Thanks people!

I will try!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HTTP Protocol & Servlets