You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Davide Rogora <dr...@unionefiduciaria.it> on 2008/07/23 15:18:44 UTC

url attribute of tag

Hi,
Actually my iBatis xml config files are under the classpath so, to include
an xml file in the in the main configuration file (that is under
WEB-INF/iBatis folder) I usually write:
<sqlMap resource="it/mypakage/Example.xml" />
(and it works)

I need to move all my files under WEB-INF/iBatis directory of my web
application.
I read iBatis manual and tried with the "url" attribute, like this:
<sqlMap url="file:///c:/myProject/www/WEB-INF/iBatis/Example.xml" />
and it works!

Now I want to make the path relative to the project (and not absolute to my
hard drive c: like in the above example).
I tried with ;
<sqlMap url="file:///WEB-INF/iBatis/Example.xml" /> and
<sqlMap url="file:///Example.xml" /> and
<sqlMap url="file:Example.xml" /> and
and a million of other ways, but it doesn't work

How is the correct way to use a relative path with the url attribute?

Thanks,
Davide.


-----
Davide Rogora
Unione Fiduciaria S.p.A. - Società Fiduciaria e di Servizi delle Banche
Popolari Italiane
Area Informatica
via Olmetto, 1
20123 Milano
Tel. 02 72.422.423
e-mail: drogora@unionefiduciaria.it

Le dichiarazioni contenute nel presente messaggio nonché nei suoi eventuali
allegati devono essere attribuite esclusivamente al mittente e non possono
essere considerate come trasmesse o autorizzate da Unione Fiduciaria S.p.A.;
le medesime dichiarazioni non impegnano Unione Fiduciaria S.p.A. nei
confronti del destinatario o di terzi. Unione Fiduciaria S.p.A. non assume
alcuna responsabilità per eventuali intercettazioni, modifiche o
danneggiamenti del presente messaggio e-mail. Qualsiasi utilizzo non
autorizzato del presente messaggio nonchè dei suoi allegati è vietato e
potrebbe costituire reato. Se avete ricevuto erroneamente il presente
messaggio, saremmo grati se, via e-mail, ce ne comunicaste la ricezione e
provvedeste alla distruzione del messaggio stesso e dei suoi eventuali
allegati.



The statements and opinions espressed in this e-mail message are those of
the author of the message and do not necessarily represent those of Unione
Fiduciaria S.p.A. Besides, the contents of this message shall be understood
as neither given nor endorsed by Unione Fiduciaria S.p.A. Unione Fiduciaria
S.p.A. does not accept liability for corruption, interception or amendment,
if any, or the consequences thereof. Any unauthorized use of this e-mail or
any of its attachments is prohibited and could constitute an offence. If You
are not the intended addressee please advise immediately the sender by using
the reply facility in Your e-mail software and destroy the message and its
attachments.



Re: R: url attribute of tag

Posted by Larry Meadors <la...@gmail.com>.
Not that I'm aware of.

Larry


On Thu, Jul 24, 2008 at 3:40 AM, Davide Rogora
<dr...@unionefiduciaria.it> wrote:
> Thanks for your reply Larry.
> So there is no way to include an xml file (that is not in the classpath)
> using a relative path?
>
> Davide.
>
>
> -----Messaggio originale-----
> Da: Larry Meadors [mailto:larry.meadors@gmail.com]
> Inviato: mercoledì 23 luglio 2008 15.35
> A: user-java@ibatis.apache.org
> Oggetto: Re: url attribute of <sqlMap> tag
>
>
> No: URLs are absolute names.
>
> Depending on how you initialize your SqlMapClient, you might be able
> to pass a base bath as a parameter, and have your web app tell it
> where the web root is, then build a file:// url from that, but I don't
> see any advantage to doing that. Look at the SqlMapCientBuilder to see
> how to do that.
>
> FWIW, I wouldn't recommend this. It's extra work without a reward.
>
> Larry
>
>
> On Wed, Jul 23, 2008 at 7:18 AM, Davide Rogora
> <dr...@unionefiduciaria.it> wrote:
>> Hi,
>> Actually my iBatis xml config files are under the classpath so, to include
>> an xml file in the in the main configuration file (that is under
>> WEB-INF/iBatis folder) I usually write:
>> <sqlMap resource="it/mypakage/Example.xml" />
>> (and it works)
>>
>> I need to move all my files under WEB-INF/iBatis directory of my web
>> application.
>> I read iBatis manual and tried with the "url" attribute, like this:
>> <sqlMap url="file:///c:/myProject/www/WEB-INF/iBatis/Example.xml" />
>> and it works!
>>
>> Now I want to make the path relative to the project (and not absolute to
> my
>> hard drive c: like in the above example).
>> I tried with ;
>> <sqlMap url="file:///WEB-INF/iBatis/Example.xml" /> and
>> <sqlMap url="file:///Example.xml" /> and
>> <sqlMap url="file:Example.xml" /> and
>> and a million of other ways, but it doesn't work
>>
>> How is the correct way to use a relative path with the url attribute?
>>
>> Thanks,
>> Davide.
>>
>
>
>
>

