Jump to content
Software FX Community

importChart is translating my filepath


User (Legacy)

Recommended Posts

I am trying to import an XML file to initialize my ChartServer object, and

the filepath that I am passing is a web address. The problem is that

importChart throws a FileNotFoundException and prints out the filepath, but

it is different than what I passed in.

Here's basically what happens:

_chart.importChart(FileFormat.XML,

"http://localhost:8080/contextPath/mycharts/pie.xml");

And then the error output is:

java.io.FileNotFoundException:

http:\localhost:8080\contextPath\mycharts\pie.xml

So it seems importChart is translating my web address to a local path. If I

pass a local path like c:\mychart\pie.xml it works fine.

Does importChart not support web addresses? And if not is there a

workaround that I can use?

Thanks,

Brendan

Link to comment
Share on other sites

Hi Brian, importChart requires a local path indeed, but there is a way to 

convert the web address to local path, as you can see in many of the

samples:

chart1.importChart(FileFormat.XML, application.getRealPath("/ChartFX") +

"/data/ChartProperties.xml");

in your case it would be:

chart1.importChart(FileFormat.XML, application.getRealPath("/contextPath") +

"/mycharts/pie.xml");

GA

SoftwareFX

"Brendan O'Brien" <brendan.obrien@appiancorp.com> wrote in message

news:MdnfVaWsEHA.3240@webserver3.softwarefx.com...

>I am trying to import an XML file to initialize my ChartServer object, and

> the filepath that I am passing is a web address. The problem is that

> importChart throws a FileNotFoundException and prints out the filepath,

> but

> it is different than what I passed in.

>

> Here's basically what happens:

>

> _chart.importChart(FileFormat.XML,

> "http://localhost:8080/contextPath/mycharts/pie.xml");

>

> And then the error output is:

>

> java.io.FileNotFoundException:

> http:\localhost:8080\contextPath\mycharts\pie.xml

>

> So it seems importChart is translating my web address to a local path. If

> I

> pass a local path like c:\mychart\pie.xml it works fine.

>

> Does importChart not support web addresses? And if not is there a

> workaround that I can use?

>

> Thanks,

> Brendan

>

>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...