Java Reference
In-Depth Information
cepting the request in an Enterprise environment (common at large corporations) or that the
initial request is malformed. IDEs such as NetBeans have built-in support for tcpmon so
that you can debug both the request to the server and the server's handling of the request.
We won't go into detail about the content of the request. HTTP is defined in RFC 2616 and
can be read at www.w3.org . Full knowledge of this specification isn't necessary to create or
consume RESTful web services, but you'll find yourself digging deeper as you implement
more services or work with different toolkits on other platforms. This will be especially
important if you're architecting new services.
The request that was issued previously used the GET method. Each HTTP call to a server
must specify one of eight different methods. The method determines how the request will
be processed and what the request should do. We'll only concern ourselves with six of these
methods because the other two— TRACE and CONNECT —aren't relevant to RESTful web
services. The methods are as follows:
GET— Read-only operation that doesn't change anything on the server.
DELETE— Deletes a specific resource. Performing this operation multiple times
has no effect. Once the resource is deleted, all subsequent operations have no ef-
fect.
POST— Changes the data/state on the server. The change request may or may not
include a data payload and may or may not return data.
PUT— Stores data sent in the message payload under the resource identified by the
URL. Performing this operation multiple times has no effect because you're updat-
ing the same resources.
HEAD— Returns only a response code and any headers associated with the request.
OPTIONS— Represents a request for information about the communication options
available on the request/response chain identified by the request URI.
With these methods there are two important properties to be aware of: safety and idem-
potence. Safe methods are methods that do nothing other than retrieve data. Methods that
retrieve data are GET and HEAD . Idempotent methods have the same effect no matter
how many times they're invoked. Methods that are idempotent are GET , HEAD , PUT , and
DELETE . The other methods are neither safe nor idempotent. RESTful web services should
respect these semantics. Invoking a RESTful web service in ActionBazaar using HTTP
Search WWH ::




Custom Search