Dutta, Sumanta wrote:
 Thanks for the response. I understand that part of passing any URL, but my
problem is, when I deploy the application, the XSLs get deployed under the
httpRoot, and I want to read them without any specific reference to the
deployment area(i.e. webserver, filesystem, etc.). My servlet is reading XSL
filename (/x/y/z.xsl) from a file, but it don't know in advance where it
will be deployed.

If I understand you correctly, you can use getServletConfig().getRealPath("/x/y/z.xsl") to be independent of servlet context.


public java.lang.String getRealPath(java.lang.String path)

Returns a String containing the real path for a given virtual path. For example, the virtual path "/index.html" has a real path of whatever file on the server's filesystem would be served by a request for "/index.html".

The real path returned will be in a form appropriate to the computer and operating system on which the servlet container is running, including the proper path separators. This method returns null if the servlet container cannot translate the virtual path to a real path for any reason (such as when the content is being made available from a .war archive).

Parameters:
path - a String specifying a virtual path
Returns:
a String specifying the real path, or null if the translation cannot be 
performed

--
Oleg Tkachenko
Multiconn International, Israel



Reply via email to