It's not a secret anymore!*
The moose likes Servlets and the fly likes javax.servlet.ServletRequest.getRealPath is Deprecated. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "javax.servlet.ServletRequest.getRealPath is Deprecated." Watch "javax.servlet.ServletRequest.getRealPath is Deprecated." New topic
Author

javax.servlet.ServletRequest.getRealPath is Deprecated.

naveen yadav
Ranch Hand

Joined: Oct 23, 2011
Posts: 384


after reading online about the working of Tomcat , i am developing a servlet container for servlet 2.3 specification.

i have created a Request class implementing the javax.servlet.ServletRequest interface. this interface has method public java.lang.String getRealPath(java.lang.String path) which is Deprecated.
when i implements getRealPath(String ) i get warning that : java uses or overrides Deprecated api

what should i do to remove that warning ?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

Read the suggestion from the method Javadoc comments.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Ankit Nagpal
Ranch Hand

Joined: Sep 09, 2008
Posts: 47

naveen yadav wrote:
after reading online about the working of Tomcat , i am developing a servlet container for servlet 2.3 specification.

i have created a Request class implementing the javax.servlet.ServletRequest interface. this interface has method public java.lang.String getRealPath(java.lang.String path) which is Deprecated.
when i implements getRealPath(String ) i get warning that : java uses or overrides Deprecated api

what should i do to remove that warning ?


use application.getRealPath(String) where application is a reference to Servlet Context and the parameter is the relative path of the file.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: javax.servlet.ServletRequest.getRealPath is Deprecated.
 
Similar Threads
getRealPath Depricated?
Last days of preparation
deprecated interface methods
getRealPath Depricated?
Replacement of deprecated servlet method