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 rahulsnh <ra...@gmail.com> on 2009/01/27 14:31:25 UTC
How to get transport type during runtime
Hi all,
I'm using axis2 to develop a webservice server methods. One of the methods
is:
*****************************************************************
*********A simplified logic has been presented in form of code
below************
*****************************************************************
public RequestLaunchUrlResponseDocument RequestLaunchUrl(
RequestLaunchUrlDocument requestLaunchUrlDoc){
/*
String returnUrl = "hotmail.com";
if(getTransportReceiverType().equals("https"))
returnUrl = "https://" + returnUrl;
else
returnUrl = "http://" + returnUrl;
RequestLaunchUrlResponseDocument rLURDoc =
RequestLaunchUrlResponseDocument.Factory.newInstance();
RequestLaunchUrlResponse rLUResp =
rLURDoc.addNewRequestLaunchUrlResponse();
DataShareLaunchUrlReturn rLUResult = rLUResp.setLaunchUrl(returnUrl);
return rLURDoc;
*/
}
************************************************************
My problem is how do I write the method getTransportReceiverType() which
returns me the transport type in which the request was received. In other
words, is there a way to figure out the transport-type during runtime.
I'm using code generated using xml-beans for data-binding.
Since this module was developed to be a part of already existing
web-application there exist no axis2.xml for configuration. The requests are
intercepted using AxisServlet which has been added to web.xml
<servlet>
<servlet-name>AxisServlet</servlet-name>
<servlet-class>org.apache.axis2.transport.http.AxisServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
Both HTTP and HTTPS requests are allowed.
Please feel free to send me emails if you need clarification.
Thanks in advance,
Regards,
Rahul Sinha
--
View this message in context: http://www.nabble.com/How-to-get-transport-type-during-runtime-tp21685343p21685343.html
Sent from the Axis - User mailing list archive at Nabble.com.
Re: How to get transport type during runtime
Posted by Amila Suriarachchi <am...@gmail.com>.
try this,
MessageContext.getCurrentMessageContext().getIncomingTransportName();
thanks,
Amila.
On Tue, Jan 27, 2009 at 7:01 PM, rahulsnh <ra...@gmail.com> wrote:
>
> Hi all,
>
> I'm using axis2 to develop a webservice server methods. One of the methods
> is:
>
> *****************************************************************
> *********A simplified logic has been presented in form of code
> below************
> *****************************************************************
> public RequestLaunchUrlResponseDocument RequestLaunchUrl(
> RequestLaunchUrlDocument requestLaunchUrlDoc){
> /*
> String returnUrl = "hotmail.com";
>
> if(getTransportReceiverType().equals("https"))
> returnUrl = "https://" + returnUrl;
> else
> returnUrl = "http://" + returnUrl;
>
> RequestLaunchUrlResponseDocument rLURDoc =
>
> RequestLaunchUrlResponseDocument.Factory.newInstance();
> RequestLaunchUrlResponse rLUResp =
> rLURDoc.addNewRequestLaunchUrlResponse();
> DataShareLaunchUrlReturn rLUResult =
> rLUResp.setLaunchUrl(returnUrl);
> return rLURDoc;
> */
>
> }
> ************************************************************
>
> My problem is how do I write the method getTransportReceiverType() which
> returns me the transport type in which the request was received. In other
> words, is there a way to figure out the transport-type during runtime.
>
> I'm using code generated using xml-beans for data-binding.
> Since this module was developed to be a part of already existing
> web-application there exist no axis2.xml for configuration. The requests
> are
> intercepted using AxisServlet which has been added to web.xml
>
> <servlet>
> <servlet-name>AxisServlet</servlet-name>
>
> <servlet-class>org.apache.axis2.transport.http.AxisServlet</servlet-class>
> <load-on-startup>1</load-on-startup>
> </servlet>
>
> Both HTTP and HTTPS requests are allowed.
> Please feel free to send me emails if you need clarification.
>
> Thanks in advance,
> Regards,
> Rahul Sinha
> --
> View this message in context:
> http://www.nabble.com/How-to-get-transport-type-during-runtime-tp21685343p21685343.html
> Sent from the Axis - User mailing list archive at Nabble.com.
>
>
--
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/