You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Randy Layman <ra...@aswethink.com> on 2001/07/03 22:27:54 UTC

RE: problem with getPort()

	Is there a reason that you aren't using request.getPort()?

> -----Original Message-----
> From: Joseph D Toussaint [mailto:jdtoussa@cariboulake.com]
> Sent: Tuesday, July 03, 2001 4:38 PM
> To: tomcat-user@jakarta.apache.org
> Subject: problem with getPort()
> 
> 
> I'm trying to get the port off of a request object and it is returning
> port 0.
> 
> 
> Here is how I'm getting the URL I came from.
> 
> 
>         StringBuffer came_from = HttpUtils.getRequestURL(request);
> 
> While reconstructing a new URL 
> 
>     java.net.URL tmp_url   = new java.net.URL(came_from.toString());
> 
> 
> My servlet faild because I was using port 0.
> 
> To test I printed out 'came_from' and it said port 0.
> 
> I'm using Tomcat 3.2.2 with ajp12 configured to use Apache 1.3.20
> 
> 
> Thanks
> 
> 
> joe
> 
> 
> -- 
> ##############################
> # Joseph Toussaint           #
> # Caribou Lake Software      #
> # http://www.cariboulake.com #
> # jdtoussa@cariboulake.com   #
> # 952-837-98029              #
> ##############################
> 

RE: problem with getPort()

Posted by Joseph D Toussaint <jd...@cariboulake.com>.
I'm trying to create a new URL to go to.  If I wanted to use the
request.getPort() method I'd have to also call getHostName() and
manually construct the URL.  It was my understanding that the
getRequestURL method did that for you.

This code ran under JRun 3.x but for some reason wont  run under tomcat.


Thanks


joe


On 03 Jul 2001 16:27:54 -0400, Randy Layman wrote:
> 
>       Is there a reason that you aren't using request.getPort()?
> 
> > -----Original Message-----
> > From: Joseph D Toussaint [mailto:jdtoussa@cariboulake.com]
> > Sent: Tuesday, July 03, 2001 4:38 PM
> > To: tomcat-user@jakarta.apache.org
> > Subject: problem with getPort()
> > 
> > 
> > I'm trying to get the port off of a request object and it is returning
> > port 0.
> > 
> > 
> > Here is how I'm getting the URL I came from.
> > 
> > 
> >         StringBuffer came_from = HttpUtils.getRequestURL(request);
> > 
> > While reconstructing a new URL 
> > 
> >     java.net.URL tmp_url   = new java.net.URL(came_from.toString());
> > 
> > 
> > My servlet faild because I was using port 0.
> > 
> > To test I printed out 'came_from' and it said port 0.
> > 
> > I'm using Tomcat 3.2.2 with ajp12 configured to use Apache 1.3.20
> > 
> > 
> > Thanks
> > 
> > 
> > joe
> > 
> > 
> > -- 
> > ##############################
> > # Joseph Toussaint           #
> > # Caribou Lake Software      #
> > # http://www.cariboulake.com #
> > # jdtoussa@cariboulake.com   #
> > # 952-837-98029              #
> > ##############################
> > 



-- 
##############################
# Joseph Toussaint           #
# Caribou Lake Software      #
# http://www.cariboulake.com #
# jdtoussa@cariboulake.com   #
# 952-837-98029              #
##############################