This "solution" may or may not work in existing servers, but it may also break. The problem is that ServletContext->getRealPath() is allowed to return null, for example if the content is served from a WAR.


Rakesh Patel wrote:

Hi,

I have found a solution that I think works (have not got access to a Unix 
environment to confirm this) but I did not hard-code any window/unix specific 
paths.

Here's a snippet of code I used:

ServletContext scntxt = this.getServletContext();
String pathToFile = scntxt.getRealPath("/WEB-INF"); // or whatever relative to 
web app root eg /images

String imagePath = "file:" + pathToFile;

org.apache.fop.configuration.Configuration.put("baseDir",imagePath);

as you can see, all my images are in web_app_root/WEB-INF.

The corresponding xml data file looks like this:

<HTRelitiveRef HTRRKey="2" HTRRType="Picture" HTRRID="/centurion.jpg" HTRRLink="" 
HTRRVisible="F">centurion</HTRelitiveRef>

I hope this saves others the problem of finding the solution across many posts!

Thanks

Rakesh

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Johan Åbrandt

Technical Project Manager
(Tekninen projektipäällikkö)
Tel. +358 9 6817 3342
Mobile. +358 40 848 8068
[EMAIL PROTECTED]

Profit Software Oy
Meritullinkatu 11 C
00170 Helsinki, Finland


__________________________________________________________________________

This message and its attachments have been found clean from known viruses with three different antivirus programs.
__________________________________________________________________________


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to