You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Martin Alley <ma...@ntlworld.com> on 2004/05/08 18:35:46 UTC
How to get http and https port # from struts-config in filter?
Hi,
I have a servlet filter to handle session timeouts.
This filter needs to redirect to an http page so that the new session
works in both http and https, so a forward is no good as the old session
may have timed out on an https page.
I'm using the sslext struts plugin which is configured with the port
numbers for http and https. I would like to read this port numbers in
the filter, so I can redirect to the correct absolute url (assuming host
name is the same for secure and insecure pages).
How do I do this? Hopefully there's an API that can just give me these
parameters. I don't want to (nor should I have to) parse the
struts-config myself.
Thanks
Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: How to get http and https port # from struts-config in filter?
Posted by Mark Lowe <ma...@boxstuff.com>.
Okay I see what you mean now, I don't use sslext as it seems like a
struts plugin that could just as well be done using a filter or even
mod_rewrite in apache (for deployment).
If you're using a filter anyway why not write another one to deal with
all this stuff the sslext does?
On 9 May 2004, at 21:23, Martin Alley wrote:
> The point is the current request is not using the http port. The only
> thing that tells me the port # I require is in a config file -
> struts-config.xml (or potentially tomcat server.xml)
>
> -----Original Message-----
> From: Mark Lowe [mailto:mark.lowe@boxstuff.com]
> Sent: 09 May 2004 18:41
> To: Struts Users Mailing List
> Subject: Re: How to get http and https port # from struts-config in
> filter?
>
> I see what you mean.. Seeing as you got as far as reading the
> getScheme() bit of the javadoc you could push the boat out and explore
> it further for something more up your street.
>
> request.getServerPort()
>
> The 2.4 servlet spec has some other methods to do the same thing.
>
> http://jakarta.apache.org/tomcat/tomcat-5.0-doc/servletapi/javax/
> servlet/ServletRequest.html
>
>
> On 9 May 2004, at 08:36, Martin Alley wrote:
>
>> That doesn't look appropriate.
>>
>> If the session times out on an https request, I want to redirect to
>> http, and need to know the http port number (it's not necessarily the
>> default 80).
>>
>> According to the docs, request.getScheme() "Returns the name of the
>> scheme used to make this request, for example, http, https, or ftp."
>>
>> Martin
>>
>>
>> -----Original Message-----
>> From: Mark Lowe [mailto:mark.lowe@boxstuff.com]
>> Sent: 08 May 2004 19:05
>> To: Struts Users Mailing List
>> Subject: Re: How to get http and https port # from struts-config in
>> filter?
>>
>> The api you want would be the servlet api
>>
>> request.getScheme()
>>
>>
>> On 8 May 2004, at 18:35, Martin Alley wrote:
>>
>>> Hi,
>>>
>>> I have a servlet filter to handle session timeouts.
>>>
>>> This filter needs to redirect to an http page so that the new session
>>> works in both http and https, so a forward is no good as the old
>>> session
>>> may have timed out on an https page.
>>>
>>> I'm using the sslext struts plugin which is configured with the port
>>> numbers for http and https. I would like to read this port numbers
> in
>>> the filter, so I can redirect to the correct absolute url (assuming
>>> host
>>> name is the same for secure and insecure pages).
>>>
>>> How do I do this? Hopefully there's an API that can just give me
>> these
>>> parameters. I don't want to (nor should I have to) parse the
>>> struts-config myself.
>>>
>>> Thanks
>>> Martin
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: How to get http and https port # from struts-config in filter?
Posted by Martin Alley <ma...@ntlworld.com>.
The point is the current request is not using the http port. The only
thing that tells me the port # I require is in a config file -
struts-config.xml (or potentially tomcat server.xml)
-----Original Message-----
From: Mark Lowe [mailto:mark.lowe@boxstuff.com]
Sent: 09 May 2004 18:41
To: Struts Users Mailing List
Subject: Re: How to get http and https port # from struts-config in
filter?
I see what you mean.. Seeing as you got as far as reading the
getScheme() bit of the javadoc you could push the boat out and explore
it further for something more up your street.
request.getServerPort()
The 2.4 servlet spec has some other methods to do the same thing.
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/servletapi/javax/
servlet/ServletRequest.html
On 9 May 2004, at 08:36, Martin Alley wrote:
> That doesn't look appropriate.
>
> If the session times out on an https request, I want to redirect to
> http, and need to know the http port number (it's not necessarily the
> default 80).
>
> According to the docs, request.getScheme() "Returns the name of the
> scheme used to make this request, for example, http, https, or ftp."
>
> Martin
>
>
> -----Original Message-----
> From: Mark Lowe [mailto:mark.lowe@boxstuff.com]
> Sent: 08 May 2004 19:05
> To: Struts Users Mailing List
> Subject: Re: How to get http and https port # from struts-config in
> filter?
>
> The api you want would be the servlet api
>
> request.getScheme()
>
>
> On 8 May 2004, at 18:35, Martin Alley wrote:
>
>> Hi,
>>
>> I have a servlet filter to handle session timeouts.
>>
>> This filter needs to redirect to an http page so that the new session
>> works in both http and https, so a forward is no good as the old
>> session
>> may have timed out on an https page.
>>
>> I'm using the sslext struts plugin which is configured with the port
>> numbers for http and https. I would like to read this port numbers
in
>> the filter, so I can redirect to the correct absolute url (assuming
>> host
>> name is the same for secure and insecure pages).
>>
>> How do I do this? Hopefully there's an API that can just give me
> these
>> parameters. I don't want to (nor should I have to) parse the
>> struts-config myself.
>>
>> Thanks
>> Martin
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: How to get http and https port # from struts-config in filter?
Posted by Mark Lowe <ma...@boxstuff.com>.
I see what you mean.. Seeing as you got as far as reading the
getScheme() bit of the javadoc you could push the boat out and explore
it further for something more up your street.
request.getServerPort()
The 2.4 servlet spec has some other methods to do the same thing.
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/servletapi/javax/
servlet/ServletRequest.html
On 9 May 2004, at 08:36, Martin Alley wrote:
> That doesn't look appropriate.
>
> If the session times out on an https request, I want to redirect to
> http, and need to know the http port number (it's not necessarily the
> default 80).
>
> According to the docs, request.getScheme() "Returns the name of the
> scheme used to make this request, for example, http, https, or ftp."
>
> Martin
>
>
> -----Original Message-----
> From: Mark Lowe [mailto:mark.lowe@boxstuff.com]
> Sent: 08 May 2004 19:05
> To: Struts Users Mailing List
> Subject: Re: How to get http and https port # from struts-config in
> filter?
>
> The api you want would be the servlet api
>
> request.getScheme()
>
>
> On 8 May 2004, at 18:35, Martin Alley wrote:
>
>> Hi,
>>
>> I have a servlet filter to handle session timeouts.
>>
>> This filter needs to redirect to an http page so that the new session
>> works in both http and https, so a forward is no good as the old
>> session
>> may have timed out on an https page.
>>
>> I'm using the sslext struts plugin which is configured with the port
>> numbers for http and https. I would like to read this port numbers in
>> the filter, so I can redirect to the correct absolute url (assuming
>> host
>> name is the same for secure and insecure pages).
>>
>> How do I do this? Hopefully there's an API that can just give me
> these
>> parameters. I don't want to (nor should I have to) parse the
>> struts-config myself.
>>
>> Thanks
>> Martin
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: How to get http and https port # from struts-config in filter?
Posted by Martin Alley <ma...@ntlworld.com>.
That doesn't look appropriate.
If the session times out on an https request, I want to redirect to
http, and need to know the http port number (it's not necessarily the
default 80).
According to the docs, request.getScheme() "Returns the name of the
scheme used to make this request, for example, http, https, or ftp."
Martin
-----Original Message-----
From: Mark Lowe [mailto:mark.lowe@boxstuff.com]
Sent: 08 May 2004 19:05
To: Struts Users Mailing List
Subject: Re: How to get http and https port # from struts-config in
filter?
The api you want would be the servlet api
request.getScheme()
On 8 May 2004, at 18:35, Martin Alley wrote:
> Hi,
>
> I have a servlet filter to handle session timeouts.
>
> This filter needs to redirect to an http page so that the new session
> works in both http and https, so a forward is no good as the old
> session
> may have timed out on an https page.
>
> I'm using the sslext struts plugin which is configured with the port
> numbers for http and https. I would like to read this port numbers in
> the filter, so I can redirect to the correct absolute url (assuming
> host
> name is the same for secure and insecure pages).
>
> How do I do this? Hopefully there's an API that can just give me
these
> parameters. I don't want to (nor should I have to) parse the
> struts-config myself.
>
> Thanks
> Martin
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: How to get http and https port # from struts-config in filter?
Posted by Mark Lowe <ma...@boxstuff.com>.
The api you want would be the servlet api
request.getScheme()
On 8 May 2004, at 18:35, Martin Alley wrote:
> Hi,
>
> I have a servlet filter to handle session timeouts.
>
> This filter needs to redirect to an http page so that the new session
> works in both http and https, so a forward is no good as the old
> session
> may have timed out on an https page.
>
> I'm using the sslext struts plugin which is configured with the port
> numbers for http and https. I would like to read this port numbers in
> the filter, so I can redirect to the correct absolute url (assuming
> host
> name is the same for secure and insecure pages).
>
> How do I do this? Hopefully there's an API that can just give me these
> parameters. I don't want to (nor should I have to) parse the
> struts-config myself.
>
> Thanks
> Martin
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org