You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by na...@us.elster.com on 2010/09/07 20:42:10 UTC

If Tomcat is configured to accept both HTTP and HTTPS, how to know in axis2 if the request came over HTTPS?

Folks

In my server code, I need to know if the call received came through over 
HTTP or HTTPS. I would like to process the request a bit differently  if 
the request came through HTTPS.

How can I do this in axis2 1.2 (the version I am using)? If it is easier 
to do in axis2 1.5.1, I could upgrade.

I would much appreciate code samples.

Thanks

Nav Kumar


Re: If Tomcat is configured to accept both HTTP and HTTPS, how to know in axis2 if the request came over HTTPS?

Posted by na...@us.elster.com.
I tried a variant on Prabath idea and the following works: 

String incomingTransport = messageContext.getIncomingTransportName();
if (incomingTransport.equals("https" )) { 

} 

Also I found that messageContext.getTo() returns the URL the client used: 
something like https://hostname/axis2/services/ServiceName and may also be 
used to determine if the call came over https.
 
I wonder though if using getIncomingTransportName() to determine the call 
came over secure lines is secure enough. 

I would be returning sensitive data when I think the call came over https. 
I would deny the call otherwise.

Nav


From:
navaneet.kumar@us.elster.com
To:
java-user@axis.apache.org
Cc:
java-user@axis.apache.org
Date:
09/07/2010 04:03 PM
Subject:
Re: If Tomcat is configured to accept both HTTP and HTTPS, how to know in 
axis2 if the request came over HTTPS?



Prabath: 

TRANSPORT_HTTP is the only HTTP related Constant available. I do not see 
TRANSPORT_HTTPS: 

There is no org.apache.axis2.Constants.TRANSPORT_HTTPS, only 
org.apache.axis2.Constants.TRANSPORT_HTTP 

Is there another way? 

Nav 


From: 
navaneet.kumar@us.elster.com 
To: 
java-user@axis.apache.org 
Cc: 
java-user@axis.apache.org 
Date: 
09/07/2010 03:34 PM 
Subject: 
Re: If Tomcat is configured to accept both HTTP and HTTPS, how to know in 
axis2 if the request came over HTTPS?




Thanks Prabath. I would test it out. 

From: 
Prabath Siriwardana <pr...@wso2.com> 
To: 
java-user@axis.apache.org 
Date: 
09/07/2010 03:29 PM 
Subject: 
Re: If Tomcat is configured to accept both HTTP and HTTPS, how to know in 
axis2 if the request came over HTTPS?





String incomingTransport = messageContext.getIncomingTransportName();
if (!org.apache.axis2.Constants.TRANSPORT_HTTPS.equals(incomingTransport 
)) { 

} 
 
Thanks & regards, 
-Prabath

On Wed, Sep 8, 2010 at 12:51 AM, <na...@us.elster.com> wrote: 
Thanks Deepal for the quick response. 

What key should I use to get the request URL? I went through the Constants 
java doc but it was not immediately clear. 


MessageContext messageContext = MessageContext.getCurrentMessageContext(); 
 
       if(messageContext != null){
           String url = (String)messageContext.getProperty("????");
       } 
From: 
Deepal jayasinghe <de...@gmail.com> 
To: 
java-user@axis.apache.org 
Date: 
09/07/2010 02:46 PM 
Subject: 
Re: If Tomcat is configured to accept both HTTP and HTTPS, how to know in 
axis2 if the request came over HTTPS?







You can do that by looking at the request URL which you can access using 
MessageContext.

Deepal 
Folks 

In my server code, I need to know if the call received came through over 
HTTP or HTTPS. I would like to process the request a bit differently  if 
the request came through HTTPS. 

How can I do this in axis2 1.2 (the version I am using)? If it is easier 
to do in axis2 1.5.1, I could upgrade. 

I would much appreciate code samples. 

Thanks 

Nav Kumar 



______________________________________________________________________
This email has been spam and virus checked by Elster IT Services. 



-- 
Thanks & Regards,
Prabath Siriwardena

http://blog.facilelogin.com
http://RampartFAQ.com

______________________________________________________________________
This email has been spam and virus checked by Elster IT Services. 

______________________________________________________________________
This email has been spam and virus checked by Elster IT Services. 

______________________________________________________________________
This email has been spam and virus checked by Elster IT Services.

