Wednesday, March 19, 2008

Request & Response

now we have come to know what are requests and responses.these derive from two interfaces
the request comes from
  • ServletRequest
  • HttpServletRequest
the HttpServlet interface implements the ServletRequest interface.all of the clients requests are implemented by these two interfaces.some of the useful methods definitions declared are

  • ServletRequest
  1. getAttribute(String)
  2. getLocalPort()
  3. getParameter()
  4. getParameterNames()
  • HttpServletRequest
  1. getCookies()
  2. getHeader(String)
  3. getSession()
  4. getMethod()

now lets consider about the response.there are two interfaces which will be generating the response to the client
  • ServletResponse
  • HttpServletResponse
some of the useful methods defined are
ServletResponse
  1. getWriter()
  2. setContentType()
HttpServletResponse
  1. addHeader()
  2. addCookie()
  3. sendError()
we will discuss the usage of some of this methods using requests and responses in the next lesson.

No comments: