java - How to determine how to format an HTTP request to some server -
please bear me have been reading , trying understand http , different requests available in protocol there still few loose connections here , there.
specifically, have been using apache's httpclient send requests, i'm unsure of few things. when make request uri, how can know before hand how format put request? might trying transmit data fill out form, or send image, etc. how know if server capable of receiving format of request?
if try put
without knowledge of server request "fail" (or not - depends on implementation e.g. can redirect main page).
failure indicated server response code along headers. e.g. 405 method not allowed or 400 bad request etc. or redirect main page: 302 found
you, client, must adapt server's api.
moreover different requests same api may give different specs e.g. 1 response gzipped & etag & cached, other 1 not. or plain get /
give html , get /?format=json
give json.
Comments
Post a Comment