permaculture playing cards
The moose likes Servlets and the fly likes why service() accepts HttpServletResponse Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "why service() accepts HttpServletResponse" Watch "why service() accepts HttpServletResponse" New topic

why service() accepts HttpServletResponse

vianyrajnish rajnish
Ranch Hand

Joined: Apr 22, 2007
Posts: 70

i like to know .. why service() accepts httpservletrequest and httpservletresponse both ....when only httpservletrequest is enough..?

please reply me anyone

vinay rajnish
Vishal Matere
Ranch Hand

Joined: Jan 22, 2008
Posts: 81
Because service() ultimately calls doGet()/doPost() methods which needs response object to send response to client.

Alternatively user can overide service() method and can write his own code to return response.


SCJP <br />SCWCD <br />SCBCD <br />SCEA-1
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 61957

If the request is "enough" how would you propose that a servlet writes output to the response and/or set headers?

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: why service() accepts HttpServletResponse