confusion with the Servlets -
i new servelts programming. , today, started learning it. , little bit confused concerning
httpservletrequest
. written in tutorial that, class doget()
has methods such form "query" data, http request headers, , client’s hostname.
as far understood, httpservletrequest protocol allows server receive request client side. question is, why client side interesting in
knowing client’s host-name or http request headers.
if found question silly please not vote question down, because not want lose account stack overflow.
first of httpservletrequest interface implemented servlet container. httpservlet convenience class servlet can extend , hold of http specific methods. doget() 1 such method process get
requests.
httpservletrequest protocol allows server receive request client side
http request-response protocol. container forms httpservletrequest
object actual request received web server , forwards servlet's service()
method.
why client side interesting in knowing client’s host-name or http request headers.
if talking servlets, executed in server side . hence, methods request.getheader() used servlet read headers request sent client. these headers provide information request (or response).many of headers associated request handled server itself. take, example, how server restricts access documents. server uses http headers, , servlets need not know details. when server receives request restricted page, checks request includes appropriate authorization header contains valid username , password. if doesn't, server issues response containing www-authenticate header, tell browser access resource denied. when client sends request includes proper authorization header, server grants access , gives servlet invoked access user's name via getremoteuser() call.
Comments
Post a Comment