Communication between servers and clients on the web is governed by
the
HyperText Transfer Protocol (HTTP).
HTTP specifies a syntax for describing
resources on servers
through
Uniform Resource Indicators (URI), a more
inclusive term than Uniform Resource Locator (URL).
HTTP specifies
methods for interacting with servers:
- GET: Retrieve a representation of a URI from a server for
processing by a client
- POST: Create a new data entry in an existing URI on a server
- PUT: Replace a (entire) URI on a server with another
- DELETE: Remove a (entire) URI from a server
An HTTP GET request can include
form data in a URI through
request parameters:
http://myserver.com/catalog?item=1729
Here,
item is a request parameter and
1729 is its value,
perhaps obtained from a drop-down menu within a submitted form.
Disadvantages of request parameters:
- Some form data, for example credit card numbers, cannot be placed
in a URI
- URI lengths are limited by the servers that accept them
POST requests send data in such a way that:
- User-provided data is not embedded in the requested URI.
- Data of arbitrary size can be sent (example: file uploads)
By default, a JSF application makes a sequence of POST requests to the
server.
There are disadvantages to generating only POST requests:
- Users often move through a web application without sending
input — consider browsing from page to page within a shopping
catalog
- POST requests do not work for bookmarking or caching
An architectural style called
Representational State Transfer
(REST) advocates that web applications should use HTTP as it was
originally envisioned.
That is, requests that simply look up content should be GET requests
(possibly with request parameters).