Re: If Tomcat is configured to accept both HTTP and HTTPS, how to know in axis2 if the request came over HTTPS?

Posted by na...@us.elster.com.
Prabath:

TRANSPORT_HTTP is the only HTTP related Constant available. I do not see 
TRANSPORT_HTTPS:

There is no org.apache.axis2.Constants.TRANSPORT_HTTPS, only 
org.apache.axis2.Constants.TRANSPORT_HTTP

Is there another way?

Nav



From:
navaneet.kumar@us.elster.com
To:
java-user@axis.apache.org
Cc:
java-user@axis.apache.org
Date:
09/07/2010 03:34 PM
Subject:
Re: If Tomcat is configured to accept both HTTP and HTTPS, how to know in 
axis2 if the request came over HTTPS?



Thanks Prabath. I would test it out. 


From: 
Prabath Siriwardana <pr...@wso2.com> 
To: 
java-user@axis.apache.org 
Date: 
09/07/2010 03:29 PM 
Subject: 
Re: If Tomcat is configured to accept both HTTP and HTTPS, how to know in 
axis2 if the request came over HTTPS?




String incomingTransport = messageContext.getIncomingTransportName();
if (!org.apache.axis2.Constants.TRANSPORT_HTTPS.equals(incomingTransport 
)) { 

} 
 
Thanks & regards, 
-Prabath

On Wed, Sep 8, 2010 at 12:51 AM, <na...@us.elster.com> wrote: 
Thanks Deepal for the quick response. 

What key should I use to get the request URL? I went through the Constants 
java doc but it was not immediately clear. 


MessageContext messageContext = MessageContext.getCurrentMessageContext(); 
 
        if(messageContext != null){
            String url = (String)messageContext.getProperty("????");
        } 
From: 
Deepal jayasinghe <de...@gmail.com> 
To: 
java-user@axis.apache.org 
Date: 
09/07/2010 02:46 PM 
Subject: 
Re: If Tomcat is configured to accept both HTTP and HTTPS, how to know in 
axis2 if the request came over HTTPS?






You can do that by looking at the request URL which you can access using 
MessageContext.

Deepal 
Folks 

In my server code, I need to know if the call received came through over 
HTTP or HTTPS. I would like to process the request a bit differently  if 
the request came through HTTPS. 

How can I do this in axis2 1.2 (the version I am using)? If it is easier 
to do in axis2 1.5.1, I could upgrade. 

I would much appreciate code samples. 

Thanks 

Nav Kumar 



______________________________________________________________________
This email has been spam and virus checked by Elster IT Services. 



-- 
Thanks & Regards,
Prabath Siriwardena

http://blog.facilelogin.com
http://RampartFAQ.com

______________________________________________________________________
This email has been spam and virus checked by Elster IT Services. 

______________________________________________________________________
This email has been spam and virus checked by Elster IT Services.

Re: If Tomcat is configured to accept both HTTP and HTTPS, how to know in axis2 if the request came over HTTPS?

Posted by na...@us.elster.com.
Thanks Prabath. I would test it out.



From:
Prabath Siriwardana <pr...@wso2.com>
To:
java-user@axis.apache.org
Date:
09/07/2010 03:29 PM
Subject:
Re: If Tomcat is configured to accept both HTTP and HTTPS, how to know in 
axis2 if the request came over HTTPS?



String incomingTransport = messageContext.getIncomingTransportName();
if (!org.apache.axis2.Constants.TRANSPORT_HTTPS.equals(incomingTransport 
)) {

}
 
Thanks & regards,
-Prabath

On Wed, Sep 8, 2010 at 12:51 AM, <na...@us.elster.com> wrote:
Thanks Deepal for the quick response. 

What key should I use to get the request URL? I went through the Constants 
java doc but it was not immediately clear. 


MessageContext messageContext = MessageContext
.getCurrentMessageContext();        
        if(messageContext != null){
            String url = (String)messageContext.getProperty("????");
        } 

From: 
Deepal jayasinghe <de...@gmail.com> 
To: 
java-user@axis.apache.org 
Date: 
09/07/2010 02:46 PM 
Subject: 
Re: If Tomcat is configured to accept both HTTP and HTTPS, how to know in 
axis2 if the request came over HTTPS?





You can do that by looking at the request URL which you can access using 
MessageContext.

Deepal 
Folks 

