> From: Lu Rui [mailto:[EMAIL PROTECTED] 
> 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
happening.

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
"http://<host>/root/test.html".

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


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
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: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to