Hi all, I have a deprecated method from interface ServletRequest.the method is getRealPath(string s).I need to replace this method with a suitable method.can any one suggest me what i need to do.It has been noted in api that we can use ServletContext method.but the arugument passed in the method which i am using is taking a HttpServletRequest which i cant change it.can anyone suggest me what may help me to replace this method.
Originally posted by Ulf Dittmer: Well, Mohan mentions that he has seen that method, but that he has an HttpServletRequest to work with, not a ServletContext.
The servlet's init method should store a reference to the ServletConfig object, so that the code can obtain a reference to the ServletContext from it later.
Yep, One count of not reading the original question throughly and completely: Guilty as charged.
Joined: Oct 26, 2007
First of all thank you all for your replies and suggestion.I have already tried with that request.session().getServeltContext().but my page crashes when i run this code with exception NoSuchMethod.this is because my servlet version is 2.2.so what can do further?
Joined: Mar 22, 2005
In that case the servlet needs to be changed along the lines of what I suggested, and the ServletContext passed as a parameter into your method.