In my server code, I need to know if the call received came through over 
HTTP or HTTPS. I would like to process the request a bit differently  if 
the request came through HTTPS. 

How can I do this in axis2 1.2 (the version I am using)? If it is easier 
to do in axis2 1.5.1, I could upgrade. 

I would much appreciate code samples. 

Thanks 

Nav Kumar 



______________________________________________________________________
This email has been spam and virus checked by Elster IT Services. 



-- 
Thanks & Regards,
Prabath Siriwardena

http://blog.facilelogin.com
http://RampartFAQ.com

______________________________________________________________________
This email has been spam and virus checked by Elster IT Services.

Re: If Tomcat is configured to accept both HTTP and HTTPS, how to know in axis2 if the request came over HTTPS?

Posted by Prabath Siriwardana <pr...@wso2.com>.
String incomingTransport = messageContext.getIncomingTransportName();
if (!org.apache.axis2.Constants.TRANSPORT_HTTPS.equals(incomingTransport ))
{

}

Thanks & regards,
-Prabath

On Wed, Sep 8, 2010 at 12:51 AM, <na...@us.elster.com> wrote:

> Thanks Deepal for the quick response.
>
> What key should I use to get the request URL? I went through the Constants
> java doc but it was not immediately clear.
>
>
> *MessageContext* *messageContext* = *MessageContext*.getCurrentMessageContext();
>
>         if(*messageContext* != null){
>             String url = (String)*messageContext*.getProperty(*"????")*;
>         }
>
>   From: Deepal jayasinghe <de...@gmail.com> To:
> java-user@axis.apache.org Date: 09/07/2010 02:46 PM Subject: Re: If Tomcat
> is configured to accept both HTTP and HTTPS, how to know in axis2 if the
> request came over HTTPS?
> ------------------------------
>
>
>
> You can do that by looking at the request URL which you can access using
> MessageContext.
>
> Deepal
> Folks
>
> In my server code, I need to know if the call received came through over
> HTTP or HTTPS. I would like to process the request a bit differently  if the
> request came through HTTPS.
>
> How can I do this in axis2 1.2 (the version I am using)? If it is easier to
> do in axis2 1.5.1, I could upgrade.
>
> I would much appreciate code samples.
>
> Thanks
>
> Nav Kumar
>
>
>
> ______________________________________________________________________
> This email has been spam and virus checked by Elster IT Services.
>



-- 
Thanks & Regards,
Prabath Siriwardena

http://blog.facilelogin.com
http://RampartFAQ.com

Re: If Tomcat is configured to accept both HTTP and HTTPS, how to know in axis2 if the request came over HTTPS?

Posted by na...@us.elster.com.
Thanks Deepal for the quick response.

What key should I use to get the request URL? I went through the Constants 
java doc but it was not immediately clear.


MessageContext messageContext = MessageContext
.getCurrentMessageContext();        
        if(messageContext != null){
            String url = (String)messageContext.getProperty("????");
        } 


From:
Deepal jayasinghe <de...@gmail.com>
To:
java-user@axis.apache.org
Date:
09/07/2010 02:46 PM
Subject:
Re: If Tomcat is configured to accept both HTTP and HTTPS, how to know in 
axis2 if the request came over HTTPS?



You can do that by looking at the request URL which you can access using 
MessageContext.

Deepal
Folks 

In my server code, I need to know if the call received came through over 
HTTP or HTTPS. I would like to process the request a bit differently  if 
the request came through HTTPS. 

How can I do this in axis2 1.2 (the version I am using)? If it is easier 
to do in axis2 1.5.1, I could upgrade. 

I would much appreciate code samples. 

Thanks 

Nav Kumar 



______________________________________________________________________
This email has been spam and virus checked by Elster IT Services.

Re: If Tomcat is configured to accept both HTTP and HTTPS, how to know in axis2 if the request came over HTTPS?

Posted by Deepal jayasinghe <de...@gmail.com>.
  You can do that by looking at the request URL which you can access 
using MessageContext.

Deepal
> Folks
>
> In my server code, I need to know if the call received came through 
> over HTTP or HTTPS. I would like to process the request a bit 
> differently  if the request came through HTTPS.
>
> How can I do this in axis2 1.2 (the version I am using)? If it is 
> easier to do in axis2 1.5.1, I could upgrade.
>
> I would much appreciate code samples.
>
> Thanks
>
> Nav Kumar
>