cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keith Visco <kvi...@exoffice.com>
Subject Re: XSP and file://
Date Sat, 25 Mar 2000 00:40:35 GMT

Ricardo, 

I don't think this is a bug in Java...I think the correct file URL
should be:

"file:///whatever"

note the 3 slashes...according to the URI specification the absolute URL
should constist of the protocol, followed by "//" then the hostname,
then another "/"

--Keith

Ricardo Rocha wrote:
> 
> On Fri, 24 Mar 2000, Brett McLaughlin wrote:
> > I am having trouble getting the XSP logicsheets located with file://
> > Using something like:
> >       file://C:/java/jakarta-tomcat/webapps/ROOT/XSL/JavaXML.xsp.xsl
> > results in an error:
> >       Unknown host: C:
> > That seems a bit weird... I also tried using a relative path, and got the
> > same error (Unknown host: webapps).  Someone let me know what (dumb) mistake
> > I am making?
> 
> First of all, thanks Brett for helping me locate a bug, albeit not the same one
> you pointed out, :-(
> 
> I've found a similar (the same?) problem using the "file://" protocol under
> Sun's JDK1.2 for Linux.
> 
> The generated stack trace shows java.net.URL.openStream() calls
> sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(). From
> this point on, subsequent calls are ftp-related (weird...). Finally, a
> call to java.net.InetAddress.getAllByName0() yields an UnknownHostException
> where the initial path component appears to be interpreted as the
> host name (e.g. "home" for "file://home/java/tomcat...").
> 
> My workaround has been to use filenames relative to the webserver
> _current_ virtual directory (i. e., that of the including xsp page). Thus,
> instead of using:
> 
>   <?xml-logicsheet href="file://home/java/tomcat/webpages/logicsheets/ls.xsl"?>
> 
> I use:
> 
>   <?xml-logicsheet href="../logicsheets/ls.xsl"?>
> 
> Unfortunately, this requires that logicsheets are located under the web
> server virtual directory structure, which may result in logicsheets being
> browsable, clearly an undesirable side effect...
> 
> A workaround (valid only after my last bug fix) follows:
> 
> When not given a protocol for the "href" pseudo-attribute, Xsp tries to locate
> the logicsheet as a file.
> 
> The "href" filename is checked to see if it's an absolute pathname for the
> host operating sytem.
> 
> If it is an absolute pathname and it exists, then the file pointed to by "href"
> is used.
> 
> Otherwise, the webserver's virtual path _relative to the including xsp page_
> is preprended to the name given by the "href" pseudo-attribute.
> 
> Thus, if you want to use a logicsheet located _outside_ the webserver's
> directory structure, just make sure you specify its _full_ pathname without
> a URL protocol, like in:
> 
>   <?xml-logicsheet href="c:\java\logicsheets\brett.xsl"?>
> 
> Prior to my last commit, the current web virtual directory was preprended
> in all cases. Shame on me! It works fine now...
> 
> Regards,
> 
> Ricardo

Mime
View raw message