Skip to main content

Trying to get ServletContext, request, and response from Web Service

2 replies [Last post]
cld71
Offline
Joined: 2004-03-04
Points: 0

I am trying to get the ServletContext Object (a.k.a. application variable), HttpServletRequest Object (a.k.a. request variable), and the HttpServletResponse Object( a.k.a. response variable) in a Web Service.

I am using Netbeans 6.0 and Tomcat 6.0.14 to do this.

When I look at my web service source, the class doesn't have any way I can get/set/etc. application/request/response/session variables.

How can I access application/request/response/session variables from a web service?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
cld71
Offline
Joined: 2004-03-04
Points: 0
sshahar1
Offline
Joined: 2008-01-10
Points: 0

I hope I understand you question correctly.
If your servlet will extend the HttpServlet class, you can override the doGet and doPost methods to do whatever you need with request and response.