You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Alvin Wang <xw...@qtechservices.com> on 2002/07/13 00:02:09 UTC

how to use relative path to point to a file which's on the same host, but on a different port number?

Hi! All,

In http path, how to use relative path to point to a file which's on the
same host, but on a different port number? For example I have IIS(80) and
Tomcat(8080) on the same host....

thanks!


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: how to use relative path to point to a file which's on the same host, but on a different port number?

Posted by Will Hartung <wi...@msoft.com>.
Well, you'll need to create an absolute path in the reconstructed version.

You can try something like this:

Inside of an HttpServlet...

import java.net.URL;

int otherPort = 80; // or 8080, whatever.
String relativeResource = "the/relative/path/to/file.html";
String thisRequestURL = getRequestURL(); // getRequestURL is from
HttpServlet
URL otherPortContextURL = new URL(thisRequestURL);
otherPortContextURL.setPort(otherPort);
URL otherPortFromRelativeURL = new URL(otherPortContextURL,
relativeResource);

Look up java.net.URL in the docs for detail.

Regards,

Will Hartung
(willh@msoft.com)

----- Original Message -----
From: "Alvin Wang" <xw...@qtechservices.com>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Friday, July 12, 2002 3:02 PM
Subject: how to use relative path to point to a file which's on the same
host, but on a different port number?


> Hi! All,
>
> In http path, how to use relative path to point to a file which's on the
> same host, but on a different port number? For example I have IIS(80) and
> Tomcat(8080) on the same host....
>
> thanks!
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>