R: url attribute of tag

Posted by Davide Rogora <dr...@unionefiduciaria.it>.
Thanks for your reply Larry.
So there is no way to include an xml file (that is not in the classpath)
using a relative path?

Davide.


-----Messaggio originale-----
Da: Larry Meadors [mailto:larry.meadors@gmail.com]
Inviato: mercoledì 23 luglio 2008 15.35
A: user-java@ibatis.apache.org
Oggetto: Re: url attribute of <sqlMap> tag


No: URLs are absolute names.

Depending on how you initialize your SqlMapClient, you might be able
to pass a base bath as a parameter, and have your web app tell it
where the web root is, then build a file:// url from that, but I don't
see any advantage to doing that. Look at the SqlMapCientBuilder to see
how to do that.

FWIW, I wouldn't recommend this. It's extra work without a reward.

Larry


On Wed, Jul 23, 2008 at 7:18 AM, Davide Rogora
<dr...@unionefiduciaria.it> wrote:
> Hi,
> Actually my iBatis xml config files are under the classpath so, to include
> an xml file in the in the main configuration file (that is under
> WEB-INF/iBatis folder) I usually write:
> <sqlMap resource="it/mypakage/Example.xml" />
> (and it works)
>
> I need to move all my files under WEB-INF/iBatis directory of my web
> application.
> I read iBatis manual and tried with the "url" attribute, like this:
> <sqlMap url="file:///c:/myProject/www/WEB-INF/iBatis/Example.xml" />
> and it works!
>
> Now I want to make the path relative to the project (and not absolute to
my
> hard drive c: like in the above example).
> I tried with ;
> <sqlMap url="file:///WEB-INF/iBatis/Example.xml" /> and
> <sqlMap url="file:///Example.xml" /> and
> <sqlMap url="file:Example.xml" /> and
> and a million of other ways, but it doesn't work
>
> How is the correct way to use a relative path with the url attribute?
>
> Thanks,
> Davide.
>




Re: url attribute of tag

Posted by Larry Meadors <la...@gmail.com>.
No: URLs are absolute names.

Depending on how you initialize your SqlMapClient, you might be able
to pass a base bath as a parameter, and have your web app tell it
where the web root is, then build a file:// url from that, but I don't
see any advantage to doing that. Look at the SqlMapCientBuilder to see
how to do that.

FWIW, I wouldn't recommend this. It's extra work without a reward.

Larry


On Wed, Jul 23, 2008 at 7:18 AM, Davide Rogora
<dr...@unionefiduciaria.it> wrote:
> Hi,
> Actually my iBatis xml config files are under the classpath so, to include
> an xml file in the in the main configuration file (that is under
> WEB-INF/iBatis folder) I usually write:
> <sqlMap resource="it/mypakage/Example.xml" />
> (and it works)
>
> I need to move all my files under WEB-INF/iBatis directory of my web
> application.
> I read iBatis manual and tried with the "url" attribute, like this:
> <sqlMap url="file:///c:/myProject/www/WEB-INF/iBatis/Example.xml" />
> and it works!
>
> Now I want to make the path relative to the project (and not absolute to my
> hard drive c: like in the above example).
> I tried with ;
> <sqlMap url="file:///WEB-INF/iBatis/Example.xml" /> and
> <sqlMap url="file:///Example.xml" /> and
> <sqlMap url="file:Example.xml" /> and
> and a million of other ways, but it doesn't work
>
> How is the correct way to use a relative path with the url attribute?
>
> Thanks,
> Davide.
>