tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Caldarale, Charles R" <>
Subject RE: linux + tomcat, some path/link problem
Date Tue, 24 Apr 2007 17:17:08 GMT
> From: Lu Rui [] 
> Subject: linux + tomcat, some path/link problem
> // for winxp
> String filePath = new String("c:\\root\\test.html");
> // for linux
> String filePath = new String("/root/test.html");
> <A href="<%= filePath %>"> testlink </A>

I have not verified the following, but this is what I think is

An href is a URI, not a file system path.  The URI handler in the
Windows JVM detects the "C:" prefix, and forces the protocol for the URI
to be "file:", since that's the only scenario in which "C:" makes any
sense.  No such hints are available on Linux, so the path is returned as
is, with no explicit protocol.  The HTML RFC requires that such paths be
treated as relative to the protocol and server used to present the page
in which the href occurs, so the _browser_ (not Tomcat) converts that to

To make the Linux version work like Windows, use an explicit protocol on
the path (e.g., "file:///root/test.html".

Note also that it's the browser handling the "file:" reference, so I
expect your scheme will only work when the client and server are on the
same machine.

 - Chuck

MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message