GeeCON Prague 2014*
The moose likes Servlets and the fly likes General Query on HTTP request generation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "General Query on HTTP request generation" Watch "General Query on HTTP request generation" New topic
Author

General Query on HTTP request generation

Mike Thomson
Ranch Hand

Joined: Nov 07, 2007
Posts: 115
Generally, the request for the web server will be generated by the browser in the normal web application. When the user type in the url, the browser will convert it to HTTP request and send it to the webserver by identifying the port 80.

I want to know whether it's possible to generate the request, what the browser is generating and able send it to the web server manually.? If so, can the web server able to identify whether this request has been generated by browser or other. How can I generate the request manually and send it to the webserver?
Himanshu Gupta
Ranch Hand

Joined: Aug 18, 2008
Posts: 598

YES it is possible to generate the request and to send it to the server manually. I don't think that the server is able to identify that the request is from browser or something else because i think that all HTTP request format is same and it is already defined by some community.

You can use some already available libraries to generate http request. I will suggest you to make use of Apache HTTP client web page for this. It is easy to use and keeps all the low level details to itself.
[ December 03, 2008: Message edited by: Himanshu Gupta ]

My Blog SCJP 5 SCWCD 5
Amol Nayak
Ranch Hand

Joined: Oct 26, 2006
Posts: 218

Originally posted by himanshu gupta
I don't think that the server is able to identify that the request is from browser or something else because i think that all HTTP request format is same and it is already defined by some community


The User-Agent header will let you identify the browser , its version even the client's os and its version.
Himanshu Gupta
Ranch Hand

Joined: Aug 18, 2008
Posts: 598

Thanks Amol. But will it make any difference to server? It will come into action only when we will explicitly define some rules. Am I right?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42047
    
  64
The User-Agent header will let you identify the browser , its version even the client's os and its version.

Generally this is true, but a number of browsers let you manipulate this header, so you can't take its value for absolutely correct. Client libraries like HttpClient will send whatever the code tells them to send, so you can't be sure whether the user is a browser or a program by looking at this header.


Ping & DNS - my free Android networking tools app
Amol Nayak
Ranch Hand

Joined: Oct 26, 2006
Posts: 218
Ya Ulf thats true, we do have plugins that allow us to modify the headers, form parameters , cookies etc.
 
GeeCON Prague 2014
 
subject: General Query on HTTP request generation