Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to trigger HTTP requests

 
Bachi Taurean
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all

I understand we can send HTTP GET and POST requests from a browser to a web server(via hyperlinks, and form fields etc). I wanted to know how do we trigger the other HTTP methods like GET, HEAD, PUT, TRACE, DELETE etc...
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not think that browser uses any other method other than GET , POST.

You can have your own application making use of the other methods.

You can writing a program to make a report of all the resources available at URL (URL's will be given to you).In that case you can issue a GET command.But you purpose is just to see whether resources are available or not , not to get the resource content.So you can make use of HEAD method instead of GET.
 
Bachi Taurean
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rahul,

I know a browser can only trigger GET and POST request. I wanted to know what are the other ways, if there are any, to trigger PUT, DELETE, TRACE, HEAD request. They need not be from a browser.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A browser can send any HTTP method via the JavaScript XmlHttpRequest object.

A Java client like java.net.URLConnection or Jakarta Commons HttpClient can also do that.
 
Bachi Taurean
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ulf,

Could you share with me a sample program on how to issue a PUT request?
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a good starting point.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My wiki server records HEAD requests when I download files. That gives the browser the information to fill in the "nnn bytes of nnn bytes" on the download progress. (Hmmm, just checking the log I don't see any. Wonder if I imagined that?) Somebody sends OPTIONS requests now and then, too. I don't know how they do it; I haven't been able to make my browser send that one.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My wiki server records HEAD requests when I download files. That gives the browser the information to fill in the "nnn bytes of nnn bytes" on the download progress.


That sounds a bit odd. After all, the HTTP header contains the length of the response, and since the browser knows how many bytes it has read so far, there should be no need to communicate with the server.

I could imagine a browser sending HEAD requests to check if a particular resource has changed since the browser last requested (and cached) it; particularly for large files. Although that's really what conditional GET is for.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic