FileInputStream expects a filename, but you fed it a URL.

Is the XSL file within your webapp? If so, don't use a URL to reference it.

If it is not within your web app but it is under your control, consider
moving it into your web app.

If you cannot move it, you will need to make an HTTP request to go get it.
This code will go get it and give you an InputStream to read from (there may
be better ways -- I just hobbled this together):

InputStream in = new StringBufferInputStream(
   new URLConnection(new URL(myXsl)).getResponseMessage()
);

This is expensive, so if you need to get this often and it doesn't change
much, you should cache it within your app. Be sure to consider what a
reasonable cache strategy would be, though. If you just get it once and hold
onto it forever, your app will need to be restarted every time the xsl file
changes, which would not be acceptable in a production environment in most
cases.

-Max

----- Original Message ----- 
From: "douglas reames" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, June 19, 2003 5:43 AM
Subject: FileNotFoundException when creating FileInputStream


> When I attempt to open an XSL file to complete a transformation, I get the
> exception FileNotFound.  Steps:
>
>   [1]  Get file location from properties file without problem:
>             String myXsl =
> getProperties().getProperty("fop.render.article");
>
>                 String contents:
> "http://localhost/artimus/pdf/renderPdf.xsl";    ( verified by logging )
>
>   [2]  construct FileInputStream from string, and I get exception
>             FileInputStream in = new FileInputStream(myXsl);
>
>                 Err msg:  java.io.FileNotFoundException:
> http:\localhost\artimus\pdf\renderPdf.xsl
>
> Note from the message that FileInputStream appears to change the address.
>
> How do I force the constructor to accept the whole address?
>
> regards,
> douglas reames
> rms finance
> 919 929 3465
>
> _________________________________________________________________
> MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
> http://join.msn.com/?page=features/virus
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



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

Reply via email to