You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by saugata ghosh <sa...@yahoo.com> on 2004/07/20 08:33:17 UTC

port number at runtime

It will be very usefull if the port number on which
the SSL and Http non-ssl ports are running, is
available runtime. (Ex:- 8080 and 8443).
Is it possible?

The "int getPort()" method of the CoyoteConnector
class returns the port number but its not accessible
at runtime. If there is a "sendRedirect()" method in
some jsp, where one wants to redirect from http to say
https, then the port number must be known in advance.
So there is a need for such an API.

-Saugata



		
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: port number at runtime

Posted by saugata ghosh <sa...@yahoo.com>.
Thanks. Completely agreed with the arguments for not
having the API. 

Right now we put the port numbers in our own projects
property file also, apart from server.xml. May be
thats the way to do it.

-Saugata

--- Rick Knowles <ri...@knowleses.org> wrote:
> Having this as a requirement makes an awful lot of
> assumptions about the 
> architecture of the container, none of which are
> helpful in the larger 
> scale. For example, what if you have 2 (or 50) http
> connectors and the 
> same for https ? And then what about ajp13 ? Or
> mod_caucho's protocol (I 
> think it's called hessian) ? The reason this is not
> in the servlet api 
> spec is because it would create more problems than
> it would solve.
> 
> There are some cases where you just need to know
> what your deployment 
> environment is going to be ... this is one of them.
> 
> Rick
> 
> saugata ghosh wrote:
> 
> >request.getServerPort()
> >-Thanks, but this returns the port number of the
> >current request port.
> >But my problem is, say the request is for http: and
> I
> >want to redirect to https:/.../somefile.jsp. - then
> ?
> >Basically what is required is a method that will
> >return the port number set in the conf/server.xml
> >file.
> >
> >-Saugata
> >  
> >
> -- 
> Servlet v2.4 container in a single 140KB jar file ?
> Try Winstone
> (http://winstone.sourceforge.net)
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tomcat-dev-help@jakarta.apache.org
> 
> 



	
		
__________________________________
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!
http://advision.webevents.yahoo.com/yahoo/votelifeengine/

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: port number at runtime

Posted by Rick Knowles <ri...@knowleses.org>.
Having this as a requirement makes an awful lot of assumptions about the 
architecture of the container, none of which are helpful in the larger 
scale. For example, what if you have 2 (or 50) http connectors and the 
same for https ? And then what about ajp13 ? Or mod_caucho's protocol (I 
think it's called hessian) ? The reason this is not in the servlet api 
spec is because it would create more problems than it would solve.

There are some cases where you just need to know what your deployment 
environment is going to be ... this is one of them.

Rick

saugata ghosh wrote:

>request.getServerPort()
>-Thanks, but this returns the port number of the
>current request port.
>But my problem is, say the request is for http: and I
>want to redirect to https:/.../somefile.jsp. - then ?
>Basically what is required is a method that will
>return the port number set in the conf/server.xml
>file.
>
>-Saugata
>  
>
-- 
Servlet v2.4 container in a single 140KB jar file ? Try Winstone
(http://winstone.sourceforge.net)


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: port number at runtime

Posted by saugata ghosh <sa...@yahoo.com>.
request.getServerPort()
-Thanks, but this returns the port number of the
current request port.
But my problem is, say the request is for http: and I
want to redirect to https:/.../somefile.jsp. - then ?
Basically what is required is a method that will
return the port number set in the conf/server.xml
file.

-Saugata

--- G�nter_Knauf <fu...@apache.org> wrote:
> Hi,
> > It will be very usefull if the port number on
> which
> > the SSL and Http non-ssl ports are running, is
> > available runtime. (Ex:- 8080 and 8443).
> > Is it possible?
> 
> > The "int getPort()" method of the CoyoteConnector
> > class returns the port number but its not
> accessible
> > at runtime. If there is a "sendRedirect()" method
> in
> > some jsp, where one wants to redirect from http to
> say
> > https, then the port number must be known in
> advance.
> > So there is a need for such an API.
> request.getServerPort()
> 
> see the jsp snoop example.
> 
> Guenter.
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tomcat-dev-help@jakarta.apache.org
> 
> 



		
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: port number at runtime

Posted by Günter Knauf <fu...@apache.org>.
Hi,
> It will be very usefull if the port number on which
> the SSL and Http non-ssl ports are running, is
> available runtime. (Ex:- 8080 and 8443).
> Is it possible?

> The "int getPort()" method of the CoyoteConnector
> class returns the port number but its not accessible
> at runtime. If there is a "sendRedirect()" method in
> some jsp, where one wants to redirect from http to say
> https, then the port number must be known in advance.
> So there is a need for such an API.
request.getServerPort()

see the jsp snoop example.

Guenter.



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org