HTTP REST - the essentials
here are the essential 'tools' needed to write web apps that are REST-compliant:
-
HTTPMethod tool
this tool should be able to respond to incoming requests using common HTTP Methods (GET, HEAD, PUT, POST, DELETE, OPTIONS). it should be easy to accept a request, determine the HTTP Method, parse the request and assemble and ship the response to the client.
-
HTTPClient tool
this tool should allow programmers to make HTTP calls (GET, HEAD, PUT, POST, DELETE) without any fuss. for example:
string results = httpClient.Execute(url,method='get',contentType='text/html',body=null)
additional properties to handle headers, cookies, and credentials should also be available. with this in hand, you can start GETing, and POSTing web data, etc. -
WebCache tool
this tool should allow programmers to manage internal caching to web request. usually it will include a
Cache
object that contains the item in the cache and a utility class that can read/write to the cache, remove items as needed, and provide support for responding to requests withHTTP 304
(Not Modified) when appropriate. a webcache tool can reduce processing (and pull from the cache instead) and reduce bandwidth (by returning 304s). it should be easy to cache and item, check the item on the cache, and determine that the item in the cache is the same one the client already holds (resulting in a 304). -
Compression tool
this tool should provide support for
GZip
and/ordeflate
. it should be able to tell when clients support these encodings and only use them when supported. -
MimeType tool
this tool should be able to determine the proper mime-type requested by the client and return that value for the app to work with.
-
HTTPAuth tool(s)
supporting HTTP Authentication (Basic and Digest) should be easy. it should be easy to handle requests for authentication from a remote machine. it should also be able to validate incoming authentication credentials and act accordingly.
-
other tools
support for things like MD5 hashing, Base-64 encoding, URI parsing, handling cookies, headers, etc. should also be readily available.
you have these in place and at the ready (along with lots of 'glue' to interface with local data stores) and you will have a powerful kit for building REST-compliant web apps.