[xmlc] Re: Windows file url problem
"Jacob Kjome" <[email protected]> Wed, 02 Dec 2009 15:41:56 -0600
| Newsgroups | gmane.comp.java.enhydra.xmlc |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format... ------------=_1259793720-8018-2636 Content-Type: text/plain;charset=iso-8859-1;format="flowed" Content-Transfer-Encoding: quoted-printable What version of XMLC are you using? What it's trying to do is generate a URL.=A0 There was a bug some time ag= o where=20 URL.toExternalForm() was creating URLs that were invalid.=A0 The fix, odd= ly, was=20 to use URL.toString().=A0 Note that the following is the correct format f= or a=20 file URL on Windows... file:/C:/Tomcat6.0/webapps/test-project/WEB-INF/classes/view/include/Body= _bottom.html OR file:///C:/Tomcat6.0/webapps/test-project/WEB-INF/classes/view/include/Bo= dy_bottom.html Backslashes are definitely invalid in a URL.=A0 Note that the path=20 FileInputStream spits out in a FileNotFoundException is somewhat deceivin= g=20 because it doesn't know that that path is supposed to represent a URL.=A0= It=20 just spits out slashes matching the System default.=A0 So take it with a = grain=20 of salt.=A0 The real issue probably has to do with appending two parts of= the=20 file path together; both including slashes.=A0 It probably ends up lookin= g like=20 this internally to the File object.... "C:\Tomcat6.0\webapps\test-project\WEB-INF\classes\view\" +=20 "include/Body_bottom.html" Notice how the first part has all backslashes and the second part has a=20 forward slash.=A0 Don't get me wrong.=A0 The way you are coding your "inc= lude"=20 statement is correct.=A0 It's a failure on XMLC's (or the JVM's) part to = paste=20 the base path together with the include path. It's possible you are using a version of XMLC that doesn't yet have the f= ix.=A0=20 Otherwise, if you are using an up-to-date version, then I can try to repr= oduce=20 the issue and see what can be done.=A0 A possible workaround might be to = add the=20 "include" directory as one of the configured "xmlcReparseResourceDirs" (s= ee=20 [1] for an example of configuring this as a context-param) and then just=20 use... <!--#include file=3D"Body_bottom.html" --> That said, it looks like you are loading templates from the classpath, no= t via=20 resource directories so that solution might not be applicable=A0=A0 In an= y case,=20 let me know if that helps.=A0 Otherwise, I'll try to reproduce this when = I get=20 home from work. [1]=20 http://svn.forge.objectweb.org/cgi-bin/viewcvs.cgi/xmlc/trunk/xmlc/exampl= es/tomcat/res/webapps/xmlc/WEB-INF/web.xml.in?rev=3D1591&view=3Dauto Jake On Wed, 02 Dec 2009 13:14:23 -0600 Yousif Seedham <[email protected]> wrote: > hello, >=20 > I am using deferred parsing and I am running into a problem with includ= e=20 >statements in my html document. >=20 >=20 > html code: > <!--#include file=3D"include/Body_bottom.html" --> >=20 > this works fine on linux(tomcat6, jdk1.6) > but on windows(tomcat6, jdk1.6) I get the following exception: >=20 > org.enhydra.xml.xmlc.XMLCRuntimeException:=20 >file:\C:\Tomcat6.0\webapps\test-project\WEB-INF\classes\view\include\Bod= y_bottom.html=20 >(The filename, directory name, or volume label syntax is incorrect) > =20 > org.enhydra.xml.xmlc.deferredparsing.DocumentLoaderImpl.parseDocument(D= ocumentLoaderImpl.java:590) > =20 > org.enhydra.xml.xmlc.deferredparsing.DocumentLoaderImpl.checkCacheEntry= (DocumentLoaderImpl.java:210) > =20 > org.enhydra.xml.xmlc.deferredparsing.DocumentLoaderImpl.getDocument(Doc= umentLoaderImpl.java:238) > view.LoginHTML.buildDocument(LoginHTML.java:211) > view.LoginHTML.<init>(LoginHTML.java:194) > view.LoginHTML.<init>(LoginHTML.java:204) > . > . > . >=20 > java.io.FileNotFoundException:=20 >file:\C:\Tomcat6.0\webapps\test-project\WEB-INF\classes\view\include\Bod= y_bottom.html=20 >(The filename, directory name, or volume label syntax is incorrect) > java.io.FileInputStream.open(Native Method) > java.io.FileInputStream.<init>(Unknown Source) > java.io.FileInputStream.<init>(Unknown Source) > org.enhydra.xml.io.InputSourceOps.openSystemId(InputSourceOps.java:7= 6) > org.enhydra.xml.io.InputSourceOps.open(InputSourceOps.java:94) > =20 > org.enhydra.xml.xmlc.misc.SSIParsedStream.readIntoBuffer(SSIParsedStrea= m.java:198) > . > . > . >=20 >=20 > To get it to work on windows I had to define an absolute path: > <!--#include=20 >file=3D"/c://Tomcat6.0/webapps/test-project/WEB-INF/classes/view/include= /Body_bottom.html"=20 >--> >=20 > It seems to me that windows does not like the > "file:" in > "file:\C:\Tomcat6.0\webapps\test-project\WEB-INF\classes\view\include\B= ody_bottom.html" > which results if i use a relative path in my include. >=20 > Any advice would be helpful... >=20 >=20 > Yousif >=20 >=20 ------------=_1259793720-8018-2636 Content-Type: text/plain; charset="UTF-8"; name="message-footer.txt" Content-Disposition: inline; filename="message-footer.txt" Content-Transfer-Encoding: quoted-printable -- You receive this message as a subscriber of the [email protected] mailing list= . To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=3Dhelp OW2 mailing lists service home page: http://www.ow2.org/wws ------------=_1259793720-8018-2636--