You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Fabrizio Morbini <fm...@gmail.com> on 2010/06/01 20:26:34 UTC

[scxml] src and relative url

Hi, i'm using the src attribute to include external content (i haven't
yet spent time in figuring our how to use xinclude).
I load the initial scxml file using a url like "file:C:/path/file.scxml".
Inside file.scxml some node uses the src attribute set to (for
example) src="include1.scxml#node34".
When it gets parsed the urlResolver.resolvePath has as baseURL the
complete "file:C:/path/file.scxml" and as ctxPath the string
"include1.scxml", the merging results in an absolute url:
"file:/include1.scxml" instead of the desired
"file:C:/path/include1.scxml".

is there a better alternative than modify the urlResolver (by removing
the file.scxml part from the baseURL) to get the desired merged path
when using the method resolvePath?

thanks,
fabrizio.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: [scxml] src and relative url

Posted by Rahul Akolkar <ra...@gmail.com>.
On Tue, Jun 1, 2010 at 2:26 PM, Fabrizio Morbini <fm...@gmail.com> wrote:
> Hi, i'm using the src attribute to include external content (i haven't
> yet spent time in figuring our how to use xinclude).
<snip/>

OK, as long as you're aware its deprecated usage.


> I load the initial scxml file using a url like "file:C:/path/file.scxml".
> Inside file.scxml some node uses the src attribute set to (for
> example) src="include1.scxml#node34".
> When it gets parsed the urlResolver.resolvePath has as baseURL the
> complete "file:C:/path/file.scxml" and as ctxPath the string
> "include1.scxml", the merging results in an absolute url:
> "file:/include1.scxml" instead of the desired
> "file:C:/path/include1.scxml".
>
> is there a better alternative than modify the urlResolver (by removing
> the file.scxml part from the baseURL) to get the desired merged path
> when using the method resolvePath?
>
<snap/>

The portable way is to put the SCXML files as resources on application
classpath and use the getResource() method of the appropriate
ClassLoader to get the URL (this will also resolve src attributes
correctly).

-Rahul


> thanks,
> fabrizio.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org