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 Srinath Perera <he...@gmail.com> on 2008/12/17 14:05:08 UTC

[Axis2]Finding current tomcat Port from Axis2

Hi All;

Is there a way to find the current tomcat port using Axis2 (I need it
to set a replyto address)? Ideally I want to find the service port at
the start up, before any request arrived. If that does not work, I
might be able to live with getting it with message context. Does the
message context property TRANSPORT_ADDR give what I want to find?

Thanks very much
Srinath

-- 
============================
Srinath Perera:
   Indiana University, Bloomington
   http://www.cs.indiana.edu/~hperera/
   http://www.bloglines.com/blog/hemapani

Re: [Axis2]Finding current tomcat Port from Axis2

Posted by Srinath Perera <he...@gmail.com>.
yep, but MBean work only if MBean server is truned on (am I right?),
which is off by default  AFAIK. Group of people suppose to use my
agent and I can not ask them all to turn on JMX. If worse come to
worse I would provide a configuration parameter.
Thanks
Srinath


On Thu, Dec 18, 2008 at 3:15 PM, Afkham Azeez <af...@gmail.com> wrote:
> This is a bit tricky since the Tomcat's server.xml file is different from
> version to version. Hence you will be tied to one or just a few versions of
> Tomcat. On the other hand, if you had used the MBean, you could have easily
> supported multiple versions of Tomcat.
>
> Azeez
>
> On Fri, Dec 19, 2008 at 1:38 AM, Srinath Perera <he...@gmail.com> wrote:
>>
>> No, that code again go and call listenerManager.getEPRforService(..),
>> which I was using. I walked through the code, and
>> listenerManager.getEPRforService(..) work fine with other transports,
>> but with tomcat, it reads the port off the first request. When in
>> doubt  (before the request arrives) it give 8080, which is the case
>> thilina was complaining .
>>
>> For my usecase, I can not wait for the first request as what I am
>> developing is a management agent. for now, I wrote a code to parse
>> tomcat server.xml.
>>
>> Thanks very much
>> Srinath
>>
>>
>> On Thu, Dec 18, 2008 at 2:50 PM, Sanjiva Weerawarana
>> <sa...@opensource.lk> wrote:
>> > Srinath, doesn't ServiceContext.getMyEPR() give you the info you need?
>> >
>> > Sanjiva.
>> >
>> > Srinath Perera wrote:
>> >>
>> >> Hi All;
>> >>
>> >> Is there a way to find the current tomcat port using Axis2 (I need it
>> >> to set a replyto address)? Ideally I want to find the service port at
>> >> the start up, before any request arrived. If that does not work, I
>> >> might be able to live with getting it with message context. Does the
>> >> message context property TRANSPORT_ADDR give what I want to find?
>> >>
>> >> Thanks very much
>> >> Srinath
>> >
>> >
>> > --
>> > Sanjiva Weerawarana, Ph.D.
>> > Founder & Director; Lanka Software Foundation; http://www.opensource.lk/
>> > Founder, Chairman & CEO; WSO2, Inc.; http://www.wso2.com/
>> > Member; Apache Software Foundation; http://www.apache.org/
>> > Visiting Lecturer; University of Moratuwa; http://www.cse.mrt.ac.lk/
>> >
>> > Blog: http://sanjiva.weerawarana.org/
>> >
>>
>>
>>
>> --
>> ============================
>> Srinath Perera:
>>   Indiana University, Bloomington
>>   http://www.cs.indiana.edu/~hperera/
>>   http://www.bloglines.com/blog/hemapani
>
>
>
> --
> Thanks
> Afkham Azeez
>
> Blog: http://afkham.org
> Developer Portal: http://www.wso2.org
> WSAS Blog: http://wso2wsas.blogspot.com
> Company: http://wso2.com
> GPG Fingerprint: 643F C2AF EB78 F886 40C9  B2A2 4AE2 C887 665E 0760
>



-- 
============================
Srinath Perera:
   Indiana University, Bloomington
   http://www.cs.indiana.edu/~hperera/
   http://www.bloglines.com/blog/hemapani

Re: [Axis2]Finding current tomcat Port from Axis2

Posted by Deepal jayasinghe <de...@gmail.com>.
> This is a bit tricky since the Tomcat's server.xml file is different
> from version to version. Hence you will be tied to one or just a few
> versions of Tomcat. On the other hand, if you had used the MBean, you
> could have easily supported multiple versions of Tomcat.
Is there any way we can add the tomcat handler and feed those
information into the servlet context ?

That would be a better approach then dealing with server.xml and MBens.

Deepal
>
> Azeez
>


Re: [Axis2]Finding current tomcat Port from Axis2

Posted by Afkham Azeez <af...@gmail.com>.
This is a bit tricky since the Tomcat's server.xml file is different from
version to version. Hence you will be tied to one or just a few versions of
Tomcat. On the other hand, if you had used the MBean, you could have easily
supported multiple versions of Tomcat.

Azeez

On Fri, Dec 19, 2008 at 1:38 AM, Srinath Perera <he...@gmail.com> wrote:

> No, that code again go and call listenerManager.getEPRforService(..),
> which I was using. I walked through the code, and
> listenerManager.getEPRforService(..) work fine with other transports,
> but with tomcat, it reads the port off the first request. When in
> doubt  (before the request arrives) it give 8080, which is the case
> thilina was complaining .
>
> For my usecase, I can not wait for the first request as what I am
> developing is a management agent. for now, I wrote a code to parse
> tomcat server.xml.
>
> Thanks very much
> Srinath
>
>
> On Thu, Dec 18, 2008 at 2:50 PM, Sanjiva Weerawarana
> <sa...@opensource.lk> wrote:
> > Srinath, doesn't ServiceContext.getMyEPR() give you the info you need?
> >
> > Sanjiva.
> >
> > Srinath Perera wrote:
> >>
> >> Hi All;
> >>
> >> Is there a way to find the current tomcat port using Axis2 (I need it
> >> to set a replyto address)? Ideally I want to find the service port at
> >> the start up, before any request arrived. If that does not work, I
> >> might be able to live with getting it with message context. Does the
> >> message context property TRANSPORT_ADDR give what I want to find?
> >>
> >> Thanks very much
> >> Srinath
> >
> >
> > --
> > Sanjiva Weerawarana, Ph.D.
> > Founder & Director; Lanka Software Foundation; http://www.opensource.lk/
> > Founder, Chairman & CEO; WSO2, Inc.; http://www.wso2.com/
> > Member; Apache Software Foundation; http://www.apache.org/
> > Visiting Lecturer; University of Moratuwa; http://www.cse.mrt.ac.lk/
> >
> > Blog: http://sanjiva.weerawarana.org/
> >
>
>
>
> --
> ============================
> Srinath Perera:
>   Indiana University, Bloomington
>   http://www.cs.indiana.edu/~hperera/<http://www.cs.indiana.edu/%7Ehperera/>
>   http://www.bloglines.com/blog/hemapani
>



-- 
Thanks
Afkham Azeez

Blog: http://afkham.org
Developer Portal: http://www.wso2.org
WSAS Blog: http://wso2wsas.blogspot.com
Company: http://wso2.com
GPG Fingerprint: 643F C2AF EB78 F886 40C9  B2A2 4AE2 C887 665E 0760

Re: [Axis2]Finding current tomcat Port from Axis2

Posted by Deepal jayasinghe <de...@gmail.com>.
> I doubt whether it's the correct behaviour. In my case I was mislead
> for some time that this gives the correct port using some magic
> underneath and it took me some debuging time to realise the method
> does not return *correct* information.
>  
> IMHO if it can't return the correct one, then it should not return
> any assumptions.. At least we should document this behaviour in BIG
> CAPITAL letters all the API's. 
>  
Agreed, this happen if you have configure a HTTP transport in servlet
case too, then it get the HTTP transport and look at its' port so it
will return one in the transport configuration (sometime that may be
different from the what tomcat is running), but you will not have any
problem in SimpleHTTP case.

Deepal

-- 
Thank you!


http://blogs.deepal.org
http://deepal.org


Re: [Axis2]Finding current tomcat Port from Axis2

Posted by Srinath Perera <he...@gmail.com>.
> IMHO if it can't return the correct one, then it should not return
> any assumptions.. At least we should document this behaviour in BIG CAPITAL
> letters all the API's.
Big +1 my 2 cents

>
> thanks,
> Thilina
>
>>
>> > For my usecase, I can not wait for the first request as what I am
>> > developing is a management agent. for now, I wrote a code to parse
>> > tomcat server.xml.
>> >
>> Well, what you are doing is ok, iff you are going to use your
>> application in tomcat. A better approach would be either feed the port
>> number using axis2.xml or web.xml
>>
>> Deepal
>
>
>
> --
> Thilina Gunarathne  - http://thilinag.blogspot.com
>



-- 
============================
Srinath Perera:
   Indiana University, Bloomington
   http://www.cs.indiana.edu/~hperera/
   http://www.bloglines.com/blog/hemapani

Re: [Axis2]Finding current tomcat Port from Axis2

Posted by Thilina Gunarathne <cs...@gmail.com>.
Hi Deepal,

On Thu, Dec 18, 2008 at 2:45 PM, Deepal jayasinghe <de...@gmail.com>wrote:

>
> > No, that code again go and call listenerManager.getEPRforService(..),
> > which I was using. I walked through the code, and
> > listenerManager.getEPRforService(..) work fine with other transports,
> > but with tomcat, it reads the port off the first request. When in
> > doubt  (before the request arrives) it give 8080, which is the case
> > thilina was complaining .
> >
> I think that is the intended behavior, because the same code should work
> for both client side and the server side.

I doubt whether it's the correct behaviour. In my case I was mislead for
some time that this gives the correct port using some magic underneath
and it took me some debuging time to realise the method does not
return *correct* information.

IMHO if it can't return the correct one, then it should not return
any assumptions.. At least we should document this behaviour in BIG CAPITAL
letters all the API's.

thanks,
Thilina


>
> > For my usecase, I can not wait for the first request as what I am
> > developing is a management agent. for now, I wrote a code to parse
> > tomcat server.xml.
> >
> Well, what you are doing is ok, iff you are going to use your
> application in tomcat. A better approach would be either feed the port
> number using axis2.xml or web.xml
>
> Deepal
>



-- 
Thilina Gunarathne  - http://thilinag.blogspot.com

Re: [Axis2]Finding current tomcat Port from Axis2

Posted by Deepal jayasinghe <de...@gmail.com>.
> No, that code again go and call listenerManager.getEPRforService(..),
> which I was using. I walked through the code, and
> listenerManager.getEPRforService(..) work fine with other transports,
> but with tomcat, it reads the port off the first request. When in
> doubt  (before the request arrives) it give 8080, which is the case
> thilina was complaining .
>   
I think that is the intended behavior, because the same code should work
for both client side and the server side.
> For my usecase, I can not wait for the first request as what I am
> developing is a management agent. for now, I wrote a code to parse
> tomcat server.xml.
>   
Well, what you are doing is ok, iff you are going to use your
application in tomcat. A better approach would be either feed the port
number using axis2.xml or web.xml

Deepal

Re: [Axis2]Finding current tomcat Port from Axis2

Posted by Srinath Perera <he...@gmail.com>.
No, that code again go and call listenerManager.getEPRforService(..),
which I was using. I walked through the code, and
listenerManager.getEPRforService(..) work fine with other transports,
but with tomcat, it reads the port off the first request. When in
doubt  (before the request arrives) it give 8080, which is the case
thilina was complaining .

For my usecase, I can not wait for the first request as what I am
developing is a management agent. for now, I wrote a code to parse
tomcat server.xml.

Thanks very much
Srinath


On Thu, Dec 18, 2008 at 2:50 PM, Sanjiva Weerawarana
<sa...@opensource.lk> wrote:
> Srinath, doesn't ServiceContext.getMyEPR() give you the info you need?
>
> Sanjiva.
>
> Srinath Perera wrote:
>>
>> Hi All;
>>
>> Is there a way to find the current tomcat port using Axis2 (I need it
>> to set a replyto address)? Ideally I want to find the service port at
>> the start up, before any request arrived. If that does not work, I
>> might be able to live with getting it with message context. Does the
>> message context property TRANSPORT_ADDR give what I want to find?
>>
>> Thanks very much
>> Srinath
>
>
> --
> Sanjiva Weerawarana, Ph.D.
> Founder & Director; Lanka Software Foundation; http://www.opensource.lk/
> Founder, Chairman & CEO; WSO2, Inc.; http://www.wso2.com/
> Member; Apache Software Foundation; http://www.apache.org/
> Visiting Lecturer; University of Moratuwa; http://www.cse.mrt.ac.lk/
>
> Blog: http://sanjiva.weerawarana.org/
>



-- 
============================
Srinath Perera:
   Indiana University, Bloomington
   http://www.cs.indiana.edu/~hperera/
   http://www.bloglines.com/blog/hemapani

Re: [Axis2]Finding current tomcat Port from Axis2

Posted by Srinath Perera <he...@gmail.com>.
thread is going much faster than I could keep up :)

As I understood in tomcat case Axis2 get the port off the first
request (all methods points to getEPRsForService() of the AxisServelt,
which points to ListingAgent). May be that is best we can do given the
situation.

Thanks very much everybody for help!!
Srinath

On Thu, Dec 18, 2008 at 3:06 PM, Sanjiva Weerawarana
<sa...@opensource.lk> wrote:
> Yes, but EPR is a better way to get the info from rather than hacking around
> message context properties.
>
> Srinath, FYI, see:
>
> http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/http/src/org/apache/axis2/transport/http/ListingAgent.java?view=markup
>
> extractHostAndPort is what pulls the host and port from the request URI. In
> particular, ServiceContext.getMyEPR() was implemented *exactly* for the
> purpose of setting a replyTo address in WS-Addressing.
>
> Sanjiva.
>
> Deepal Jayasinghe wrote:
>>
>> In Srinth's case there is no issue since he gets the request first, and
>> message context has everything he needs. And even he can construct the
>> reply to address from the TO address.
>>
>> Deepal
>>>
>>> Srinath, doesn't ServiceContext.getMyEPR() give you the info you need?
>>>
>>> Sanjiva.
>>>
>>> Srinath Perera wrote:
>>>>
>>>> Hi All;
>>>>
>>>> Is there a way to find the current tomcat port using Axis2 (I need it
>>>> to set a replyto address)? Ideally I want to find the service port at
>>>> the start up, before any request arrived. If that does not work, I
>>>> might be able to live with getting it with message context. Does the
>>>> message context property TRANSPORT_ADDR give what I want to find?
>>>>
>>>> Thanks very much
>>>> Srinath
>>>
>>
>
>
> --
> Sanjiva Weerawarana, Ph.D.
> Founder & Director; Lanka Software Foundation; http://www.opensource.lk/
> Founder, Chairman & CEO; WSO2, Inc.; http://www.wso2.com/
> Member; Apache Software Foundation; http://www.apache.org/
> Visiting Lecturer; University of Moratuwa; http://www.cse.mrt.ac.lk/
>
> Blog: http://sanjiva.weerawarana.org/
>



-- 
============================
Srinath Perera:
   Indiana University, Bloomington
   http://www.cs.indiana.edu/~hperera/
   http://www.bloglines.com/blog/hemapani

Re: [Axis2]Finding current tomcat Port from Axis2

Posted by Sanjiva Weerawarana <sa...@opensource.lk>.
Yes, but EPR is a better way to get the info from rather than hacking 
around message context properties.

Srinath, FYI, see:

http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/http/src/org/apache/axis2/transport/http/ListingAgent.java?view=markup

extractHostAndPort is what pulls the host and port from the request URI. 
In particular, ServiceContext.getMyEPR() was implemented *exactly* for the 
purpose of setting a replyTo address in WS-Addressing.

Sanjiva.

Deepal Jayasinghe wrote:
> In Srinth's case there is no issue since he gets the request first, and
> message context has everything he needs. And even he can construct the
> reply to address from the TO address.
> 
> Deepal
>> Srinath, doesn't ServiceContext.getMyEPR() give you the info you need?
>>
>> Sanjiva.
>>
>> Srinath Perera wrote:
>>> Hi All;
>>>
>>> Is there a way to find the current tomcat port using Axis2 (I need it
>>> to set a replyto address)? Ideally I want to find the service port at
>>> the start up, before any request arrived. If that does not work, I
>>> might be able to live with getting it with message context. Does the
>>> message context property TRANSPORT_ADDR give what I want to find?
>>>
>>> Thanks very much
>>> Srinath
>>
> 


-- 
Sanjiva Weerawarana, Ph.D.
Founder & Director; Lanka Software Foundation; http://www.opensource.lk/
Founder, Chairman & CEO; WSO2, Inc.; http://www.wso2.com/
Member; Apache Software Foundation; http://www.apache.org/
Visiting Lecturer; University of Moratuwa; http://www.cse.mrt.ac.lk/

Blog: http://sanjiva.weerawarana.org/

Re: [Axis2]Finding current tomcat Port from Axis2

Posted by Deepal Jayasinghe <de...@opensource.lk>.
In Srinth's case there is no issue since he gets the request first, and
message context has everything he needs. And even he can construct the
reply to address from the TO address.

Deepal
> Srinath, doesn't ServiceContext.getMyEPR() give you the info you need?
>
> Sanjiva.
>
> Srinath Perera wrote:
>> Hi All;
>>
>> Is there a way to find the current tomcat port using Axis2 (I need it
>> to set a replyto address)? Ideally I want to find the service port at
>> the start up, before any request arrived. If that does not work, I
>> might be able to live with getting it with message context. Does the
>> message context property TRANSPORT_ADDR give what I want to find?
>>
>> Thanks very much
>> Srinath
>
>

-- 
Thank you!


http://blogs.deepal.org
http://deepal.org


Re: [Axis2]Finding current tomcat Port from Axis2

Posted by Sanjiva Weerawarana <sa...@opensource.lk>.
Srinath, doesn't ServiceContext.getMyEPR() give you the info you need?

Sanjiva.

Srinath Perera wrote:
> Hi All;
> 
> Is there a way to find the current tomcat port using Axis2 (I need it
> to set a replyto address)? Ideally I want to find the service port at
> the start up, before any request arrived. If that does not work, I
> might be able to live with getting it with message context. Does the
> message context property TRANSPORT_ADDR give what I want to find?
> 
> Thanks very much
> Srinath


-- 
Sanjiva Weerawarana, Ph.D.
Founder & Director; Lanka Software Foundation; http://www.opensource.lk/
Founder, Chairman & CEO; WSO2, Inc.; http://www.wso2.com/
Member; Apache Software Foundation; http://www.apache.org/
Visiting Lecturer; University of Moratuwa; http://www.cse.mrt.ac.lk/

Blog: http://sanjiva.weerawarana.org/

Re: [Axis2]Finding current tomcat Port from Axis2

Posted by Amila Suriarachchi <am...@gmail.com>.
On Thu, Dec 18, 2008 at 10:22 PM, Srinath Perera <he...@gmail.com> wrote:

> Hi Guys;
>
> Does that mean even though it worked for simple axis server, it does
> not work on tomcat?


>
> Azeez, by any chance do you know a pointer to how to do it with
> tomcat? e.g. like JMX approach you mentioned.


See the code of the Admin App which comes with the tomcat. This application
is deployed as an privileged app (see the context.xml) and such applications
can access tomcat specific details.

you may get more information from tomcat list :)

for reply to address, if you put something like this in axis2.xml

<transportReceiver name="http"

class="org.apache.axis2.transport.http.SimpleHTTPServer">
        <parameter name="port">8090</parameter>
        <parameter name="hostname">http://localhost:8092</parameter>
    </transportReceiver>

it picks the hostname for reply to. So I think you need to hard code the
tomcat port here to appear it in the reply to header.

thanks,
Amila.


>
> Thanks
> Srinath
>
>
> On Thu, Dec 18, 2008 at 10:23 AM, Afkham Azeez <af...@gmail.com> wrote:
> > Rather, the servlet API does not support getting such information, but
> > different App servers do provide ways of getting this information.
> However,
> > you'd need to write app server specific code to get this information.
> >
> > Azeez
> >
> > On Thu, Dec 18, 2008 at 8:03 PM, Deepal jayasinghe <de...@gmail.com>
> > wrote:
> >>
> >> >
> >> >
> MessageContext.getCurrentMessageContext().getConfigurationContext().getAxisConfiguration().getTransportIn("http").getParameter("port")
> >> >
> >> > However, the port needs to be provided as a parameter in the
> >> > TransportIn config in the axis2.xml file.
> >> As thilina mentioned, in the case of tomcat you have the issues of the
> >> port. But I do not think you need to ask for the port in
> SimpleHttpServer.
> >>
> >> The problem of Tomcat or any other application server is, there is no
> >> way to get the the ports that are available for a given servlet.
> >> >
> >> > HTH
> >> > Azeez
> >> >
> >> > On Wed, Dec 17, 2008 at 8:51 PM, Srinath Perera <hemapani@gmail.com
> >> > <ma...@gmail.com>> wrote:
> >> >
> >> >     I did not see a way to get a TransportListener from config contex,
> >> >     however, in the listener manager, there is something called getEPR
> >> >     forService(), which I think will do the trick. Will try it and let
> >> > you
> >> >     know.
> >> >
> >> >     Thanks deepal, Azeez !!!
> >> >
> >> >     Srinath
> >> >
> >> >
> >> >     On Wed, Dec 17, 2008 at 10:09 AM, Deepal jayasinghe
> >> >     <deepalk@gmail.com <ma...@gmail.com>> wrote:
> >> >     > Hi Srinath,
> >> >     >
> >> >     > Nice to see you asking a question in the list :)
> >> >     > You can get the reply to address as follows
> >> >     >  - first get the configuration context
> >> >     > - from that you can get something called TransportListener
> >> >     > - from that you can ask for a reply to address.
> >> >     >
> >> >     > Thank you!
> >> >     > Deepal
> >> >     >> Hi All;
> >> >     >>
> >> >     >> Is there a way to find the current tomcat port using Axis2 (I
> >> >     need it
> >> >     >> to set a replyto address)? Ideally I want to find the service
> >> >     port at
> >> >     >> the start up, before any request arrived. If that does not
> work,
> >> > I
> >> >     >> might be able to live with getting it with message context.
> >> >     Does the
> >> >     >> message context property TRANSPORT_ADDR give what I want to
> find?
> >> >     >>
> >> >     >> Thanks very much
> >> >     >> Srinath
> >> >     >>
> >> >     >>
> >> >     >
> >> >     >
> >> >     > --
> >> >     > Thank you!
> >> >     >
> >> >     >
> >> >     > http://blogs.deepal.org
> >> >     > http://deepal.org
> >> >     >
> >> >     >
> >> >
> >> >
> >> >
> >> >     --
> >> >     ============================
> >> >     Srinath Perera:
> >> >       Indiana University, Bloomington
> >> >       http://www.cs.indiana.edu/~hperera/<http://www.cs.indiana.edu/%7Ehperera/>
> >> >     <http://www.cs.indiana.edu/%7Ehperera/>
> >> >       http://www.bloglines.com/blog/hemapani
> >> >
> >> >
> >> >
> >> >
> >> > --
> >> > Thanks
> >> > Afkham Azeez
> >> >
> >> > Blog: http://afkham.org
> >> > Developer Portal: http://www.wso2.org
> >> > WSAS Blog: http://wso2wsas.blogspot.com
> >> > Company: http://wso2.com
> >> > GPG Fingerprint: 643F C2AF EB78 F886 40C9  B2A2 4AE2 C887 665E 0760
> >>
> >>
> >> --
> >> Thank you!
> >>
> >>
> >> http://blogs.deepal.org
> >> http://deepal.org
> >>
> >
> >
> >
> > --
> > Thanks
> > Afkham Azeez
> >
> > Blog: http://afkham.org
> > Developer Portal: http://www.wso2.org
> > WSAS Blog: http://wso2wsas.blogspot.com
> > Company: http://wso2.com
> > GPG Fingerprint: 643F C2AF EB78 F886 40C9  B2A2 4AE2 C887 665E 0760
> >
>
>
>
> --
> ============================
> Srinath Perera:
>   Indiana University, Bloomington
>   http://www.cs.indiana.edu/~hperera/<http://www.cs.indiana.edu/%7Ehperera/>
>    http://www.bloglines.com/blog/hemapani
>



-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/

Re: [Axis2]Finding current tomcat Port from Axis2

Posted by Deepal jayasinghe <de...@gmail.com>.
In Tomcat there is some other way, get the request EPR and from that you
can create the reply to address.

Deepal
> Hi Guys;
>
> Does that mean even though it worked for simple axis server, it does
> not work on tomcat?
>
> Azeez, by any chance do you know a pointer to how to do it with
> tomcat? e.g. like JMX approach you mentioned.
>
> Thanks
> Srinath
>
>
> On Thu, Dec 18, 2008 at 10:23 AM, Afkham Azeez <af...@gmail.com> wrote:
>   
>> Rather, the servlet API does not support getting such information, but
>> different App servers do provide ways of getting this information. However,
>> you'd need to write app server specific code to get this information.
>>
>> Azeez
>>
>> On Thu, Dec 18, 2008 at 8:03 PM, Deepal jayasinghe <de...@gmail.com>
>> wrote:
>>     
>>>> MessageContext.getCurrentMessageContext().getConfigurationContext().getAxisConfiguration().getTransportIn("http").getParameter("port")
>>>>
>>>> However, the port needs to be provided as a parameter in the
>>>> TransportIn config in the axis2.xml file.
>>>>         
>>> As thilina mentioned, in the case of tomcat you have the issues of the
>>> port. But I do not think you need to ask for the port in SimpleHttpServer.
>>>
>>> The problem of Tomcat or any other application server is, there is no
>>> way to get the the ports that are available for a given servlet.
>>>       
>>>> HTH
>>>> Azeez
>>>>
>>>> On Wed, Dec 17, 2008 at 8:51 PM, Srinath Perera <hemapani@gmail.com
>>>> <ma...@gmail.com>> wrote:
>>>>
>>>>     I did not see a way to get a TransportListener from config contex,
>>>>     however, in the listener manager, there is something called getEPR
>>>>     forService(), which I think will do the trick. Will try it and let
>>>> you
>>>>     know.
>>>>
>>>>     Thanks deepal, Azeez !!!
>>>>
>>>>     Srinath
>>>>
>>>>
>>>>     On Wed, Dec 17, 2008 at 10:09 AM, Deepal jayasinghe
>>>>     <deepalk@gmail.com <ma...@gmail.com>> wrote:
>>>>     > Hi Srinath,
>>>>     >
>>>>     > Nice to see you asking a question in the list :)
>>>>     > You can get the reply to address as follows
>>>>     >  - first get the configuration context
>>>>     > - from that you can get something called TransportListener
>>>>     > - from that you can ask for a reply to address.
>>>>     >
>>>>     > Thank you!
>>>>     > Deepal
>>>>     >> Hi All;
>>>>     >>
>>>>     >> Is there a way to find the current tomcat port using Axis2 (I
>>>>     need it
>>>>     >> to set a replyto address)? Ideally I want to find the service
>>>>     port at
>>>>     >> the start up, before any request arrived. If that does not work,
>>>> I
>>>>     >> might be able to live with getting it with message context.
>>>>     Does the
>>>>     >> message context property TRANSPORT_ADDR give what I want to find?
>>>>     >>
>>>>     >> Thanks very much
>>>>     >> Srinath
>>>>     >>
>>>>     >>
>>>>     >
>>>>     >
>>>>     > --
>>>>     > Thank you!
>>>>     >
>>>>     >
>>>>     > http://blogs.deepal.org
>>>>     > http://deepal.org
>>>>     >
>>>>     >
>>>>
>>>>
>>>>
>>>>     --
>>>>     ============================
>>>>     Srinath Perera:
>>>>       Indiana University, Bloomington
>>>>       http://www.cs.indiana.edu/~hperera/
>>>>     <http://www.cs.indiana.edu/%7Ehperera/>
>>>>       http://www.bloglines.com/blog/hemapani
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Thanks
>>>> Afkham Azeez
>>>>
>>>> Blog: http://afkham.org
>>>> Developer Portal: http://www.wso2.org
>>>> WSAS Blog: http://wso2wsas.blogspot.com
>>>> Company: http://wso2.com
>>>> GPG Fingerprint: 643F C2AF EB78 F886 40C9  B2A2 4AE2 C887 665E 0760
>>>>         
>>> --
>>> Thank you!
>>>
>>>
>>> http://blogs.deepal.org
>>> http://deepal.org
>>>
>>>       
>>
>> --
>> Thanks
>> Afkham Azeez
>>
>> Blog: http://afkham.org
>> Developer Portal: http://www.wso2.org
>> WSAS Blog: http://wso2wsas.blogspot.com
>> Company: http://wso2.com
>> GPG Fingerprint: 643F C2AF EB78 F886 40C9  B2A2 4AE2 C887 665E 0760
>>
>>     
>
>
>
>   


-- 
Thank you!


http://blogs.deepal.org
http://deepal.org


Re: [Axis2]Finding current tomcat Port from Axis2

Posted by Michele Mazzucco <Mi...@ncl.ac.uk>.
Hi,

a possible solution for tomcat would be to parse the server.xml file.  
As alternative, enable JMX and query the MBean.

Michele


On 18 Dec 2008, at 16:52, Srinath Perera wrote:

> Azeez, by any chance do you know a pointer to how to do it with
> tomcat? e.g. like JMX approach you mentioned.


Re: [Axis2]Finding current tomcat Port from Axis2

Posted by Andreas Veithen <an...@gmail.com>.
The JSR home page [1] provides some instructions. There is an email
address to send comments to. Note however that the Early Draft Review
is now over and that they are in Public Review until Jan 12, so it
might be a bit too late to bring in new features at this moment...

[1] http://jcp.org/en/jsr/detail?id=315

On Thu, Dec 18, 2008 at 21:50, Deepal jayasinghe <de...@gmail.com> wrote:
>
>> Maybe you should propose that as an enhancement for the upcoming
>> Servlet 3.0 specification (JSR-135)...
>>
> I would love to, because this was something I was looking for few years
> back too. Do you know the procedure of doing that, I mean purposing the
> enhancement request ?
>
> Deepal
>

Re: [Axis2]Finding current tomcat Port from Axis2

Posted by Deepal jayasinghe <de...@gmail.com>.
> Maybe you should propose that as an enhancement for the upcoming
> Servlet 3.0 specification (JSR-135)...
>   
I would love to, because this was something I was looking for few years
back too. Do you know the procedure of doing that, I mean purposing the
enhancement request ?

Deepal

Re: [Axis2]Finding current tomcat Port from Axis2

Posted by Andreas Veithen <an...@gmail.com>.
Deepal,

Maybe you should propose that as an enhancement for the upcoming
Servlet 3.0 specification (JSR-135)...

Andreas

On Thu, Dec 18, 2008 at 20:53, Deepal Jayasinghe <de...@opensource.lk> wrote:
> Yes, that is because something important property is missing in servlet
> API [1]. I think API should be able to provide the ports and type
> (http,https etc) of ports that the servlet is being exposed. Since that
> is available in the application server it should not be that hard to
> expose via servlet.
>
> Thank you!
> Deepal
>
> [1] :
> http://blogs.deepal.org/2008/12/servlet-api-and-available-ports-of.html
>
> Afkham Azeez wrote:
>> There is no simple & straightforward way to get the ports before the
>> server has seen any requests.
>>
>> Azeez
>>
>> On Fri, Dec 19, 2008 at 1:02 AM, Deepal Jayasinghe
>> <deepal@opensource.lk <ma...@opensource.lk>> wrote:
>>
>>     Well, I think that works at the runtime when you receive a request not
>>     the system start up time,
>>     let's say we need to get the port before we get any request to the
>>     system, then how do we do that?
>>
>>     I remember I tried to resolve this issue a lot in Axis2, but I
>>     could not
>>     able to do that, so I have use the request to get the port. Which
>>     is not
>>     totally correct.
>>     > I think you can get the port from the HTTP "Host" header:
>>     >
>>     > http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
>>     >
>>     > So just get the message context, pull the HTTP headers and get Host.
>>     > Will work with HTTP 1.1.
>>     >
>>     > Sanjiva.
>>     >
>>     > Srinath Perera wrote:
>>     >> Hi Guys;
>>     >>
>>     >> Does that mean even though it worked for simple axis server, it
>>     does
>>     >> not work on tomcat?
>>     >>
>>     >> Azeez, by any chance do you know a pointer to how to do it with
>>     >> tomcat? e.g. like JMX approach you mentioned.
>>     >>
>>     >> Thanks
>>     >> Srinath
>>     >>
>>     >>
>>     >> On Thu, Dec 18, 2008 at 10:23 AM, Afkham Azeez
>>     <afkham@gmail.com <ma...@gmail.com>> wrote:
>>     >>> Rather, the servlet API does not support getting such
>>     information, but
>>     >>> different App servers do provide ways of getting this information.
>>     >>> However,
>>     >>> you'd need to write app server specific code to get this
>>     information.
>>     >>>
>>     >>> Azeez
>>     >>>
>>     >>> On Thu, Dec 18, 2008 at 8:03 PM, Deepal jayasinghe
>>     <deepalk@gmail.com <ma...@gmail.com>>
>>     >>> wrote:
>>     >>>>>
>>     MessageContext.getCurrentMessageContext().getConfigurationContext().getAxisConfiguration().getTransportIn("http").getParameter("port")
>>     >>>>>
>>     >>>>>
>>     >>>>> However, the port needs to be provided as a parameter in the
>>     >>>>> TransportIn config in the axis2.xml file.
>>     >>>> As thilina mentioned, in the case of tomcat you have the
>>     issues of the
>>     >>>> port. But I do not think you need to ask for the port in
>>     >>>> SimpleHttpServer.
>>     >>>>
>>     >>>> The problem of Tomcat or any other application server is,
>>     there is no
>>     >>>> way to get the the ports that are available for a given servlet.
>>     >>>>> HTH
>>     >>>>> Azeez
>>     >>>>>
>>     >>>>> On Wed, Dec 17, 2008 at 8:51 PM, Srinath Perera
>>     <hemapani@gmail.com <ma...@gmail.com>
>>     >>>>> <mailto:hemapani@gmail.com <ma...@gmail.com>>> wrote:
>>     >>>>>
>>     >>>>>     I did not see a way to get a TransportListener from config
>>     >>>>> contex,
>>     >>>>>     however, in the listener manager, there is something called
>>     >>>>> getEPR
>>     >>>>>     forService(), which I think will do the trick. Will try
>>     it and
>>     >>>>> let
>>     >>>>> you
>>     >>>>>     know.
>>     >>>>>
>>     >>>>>     Thanks deepal, Azeez !!!
>>     >>>>>
>>     >>>>>     Srinath
>>     >>>>>
>>     >>>>>
>>     >>>>>     On Wed, Dec 17, 2008 at 10:09 AM, Deepal jayasinghe
>>     >>>>>     <deepalk@gmail.com <ma...@gmail.com>
>>     <mailto:deepalk@gmail.com <ma...@gmail.com>>> wrote:
>>     >>>>>     > Hi Srinath,
>>     >>>>>     >
>>     >>>>>     > Nice to see you asking a question in the list :)
>>     >>>>>     > You can get the reply to address as follows
>>     >>>>>     >  - first get the configuration context
>>     >>>>>     > - from that you can get something called TransportListener
>>     >>>>>     > - from that you can ask for a reply to address.
>>     >>>>>     >
>>     >>>>>     > Thank you!
>>     >>>>>     > Deepal
>>     >>>>>     >> Hi All;
>>     >>>>>     >>
>>     >>>>>     >> Is there a way to find the current tomcat port using
>>     Axis2 (I
>>     >>>>>     need it
>>     >>>>>     >> to set a replyto address)? Ideally I want to find the
>>     service
>>     >>>>>     port at
>>     >>>>>     >> the start up, before any request arrived. If that
>>     does not
>>     >>>>> work,
>>     >>>>> I
>>     >>>>>     >> might be able to live with getting it with message
>>     context.
>>     >>>>>     Does the
>>     >>>>>     >> message context property TRANSPORT_ADDR give what I
>>     want to
>>     >>>>> find?
>>     >>>>>     >>
>>     >>>>>     >> Thanks very much
>>     >>>>>     >> Srinath
>>     >>>>>     >>
>>     >>>>>     >>
>>     >>>>>     >
>>     >>>>>     >
>>     >>>>>     > --
>>     >>>>>     > Thank you!
>>     >>>>>     >
>>     >>>>>     >
>>     >>>>>     > http://blogs.deepal.org
>>     >>>>>     > http://deepal.org
>>     >>>>>     >
>>     >>>>>     >
>>     >>>>>
>>     >>>>>
>>     >>>>>
>>     >>>>>     --
>>     >>>>>     ============================
>>     >>>>>     Srinath Perera:
>>     >>>>>       Indiana University, Bloomington
>>     >>>>>       http://www.cs.indiana.edu/~hperera/
>>     <http://www.cs.indiana.edu/%7Ehperera/>
>>     >>>>>     <http://www.cs.indiana.edu/%7Ehperera/>
>>     >>>>>       http://www.bloglines.com/blog/hemapani
>>     >>>>>
>>     >>>>>
>>     >>>>>
>>     >>>>>
>>     >>>>> --
>>     >>>>> Thanks
>>     >>>>> Afkham Azeez
>>     >>>>>
>>     >>>>> Blog: http://afkham.org
>>     >>>>> Developer Portal: http://www.wso2.org
>>     >>>>> WSAS Blog: http://wso2wsas.blogspot.com
>>     >>>>> Company: http://wso2.com
>>     >>>>> GPG Fingerprint: 643F C2AF EB78 F886 40C9  B2A2 4AE2 C887
>>     665E 0760
>>     >>>>
>>     >>>> --
>>     >>>> Thank you!
>>     >>>>
>>     >>>>
>>     >>>> http://blogs.deepal.org
>>     >>>> http://deepal.org
>>     >>>>
>>     >>>
>>     >>>
>>     >>> --
>>     >>> Thanks
>>     >>> Afkham Azeez
>>     >>>
>>     >>> Blog: http://afkham.org
>>     >>> Developer Portal: http://www.wso2.org
>>     >>> WSAS Blog: http://wso2wsas.blogspot.com
>>     >>> Company: http://wso2.com
>>     >>> GPG Fingerprint: 643F C2AF EB78 F886 40C9  B2A2 4AE2 C887 665E
>>     0760
>>     >>>
>>     >>
>>     >>
>>     >>
>>     >
>>     >
>>
>>     --
>>     Thank you!
>>
>>
>>     http://blogs.deepal.org
>>     http://deepal.org
>>
>>
>>
>>
>> --
>> Thanks
>> Afkham Azeez
>>
>> Blog: http://afkham.org
>> Developer Portal: http://www.wso2.org
>> WSAS Blog: http://wso2wsas.blogspot.com
>> Company: http://wso2.com
>> GPG Fingerprint: 643F C2AF EB78 F886 40C9  B2A2 4AE2 C887 665E 0760
>
> --
> Thank you!
>
>
> http://blogs.deepal.org
> http://deepal.org
>
>

Re: [Axis2]Finding current tomcat Port from Axis2

Posted by Deepal Jayasinghe <de...@opensource.lk>.
Yes, that is because something important property is missing in servlet
API [1]. I think API should be able to provide the ports and type
(http,https etc) of ports that the servlet is being exposed. Since that
is available in the application server it should not be that hard to
expose via servlet.

Thank you!
Deepal

[1] :
http://blogs.deepal.org/2008/12/servlet-api-and-available-ports-of.html

Afkham Azeez wrote:
> There is no simple & straightforward way to get the ports before the
> server has seen any requests.
>
> Azeez
>
> On Fri, Dec 19, 2008 at 1:02 AM, Deepal Jayasinghe
> <deepal@opensource.lk <ma...@opensource.lk>> wrote:
>
>     Well, I think that works at the runtime when you receive a request not
>     the system start up time,
>     let's say we need to get the port before we get any request to the
>     system, then how do we do that?
>
>     I remember I tried to resolve this issue a lot in Axis2, but I
>     could not
>     able to do that, so I have use the request to get the port. Which
>     is not
>     totally correct.
>     > I think you can get the port from the HTTP "Host" header:
>     >
>     > http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
>     >
>     > So just get the message context, pull the HTTP headers and get Host.
>     > Will work with HTTP 1.1.
>     >
>     > Sanjiva.
>     >
>     > Srinath Perera wrote:
>     >> Hi Guys;
>     >>
>     >> Does that mean even though it worked for simple axis server, it
>     does
>     >> not work on tomcat?
>     >>
>     >> Azeez, by any chance do you know a pointer to how to do it with
>     >> tomcat? e.g. like JMX approach you mentioned.
>     >>
>     >> Thanks
>     >> Srinath
>     >>
>     >>
>     >> On Thu, Dec 18, 2008 at 10:23 AM, Afkham Azeez
>     <afkham@gmail.com <ma...@gmail.com>> wrote:
>     >>> Rather, the servlet API does not support getting such
>     information, but
>     >>> different App servers do provide ways of getting this information.
>     >>> However,
>     >>> you'd need to write app server specific code to get this
>     information.
>     >>>
>     >>> Azeez
>     >>>
>     >>> On Thu, Dec 18, 2008 at 8:03 PM, Deepal jayasinghe
>     <deepalk@gmail.com <ma...@gmail.com>>
>     >>> wrote:
>     >>>>>
>     MessageContext.getCurrentMessageContext().getConfigurationContext().getAxisConfiguration().getTransportIn("http").getParameter("port")
>     >>>>>
>     >>>>>
>     >>>>> However, the port needs to be provided as a parameter in the
>     >>>>> TransportIn config in the axis2.xml file.
>     >>>> As thilina mentioned, in the case of tomcat you have the
>     issues of the
>     >>>> port. But I do not think you need to ask for the port in
>     >>>> SimpleHttpServer.
>     >>>>
>     >>>> The problem of Tomcat or any other application server is,
>     there is no
>     >>>> way to get the the ports that are available for a given servlet.
>     >>>>> HTH
>     >>>>> Azeez
>     >>>>>
>     >>>>> On Wed, Dec 17, 2008 at 8:51 PM, Srinath Perera
>     <hemapani@gmail.com <ma...@gmail.com>
>     >>>>> <mailto:hemapani@gmail.com <ma...@gmail.com>>> wrote:
>     >>>>>
>     >>>>>     I did not see a way to get a TransportListener from config
>     >>>>> contex,
>     >>>>>     however, in the listener manager, there is something called
>     >>>>> getEPR
>     >>>>>     forService(), which I think will do the trick. Will try
>     it and
>     >>>>> let
>     >>>>> you
>     >>>>>     know.
>     >>>>>
>     >>>>>     Thanks deepal, Azeez !!!
>     >>>>>
>     >>>>>     Srinath
>     >>>>>
>     >>>>>
>     >>>>>     On Wed, Dec 17, 2008 at 10:09 AM, Deepal jayasinghe
>     >>>>>     <deepalk@gmail.com <ma...@gmail.com>
>     <mailto:deepalk@gmail.com <ma...@gmail.com>>> wrote:
>     >>>>>     > Hi Srinath,
>     >>>>>     >
>     >>>>>     > Nice to see you asking a question in the list :)
>     >>>>>     > You can get the reply to address as follows
>     >>>>>     >  - first get the configuration context
>     >>>>>     > - from that you can get something called TransportListener
>     >>>>>     > - from that you can ask for a reply to address.
>     >>>>>     >
>     >>>>>     > Thank you!
>     >>>>>     > Deepal
>     >>>>>     >> Hi All;
>     >>>>>     >>
>     >>>>>     >> Is there a way to find the current tomcat port using
>     Axis2 (I
>     >>>>>     need it
>     >>>>>     >> to set a replyto address)? Ideally I want to find the
>     service
>     >>>>>     port at
>     >>>>>     >> the start up, before any request arrived. If that
>     does not
>     >>>>> work,
>     >>>>> I
>     >>>>>     >> might be able to live with getting it with message
>     context.
>     >>>>>     Does the
>     >>>>>     >> message context property TRANSPORT_ADDR give what I
>     want to
>     >>>>> find?
>     >>>>>     >>
>     >>>>>     >> Thanks very much
>     >>>>>     >> Srinath
>     >>>>>     >>
>     >>>>>     >>
>     >>>>>     >
>     >>>>>     >
>     >>>>>     > --
>     >>>>>     > Thank you!
>     >>>>>     >
>     >>>>>     >
>     >>>>>     > http://blogs.deepal.org
>     >>>>>     > http://deepal.org
>     >>>>>     >
>     >>>>>     >
>     >>>>>
>     >>>>>
>     >>>>>
>     >>>>>     --
>     >>>>>     ============================
>     >>>>>     Srinath Perera:
>     >>>>>       Indiana University, Bloomington
>     >>>>>       http://www.cs.indiana.edu/~hperera/
>     <http://www.cs.indiana.edu/%7Ehperera/>
>     >>>>>     <http://www.cs.indiana.edu/%7Ehperera/>
>     >>>>>       http://www.bloglines.com/blog/hemapani
>     >>>>>
>     >>>>>
>     >>>>>
>     >>>>>
>     >>>>> --
>     >>>>> Thanks
>     >>>>> Afkham Azeez
>     >>>>>
>     >>>>> Blog: http://afkham.org
>     >>>>> Developer Portal: http://www.wso2.org
>     >>>>> WSAS Blog: http://wso2wsas.blogspot.com
>     >>>>> Company: http://wso2.com
>     >>>>> GPG Fingerprint: 643F C2AF EB78 F886 40C9  B2A2 4AE2 C887
>     665E 0760
>     >>>>
>     >>>> --
>     >>>> Thank you!
>     >>>>
>     >>>>
>     >>>> http://blogs.deepal.org
>     >>>> http://deepal.org
>     >>>>
>     >>>
>     >>>
>     >>> --
>     >>> Thanks
>     >>> Afkham Azeez
>     >>>
>     >>> Blog: http://afkham.org
>     >>> Developer Portal: http://www.wso2.org
>     >>> WSAS Blog: http://wso2wsas.blogspot.com
>     >>> Company: http://wso2.com
>     >>> GPG Fingerprint: 643F C2AF EB78 F886 40C9  B2A2 4AE2 C887 665E
>     0760
>     >>>
>     >>
>     >>
>     >>
>     >
>     >
>
>     --
>     Thank you!
>
>
>     http://blogs.deepal.org
>     http://deepal.org
>
>
>
>
> -- 
> Thanks
> Afkham Azeez
>
> Blog: http://afkham.org
> Developer Portal: http://www.wso2.org
> WSAS Blog: http://wso2wsas.blogspot.com
> Company: http://wso2.com
> GPG Fingerprint: 643F C2AF EB78 F886 40C9  B2A2 4AE2 C887 665E 0760

-- 
Thank you!


http://blogs.deepal.org
http://deepal.org


Re: [Axis2]Finding current tomcat Port from Axis2

Posted by Afkham Azeez <af...@gmail.com>.
There is no simple & straightforward way to get the ports before the server
has seen any requests.

Azeez

On Fri, Dec 19, 2008 at 1:02 AM, Deepal Jayasinghe <de...@opensource.lk>wrote:

> Well, I think that works at the runtime when you receive a request not
> the system start up time,
> let's say we need to get the port before we get any request to the
> system, then how do we do that?
>
> I remember I tried to resolve this issue a lot in Axis2, but I could not
> able to do that, so I have use the request to get the port. Which is not
> totally correct.
> > I think you can get the port from the HTTP "Host" header:
> >
> > http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
> >
> > So just get the message context, pull the HTTP headers and get Host.
> > Will work with HTTP 1.1.
> >
> > Sanjiva.
> >
> > Srinath Perera wrote:
> >> Hi Guys;
> >>
> >> Does that mean even though it worked for simple axis server, it does
> >> not work on tomcat?
> >>
> >> Azeez, by any chance do you know a pointer to how to do it with
> >> tomcat? e.g. like JMX approach you mentioned.
> >>
> >> Thanks
> >> Srinath
> >>
> >>
> >> On Thu, Dec 18, 2008 at 10:23 AM, Afkham Azeez <af...@gmail.com>
> wrote:
> >>> Rather, the servlet API does not support getting such information, but
> >>> different App servers do provide ways of getting this information.
> >>> However,
> >>> you'd need to write app server specific code to get this information.
> >>>
> >>> Azeez
> >>>
> >>> On Thu, Dec 18, 2008 at 8:03 PM, Deepal jayasinghe <de...@gmail.com>
> >>> wrote:
> >>>>>
> MessageContext.getCurrentMessageContext().getConfigurationContext().getAxisConfiguration().getTransportIn("http").getParameter("port")
> >>>>>
> >>>>>
> >>>>> However, the port needs to be provided as a parameter in the
> >>>>> TransportIn config in the axis2.xml file.
> >>>> As thilina mentioned, in the case of tomcat you have the issues of the
> >>>> port. But I do not think you need to ask for the port in
> >>>> SimpleHttpServer.
> >>>>
> >>>> The problem of Tomcat or any other application server is, there is no
> >>>> way to get the the ports that are available for a given servlet.
> >>>>> HTH
> >>>>> Azeez
> >>>>>
> >>>>> On Wed, Dec 17, 2008 at 8:51 PM, Srinath Perera <hemapani@gmail.com
> >>>>> <ma...@gmail.com>> wrote:
> >>>>>
> >>>>>     I did not see a way to get a TransportListener from config
> >>>>> contex,
> >>>>>     however, in the listener manager, there is something called
> >>>>> getEPR
> >>>>>     forService(), which I think will do the trick. Will try it and
> >>>>> let
> >>>>> you
> >>>>>     know.
> >>>>>
> >>>>>     Thanks deepal, Azeez !!!
> >>>>>
> >>>>>     Srinath
> >>>>>
> >>>>>
> >>>>>     On Wed, Dec 17, 2008 at 10:09 AM, Deepal jayasinghe
> >>>>>     <deepalk@gmail.com <ma...@gmail.com>> wrote:
> >>>>>     > Hi Srinath,
> >>>>>     >
> >>>>>     > Nice to see you asking a question in the list :)
> >>>>>     > You can get the reply to address as follows
> >>>>>     >  - first get the configuration context
> >>>>>     > - from that you can get something called TransportListener
> >>>>>     > - from that you can ask for a reply to address.
> >>>>>     >
> >>>>>     > Thank you!
> >>>>>     > Deepal
> >>>>>     >> Hi All;
> >>>>>     >>
> >>>>>     >> Is there a way to find the current tomcat port using Axis2 (I
> >>>>>     need it
> >>>>>     >> to set a replyto address)? Ideally I want to find the service
> >>>>>     port at
> >>>>>     >> the start up, before any request arrived. If that does not
> >>>>> work,
> >>>>> I
> >>>>>     >> might be able to live with getting it with message context.
> >>>>>     Does the
> >>>>>     >> message context property TRANSPORT_ADDR give what I want to
> >>>>> find?
> >>>>>     >>
> >>>>>     >> Thanks very much
> >>>>>     >> Srinath
> >>>>>     >>
> >>>>>     >>
> >>>>>     >
> >>>>>     >
> >>>>>     > --
> >>>>>     > Thank you!
> >>>>>     >
> >>>>>     >
> >>>>>     > http://blogs.deepal.org
> >>>>>     > http://deepal.org
> >>>>>     >
> >>>>>     >
> >>>>>
> >>>>>
> >>>>>
> >>>>>     --
> >>>>>     ============================
> >>>>>     Srinath Perera:
> >>>>>       Indiana University, Bloomington
> >>>>>       http://www.cs.indiana.edu/~hperera/<http://www.cs.indiana.edu/%7Ehperera/>
> >>>>>     <http://www.cs.indiana.edu/%7Ehperera/>
> >>>>>       http://www.bloglines.com/blog/hemapani
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>> --
> >>>>> Thanks
> >>>>> Afkham Azeez
> >>>>>
> >>>>> Blog: http://afkham.org
> >>>>> Developer Portal: http://www.wso2.org
> >>>>> WSAS Blog: http://wso2wsas.blogspot.com
> >>>>> Company: http://wso2.com
> >>>>> GPG Fingerprint: 643F C2AF EB78 F886 40C9  B2A2 4AE2 C887 665E 0760
> >>>>
> >>>> --
> >>>> Thank you!
> >>>>
> >>>>
> >>>> http://blogs.deepal.org
> >>>> http://deepal.org
> >>>>
> >>>
> >>>
> >>> --
> >>> Thanks
> >>> Afkham Azeez
> >>>
> >>> Blog: http://afkham.org
> >>> Developer Portal: http://www.wso2.org
> >>> WSAS Blog: http://wso2wsas.blogspot.com
> >>> Company: http://wso2.com
> >>> GPG Fingerprint: 643F C2AF EB78 F886 40C9  B2A2 4AE2 C887 665E 0760
> >>>
> >>
> >>
> >>
> >
> >
>
> --
> Thank you!
>
>
> http://blogs.deepal.org
> http://deepal.org
>
>


-- 
Thanks
Afkham Azeez

Blog: http://afkham.org
Developer Portal: http://www.wso2.org
WSAS Blog: http://wso2wsas.blogspot.com
Company: http://wso2.com
GPG Fingerprint: 643F C2AF EB78 F886 40C9  B2A2 4AE2 C887 665E 0760

Re: [Axis2]Finding current tomcat Port from Axis2

Posted by Deepal Jayasinghe <de...@opensource.lk>.
Well, I think that works at the runtime when you receive a request not
the system start up time,
let's say we need to get the port before we get any request to the
system, then how do we do that?

I remember I tried to resolve this issue a lot in Axis2, but I could not
able to do that, so I have use the request to get the port. Which is not
totally correct.
> I think you can get the port from the HTTP "Host" header:
>
> http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
>
> So just get the message context, pull the HTTP headers and get Host.
> Will work with HTTP 1.1.
>
> Sanjiva.
>
> Srinath Perera wrote:
>> Hi Guys;
>>
>> Does that mean even though it worked for simple axis server, it does
>> not work on tomcat?
>>
>> Azeez, by any chance do you know a pointer to how to do it with
>> tomcat? e.g. like JMX approach you mentioned.
>>
>> Thanks
>> Srinath
>>
>>
>> On Thu, Dec 18, 2008 at 10:23 AM, Afkham Azeez <af...@gmail.com> wrote:
>>> Rather, the servlet API does not support getting such information, but
>>> different App servers do provide ways of getting this information.
>>> However,
>>> you'd need to write app server specific code to get this information.
>>>
>>> Azeez
>>>
>>> On Thu, Dec 18, 2008 at 8:03 PM, Deepal jayasinghe <de...@gmail.com>
>>> wrote:
>>>>> MessageContext.getCurrentMessageContext().getConfigurationContext().getAxisConfiguration().getTransportIn("http").getParameter("port")
>>>>>
>>>>>
>>>>> However, the port needs to be provided as a parameter in the
>>>>> TransportIn config in the axis2.xml file.
>>>> As thilina mentioned, in the case of tomcat you have the issues of the
>>>> port. But I do not think you need to ask for the port in
>>>> SimpleHttpServer.
>>>>
>>>> The problem of Tomcat or any other application server is, there is no
>>>> way to get the the ports that are available for a given servlet.
>>>>> HTH
>>>>> Azeez
>>>>>
>>>>> On Wed, Dec 17, 2008 at 8:51 PM, Srinath Perera <hemapani@gmail.com
>>>>> <ma...@gmail.com>> wrote:
>>>>>
>>>>>     I did not see a way to get a TransportListener from config
>>>>> contex,
>>>>>     however, in the listener manager, there is something called
>>>>> getEPR
>>>>>     forService(), which I think will do the trick. Will try it and
>>>>> let
>>>>> you
>>>>>     know.
>>>>>
>>>>>     Thanks deepal, Azeez !!!
>>>>>
>>>>>     Srinath
>>>>>
>>>>>
>>>>>     On Wed, Dec 17, 2008 at 10:09 AM, Deepal jayasinghe
>>>>>     <deepalk@gmail.com <ma...@gmail.com>> wrote:
>>>>>     > Hi Srinath,
>>>>>     >
>>>>>     > Nice to see you asking a question in the list :)
>>>>>     > You can get the reply to address as follows
>>>>>     >  - first get the configuration context
>>>>>     > - from that you can get something called TransportListener
>>>>>     > - from that you can ask for a reply to address.
>>>>>     >
>>>>>     > Thank you!
>>>>>     > Deepal
>>>>>     >> Hi All;
>>>>>     >>
>>>>>     >> Is there a way to find the current tomcat port using Axis2 (I
>>>>>     need it
>>>>>     >> to set a replyto address)? Ideally I want to find the service
>>>>>     port at
>>>>>     >> the start up, before any request arrived. If that does not
>>>>> work,
>>>>> I
>>>>>     >> might be able to live with getting it with message context.
>>>>>     Does the
>>>>>     >> message context property TRANSPORT_ADDR give what I want to
>>>>> find?
>>>>>     >>
>>>>>     >> Thanks very much
>>>>>     >> Srinath
>>>>>     >>
>>>>>     >>
>>>>>     >
>>>>>     >
>>>>>     > --
>>>>>     > Thank you!
>>>>>     >
>>>>>     >
>>>>>     > http://blogs.deepal.org
>>>>>     > http://deepal.org
>>>>>     >
>>>>>     >
>>>>>
>>>>>
>>>>>
>>>>>     --
>>>>>     ============================
>>>>>     Srinath Perera:
>>>>>       Indiana University, Bloomington
>>>>>       http://www.cs.indiana.edu/~hperera/
>>>>>     <http://www.cs.indiana.edu/%7Ehperera/>
>>>>>       http://www.bloglines.com/blog/hemapani
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> -- 
>>>>> Thanks
>>>>> Afkham Azeez
>>>>>
>>>>> Blog: http://afkham.org
>>>>> Developer Portal: http://www.wso2.org
>>>>> WSAS Blog: http://wso2wsas.blogspot.com
>>>>> Company: http://wso2.com
>>>>> GPG Fingerprint: 643F C2AF EB78 F886 40C9  B2A2 4AE2 C887 665E 0760
>>>>
>>>> -- 
>>>> Thank you!
>>>>
>>>>
>>>> http://blogs.deepal.org
>>>> http://deepal.org
>>>>
>>>
>>>
>>> -- 
>>> Thanks
>>> Afkham Azeez
>>>
>>> Blog: http://afkham.org
>>> Developer Portal: http://www.wso2.org
>>> WSAS Blog: http://wso2wsas.blogspot.com
>>> Company: http://wso2.com
>>> GPG Fingerprint: 643F C2AF EB78 F886 40C9  B2A2 4AE2 C887 665E 0760
>>>
>>
>>
>>
>
>

-- 
Thank you!


http://blogs.deepal.org
http://deepal.org


Re: [Axis2]Finding current tomcat Port from Axis2

Posted by Sanjiva Weerawarana <sa...@opensource.lk>.
I think you can get the port from the HTTP "Host" header:

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

So just get the message context, pull the HTTP headers and get Host. Will 
work with HTTP 1.1.

Sanjiva.

Srinath Perera wrote:
> Hi Guys;
> 
> Does that mean even though it worked for simple axis server, it does
> not work on tomcat?
> 
> Azeez, by any chance do you know a pointer to how to do it with
> tomcat? e.g. like JMX approach you mentioned.
> 
> Thanks
> Srinath
> 
> 
> On Thu, Dec 18, 2008 at 10:23 AM, Afkham Azeez <af...@gmail.com> wrote:
>> Rather, the servlet API does not support getting such information, but
>> different App servers do provide ways of getting this information. However,
>> you'd need to write app server specific code to get this information.
>>
>> Azeez
>>
>> On Thu, Dec 18, 2008 at 8:03 PM, Deepal jayasinghe <de...@gmail.com>
>> wrote:
>>>> MessageContext.getCurrentMessageContext().getConfigurationContext().getAxisConfiguration().getTransportIn("http").getParameter("port")
>>>>
>>>> However, the port needs to be provided as a parameter in the
>>>> TransportIn config in the axis2.xml file.
>>> As thilina mentioned, in the case of tomcat you have the issues of the
>>> port. But I do not think you need to ask for the port in SimpleHttpServer.
>>>
>>> The problem of Tomcat or any other application server is, there is no
>>> way to get the the ports that are available for a given servlet.
>>>> HTH
>>>> Azeez
>>>>
>>>> On Wed, Dec 17, 2008 at 8:51 PM, Srinath Perera <hemapani@gmail.com
>>>> <ma...@gmail.com>> wrote:
>>>>
>>>>     I did not see a way to get a TransportListener from config contex,
>>>>     however, in the listener manager, there is something called getEPR
>>>>     forService(), which I think will do the trick. Will try it and let
>>>> you
>>>>     know.
>>>>
>>>>     Thanks deepal, Azeez !!!
>>>>
>>>>     Srinath
>>>>
>>>>
>>>>     On Wed, Dec 17, 2008 at 10:09 AM, Deepal jayasinghe
>>>>     <deepalk@gmail.com <ma...@gmail.com>> wrote:
>>>>     > Hi Srinath,
>>>>     >
>>>>     > Nice to see you asking a question in the list :)
>>>>     > You can get the reply to address as follows
>>>>     >  - first get the configuration context
>>>>     > - from that you can get something called TransportListener
>>>>     > - from that you can ask for a reply to address.
>>>>     >
>>>>     > Thank you!
>>>>     > Deepal
>>>>     >> Hi All;
>>>>     >>
>>>>     >> Is there a way to find the current tomcat port using Axis2 (I
>>>>     need it
>>>>     >> to set a replyto address)? Ideally I want to find the service
>>>>     port at
>>>>     >> the start up, before any request arrived. If that does not work,
>>>> I
>>>>     >> might be able to live with getting it with message context.
>>>>     Does the
>>>>     >> message context property TRANSPORT_ADDR give what I want to find?
>>>>     >>
>>>>     >> Thanks very much
>>>>     >> Srinath
>>>>     >>
>>>>     >>
>>>>     >
>>>>     >
>>>>     > --
>>>>     > Thank you!
>>>>     >
>>>>     >
>>>>     > http://blogs.deepal.org
>>>>     > http://deepal.org
>>>>     >
>>>>     >
>>>>
>>>>
>>>>
>>>>     --
>>>>     ============================
>>>>     Srinath Perera:
>>>>       Indiana University, Bloomington
>>>>       http://www.cs.indiana.edu/~hperera/
>>>>     <http://www.cs.indiana.edu/%7Ehperera/>
>>>>       http://www.bloglines.com/blog/hemapani
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Thanks
>>>> Afkham Azeez
>>>>
>>>> Blog: http://afkham.org
>>>> Developer Portal: http://www.wso2.org
>>>> WSAS Blog: http://wso2wsas.blogspot.com
>>>> Company: http://wso2.com
>>>> GPG Fingerprint: 643F C2AF EB78 F886 40C9  B2A2 4AE2 C887 665E 0760
>>>
>>> --
>>> Thank you!
>>>
>>>
>>> http://blogs.deepal.org
>>> http://deepal.org
>>>
>>
>>
>> --
>> Thanks
>> Afkham Azeez
>>
>> Blog: http://afkham.org
>> Developer Portal: http://www.wso2.org
>> WSAS Blog: http://wso2wsas.blogspot.com
>> Company: http://wso2.com
>> GPG Fingerprint: 643F C2AF EB78 F886 40C9  B2A2 4AE2 C887 665E 0760
>>
> 
> 
> 


-- 
Sanjiva Weerawarana, Ph.D.
Founder & Director; Lanka Software Foundation; http://www.opensource.lk/
Founder, Chairman & CEO; WSO2, Inc.; http://www.wso2.com/
Member; Apache Software Foundation; http://www.apache.org/
Visiting Lecturer; University of Moratuwa; http://www.cse.mrt.ac.lk/

Blog: http://sanjiva.weerawarana.org/

Re: [Axis2]Finding current tomcat Port from Axis2

Posted by Afkham Azeez <af...@gmail.com>.
Run tomcat with JMX enabled and start jconsole. Connect to the Tomcat
process and go to the MBeans section.

https://wso2.org/repos/wso2/trunk/carbon/org.wso2.carbon.core/src/main/java/org/wso2/carbon/core/ServerManagement.javawaitForCompletion
method in WSO2 Carbon code contains some code which
queries Tomcat MBeans.

Azeez

On Thu, Dec 18, 2008 at 10:22 PM, Srinath Perera <he...@gmail.com> wrote:

> Hi Guys;
>
> Does that mean even though it worked for simple axis server, it does
> not work on tomcat?
>
> Azeez, by any chance do you know a pointer to how to do it with
> tomcat? e.g. like JMX approach you mentioned.
>
> Thanks
> Srinath
>
>
> On Thu, Dec 18, 2008 at 10:23 AM, Afkham Azeez <af...@gmail.com> wrote:
> > Rather, the servlet API does not support getting such information, but
> > different App servers do provide ways of getting this information.
> However,
> > you'd need to write app server specific code to get this information.
> >
> > Azeez
> >
> > On Thu, Dec 18, 2008 at 8:03 PM, Deepal jayasinghe <de...@gmail.com>
> > wrote:
> >>
> >> >
> >> >
> MessageContext.getCurrentMessageContext().getConfigurationContext().getAxisConfiguration().getTransportIn("http").getParameter("port")
> >> >
> >> > However, the port needs to be provided as a parameter in the
> >> > TransportIn config in the axis2.xml file.
> >> As thilina mentioned, in the case of tomcat you have the issues of the
> >> port. But I do not think you need to ask for the port in
> SimpleHttpServer.
> >>
> >> The problem of Tomcat or any other application server is, there is no
> >> way to get the the ports that are available for a given servlet.
> >> >
> >> > HTH
> >> > Azeez
> >> >
> >> > On Wed, Dec 17, 2008 at 8:51 PM, Srinath Perera <hemapani@gmail.com
> >> > <ma...@gmail.com>> wrote:
> >> >
> >> >     I did not see a way to get a TransportListener from config contex,
> >> >     however, in the listener manager, there is something called getEPR
> >> >     forService(), which I think will do the trick. Will try it and let
> >> > you
> >> >     know.
> >> >
> >> >     Thanks deepal, Azeez !!!
> >> >
> >> >     Srinath
> >> >
> >> >
> >> >     On Wed, Dec 17, 2008 at 10:09 AM, Deepal jayasinghe
> >> >     <deepalk@gmail.com <ma...@gmail.com>> wrote:
> >> >     > Hi Srinath,
> >> >     >
> >> >     > Nice to see you asking a question in the list :)
> >> >     > You can get the reply to address as follows
> >> >     >  - first get the configuration context
> >> >     > - from that you can get something called TransportListener
> >> >     > - from that you can ask for a reply to address.
> >> >     >
> >> >     > Thank you!
> >> >     > Deepal
> >> >     >> Hi All;
> >> >     >>
> >> >     >> Is there a way to find the current tomcat port using Axis2 (I
> >> >     need it
> >> >     >> to set a replyto address)? Ideally I want to find the service
> >> >     port at
> >> >     >> the start up, before any request arrived. If that does not
> work,
> >> > I
> >> >     >> might be able to live with getting it with message context.
> >> >     Does the
> >> >     >> message context property TRANSPORT_ADDR give what I want to
> find?
> >> >     >>
> >> >     >> Thanks very much
> >> >     >> Srinath
> >> >     >>
> >> >     >>
> >> >     >
> >> >     >
> >> >     > --
> >> >     > Thank you!
> >> >     >
> >> >     >
> >> >     > http://blogs.deepal.org
> >> >     > http://deepal.org
> >> >     >
> >> >     >
> >> >
> >> >
> >> >
> >> >     --
> >> >     ============================
> >> >     Srinath Perera:
> >> >       Indiana University, Bloomington
> >> >       http://www.cs.indiana.edu/~hperera/<http://www.cs.indiana.edu/%7Ehperera/>
> >> >     <http://www.cs.indiana.edu/%7Ehperera/>
> >> >       http://www.bloglines.com/blog/hemapani
> >> >
> >> >
> >> >
> >> >
> >> > --
> >> > Thanks
> >> > Afkham Azeez
> >> >
> >> > Blog: http://afkham.org
> >> > Developer Portal: http://www.wso2.org
> >> > WSAS Blog: http://wso2wsas.blogspot.com
> >> > Company: http://wso2.com
> >> > GPG Fingerprint: 643F C2AF EB78 F886 40C9  B2A2 4AE2 C887 665E 0760
> >>
> >>
> >> --
> >> Thank you!
> >>
> >>
> >> http://blogs.deepal.org
> >> http://deepal.org
> >>
> >
> >
> >
> > --
> > Thanks
> > Afkham Azeez
> >
> > Blog: http://afkham.org
> > Developer Portal: http://www.wso2.org
> > WSAS Blog: http://wso2wsas.blogspot.com
> > Company: http://wso2.com
> > GPG Fingerprint: 643F C2AF EB78 F886 40C9  B2A2 4AE2 C887 665E 0760
> >
>
>
>
> --
> ============================
> Srinath Perera:
>   Indiana University, Bloomington
>   http://www.cs.indiana.edu/~hperera/<http://www.cs.indiana.edu/%7Ehperera/>
>    http://www.bloglines.com/blog/hemapani
>



-- 
Thanks
Afkham Azeez

Blog: http://afkham.org
Developer Portal: http://www.wso2.org
WSAS Blog: http://wso2wsas.blogspot.com
Company: http://wso2.com
GPG Fingerprint: 643F C2AF EB78 F886 40C9  B2A2 4AE2 C887 665E 0760

Re: [Axis2]Finding current tomcat Port from Axis2

Posted by Srinath Perera <he...@gmail.com>.
Hi Guys;

Does that mean even though it worked for simple axis server, it does
not work on tomcat?

Azeez, by any chance do you know a pointer to how to do it with
tomcat? e.g. like JMX approach you mentioned.

Thanks
Srinath


On Thu, Dec 18, 2008 at 10:23 AM, Afkham Azeez <af...@gmail.com> wrote:
> Rather, the servlet API does not support getting such information, but
> different App servers do provide ways of getting this information. However,
> you'd need to write app server specific code to get this information.
>
> Azeez
>
> On Thu, Dec 18, 2008 at 8:03 PM, Deepal jayasinghe <de...@gmail.com>
> wrote:
>>
>> >
>> > MessageContext.getCurrentMessageContext().getConfigurationContext().getAxisConfiguration().getTransportIn("http").getParameter("port")
>> >
>> > However, the port needs to be provided as a parameter in the
>> > TransportIn config in the axis2.xml file.
>> As thilina mentioned, in the case of tomcat you have the issues of the
>> port. But I do not think you need to ask for the port in SimpleHttpServer.
>>
>> The problem of Tomcat or any other application server is, there is no
>> way to get the the ports that are available for a given servlet.
>> >
>> > HTH
>> > Azeez
>> >
>> > On Wed, Dec 17, 2008 at 8:51 PM, Srinath Perera <hemapani@gmail.com
>> > <ma...@gmail.com>> wrote:
>> >
>> >     I did not see a way to get a TransportListener from config contex,
>> >     however, in the listener manager, there is something called getEPR
>> >     forService(), which I think will do the trick. Will try it and let
>> > you
>> >     know.
>> >
>> >     Thanks deepal, Azeez !!!
>> >
>> >     Srinath
>> >
>> >
>> >     On Wed, Dec 17, 2008 at 10:09 AM, Deepal jayasinghe
>> >     <deepalk@gmail.com <ma...@gmail.com>> wrote:
>> >     > Hi Srinath,
>> >     >
>> >     > Nice to see you asking a question in the list :)
>> >     > You can get the reply to address as follows
>> >     >  - first get the configuration context
>> >     > - from that you can get something called TransportListener
>> >     > - from that you can ask for a reply to address.
>> >     >
>> >     > Thank you!
>> >     > Deepal
>> >     >> Hi All;
>> >     >>
>> >     >> Is there a way to find the current tomcat port using Axis2 (I
>> >     need it
>> >     >> to set a replyto address)? Ideally I want to find the service
>> >     port at
>> >     >> the start up, before any request arrived. If that does not work,
>> > I
>> >     >> might be able to live with getting it with message context.
>> >     Does the
>> >     >> message context property TRANSPORT_ADDR give what I want to find?
>> >     >>
>> >     >> Thanks very much
>> >     >> Srinath
>> >     >>
>> >     >>
>> >     >
>> >     >
>> >     > --
>> >     > Thank you!
>> >     >
>> >     >
>> >     > http://blogs.deepal.org
>> >     > http://deepal.org
>> >     >
>> >     >
>> >
>> >
>> >
>> >     --
>> >     ============================
>> >     Srinath Perera:
>> >       Indiana University, Bloomington
>> >       http://www.cs.indiana.edu/~hperera/
>> >     <http://www.cs.indiana.edu/%7Ehperera/>
>> >       http://www.bloglines.com/blog/hemapani
>> >
>> >
>> >
>> >
>> > --
>> > Thanks
>> > Afkham Azeez
>> >
>> > Blog: http://afkham.org
>> > Developer Portal: http://www.wso2.org
>> > WSAS Blog: http://wso2wsas.blogspot.com
>> > Company: http://wso2.com
>> > GPG Fingerprint: 643F C2AF EB78 F886 40C9  B2A2 4AE2 C887 665E 0760
>>
>>
>> --
>> Thank you!
>>
>>
>> http://blogs.deepal.org
>> http://deepal.org
>>
>
>
>
> --
> Thanks
> Afkham Azeez
>
> Blog: http://afkham.org
> Developer Portal: http://www.wso2.org
> WSAS Blog: http://wso2wsas.blogspot.com
> Company: http://wso2.com
> GPG Fingerprint: 643F C2AF EB78 F886 40C9  B2A2 4AE2 C887 665E 0760
>



-- 
============================
Srinath Perera:
   Indiana University, Bloomington
   http://www.cs.indiana.edu/~hperera/
   http://www.bloglines.com/blog/hemapani

Re: [Axis2]Finding current tomcat Port from Axis2

Posted by Afkham Azeez <af...@gmail.com>.
Rather, the servlet API does not support getting such information, but
different App servers do provide ways of getting this information. However,
you'd need to write app server specific code to get this information.

Azeez

On Thu, Dec 18, 2008 at 8:03 PM, Deepal jayasinghe <de...@gmail.com>wrote:

>
> >
> MessageContext.getCurrentMessageContext().getConfigurationContext().getAxisConfiguration().getTransportIn("http").getParameter("port")
> >
> > However, the port needs to be provided as a parameter in the
> > TransportIn config in the axis2.xml file.
> As thilina mentioned, in the case of tomcat you have the issues of the
> port. But I do not think you need to ask for the port in SimpleHttpServer.
>
> The problem of Tomcat or any other application server is, there is no
> way to get the the ports that are available for a given servlet.
> >
> > HTH
> > Azeez
> >
> > On Wed, Dec 17, 2008 at 8:51 PM, Srinath Perera <hemapani@gmail.com
> > <ma...@gmail.com>> wrote:
> >
> >     I did not see a way to get a TransportListener from config contex,
> >     however, in the listener manager, there is something called getEPR
> >     forService(), which I think will do the trick. Will try it and let
> you
> >     know.
> >
> >     Thanks deepal, Azeez !!!
> >
> >     Srinath
> >
> >
> >     On Wed, Dec 17, 2008 at 10:09 AM, Deepal jayasinghe
> >     <deepalk@gmail.com <ma...@gmail.com>> wrote:
> >     > Hi Srinath,
> >     >
> >     > Nice to see you asking a question in the list :)
> >     > You can get the reply to address as follows
> >     >  - first get the configuration context
> >     > - from that you can get something called TransportListener
> >     > - from that you can ask for a reply to address.
> >     >
> >     > Thank you!
> >     > Deepal
> >     >> Hi All;
> >     >>
> >     >> Is there a way to find the current tomcat port using Axis2 (I
> >     need it
> >     >> to set a replyto address)? Ideally I want to find the service
> >     port at
> >     >> the start up, before any request arrived. If that does not work, I
> >     >> might be able to live with getting it with message context.
> >     Does the
> >     >> message context property TRANSPORT_ADDR give what I want to find?
> >     >>
> >     >> Thanks very much
> >     >> Srinath
> >     >>
> >     >>
> >     >
> >     >
> >     > --
> >     > Thank you!
> >     >
> >     >
> >     > http://blogs.deepal.org
> >     > http://deepal.org
> >     >
> >     >
> >
> >
> >
> >     --
> >     ============================
> >     Srinath Perera:
> >       Indiana University, Bloomington
> >       http://www.cs.indiana.edu/~hperera/<http://www.cs.indiana.edu/%7Ehperera/>
> >     <http://www.cs.indiana.edu/%7Ehperera/>
> >       http://www.bloglines.com/blog/hemapani
> >
> >
> >
> >
> > --
> > Thanks
> > Afkham Azeez
> >
> > Blog: http://afkham.org
> > Developer Portal: http://www.wso2.org
> > WSAS Blog: http://wso2wsas.blogspot.com
> > Company: http://wso2.com
> > GPG Fingerprint: 643F C2AF EB78 F886 40C9  B2A2 4AE2 C887 665E 0760
>
>
> --
> Thank you!
>
>
> http://blogs.deepal.org
> http://deepal.org
>
>


-- 
Thanks
Afkham Azeez

Blog: http://afkham.org
Developer Portal: http://www.wso2.org
WSAS Blog: http://wso2wsas.blogspot.com
Company: http://wso2.com
GPG Fingerprint: 643F C2AF EB78 F886 40C9  B2A2 4AE2 C887 665E 0760

Re: [Axis2]Finding current tomcat Port from Axis2

Posted by Deepal jayasinghe <de...@gmail.com>.
> MessageContext.getCurrentMessageContext().getConfigurationContext().getAxisConfiguration().getTransportIn("http").getParameter("port")
>
> However, the port needs to be provided as a parameter in the
> TransportIn config in the axis2.xml file.
As thilina mentioned, in the case of tomcat you have the issues of the
port. But I do not think you need to ask for the port in SimpleHttpServer.

The problem of Tomcat or any other application server is, there is no
way to get the the ports that are available for a given servlet.
>
> HTH
> Azeez
>
> On Wed, Dec 17, 2008 at 8:51 PM, Srinath Perera <hemapani@gmail.com
> <ma...@gmail.com>> wrote:
>
>     I did not see a way to get a TransportListener from config contex,
>     however, in the listener manager, there is something called getEPR
>     forService(), which I think will do the trick. Will try it and let you
>     know.
>
>     Thanks deepal, Azeez !!!
>
>     Srinath
>
>
>     On Wed, Dec 17, 2008 at 10:09 AM, Deepal jayasinghe
>     <deepalk@gmail.com <ma...@gmail.com>> wrote:
>     > Hi Srinath,
>     >
>     > Nice to see you asking a question in the list :)
>     > You can get the reply to address as follows
>     >  - first get the configuration context
>     > - from that you can get something called TransportListener
>     > - from that you can ask for a reply to address.
>     >
>     > Thank you!
>     > Deepal
>     >> Hi All;
>     >>
>     >> Is there a way to find the current tomcat port using Axis2 (I
>     need it
>     >> to set a replyto address)? Ideally I want to find the service
>     port at
>     >> the start up, before any request arrived. If that does not work, I
>     >> might be able to live with getting it with message context.
>     Does the
>     >> message context property TRANSPORT_ADDR give what I want to find?
>     >>
>     >> Thanks very much
>     >> Srinath
>     >>
>     >>
>     >
>     >
>     > --
>     > Thank you!
>     >
>     >
>     > http://blogs.deepal.org
>     > http://deepal.org
>     >
>     >
>
>
>
>     --
>     ============================
>     Srinath Perera:
>       Indiana University, Bloomington
>       http://www.cs.indiana.edu/~hperera/
>     <http://www.cs.indiana.edu/%7Ehperera/>
>       http://www.bloglines.com/blog/hemapani
>
>
>
>
> -- 
> Thanks
> Afkham Azeez
>
> Blog: http://afkham.org
> Developer Portal: http://www.wso2.org
> WSAS Blog: http://wso2wsas.blogspot.com
> Company: http://wso2.com
> GPG Fingerprint: 643F C2AF EB78 F886 40C9  B2A2 4AE2 C887 665E 0760


-- 
Thank you!


http://blogs.deepal.org
http://deepal.org


Re: [Axis2]Finding current tomcat Port from Axis2

Posted by Afkham Azeez <af...@gmail.com>.
MessageContext.getCurrentMessageContext().getConfigurationContext().getAxisConfiguration().getTransportIn("http").getParameter("port")

However, the port needs to be provided as a parameter in the TransportIn
config in the axis2.xml file.

HTH
Azeez

On Wed, Dec 17, 2008 at 8:51 PM, Srinath Perera <he...@gmail.com> wrote:

> I did not see a way to get a TransportListener from config contex,
> however, in the listener manager, there is something called getEPR
> forService(), which I think will do the trick. Will try it and let you
> know.
>
> Thanks deepal, Azeez !!!
>
> Srinath
>
>
> On Wed, Dec 17, 2008 at 10:09 AM, Deepal jayasinghe <de...@gmail.com>
> wrote:
> > Hi Srinath,
> >
> > Nice to see you asking a question in the list :)
> > You can get the reply to address as follows
> >  - first get the configuration context
> > - from that you can get something called TransportListener
> > - from that you can ask for a reply to address.
> >
> > Thank you!
> > Deepal
> >> Hi All;
> >>
> >> Is there a way to find the current tomcat port using Axis2 (I need it
> >> to set a replyto address)? Ideally I want to find the service port at
> >> the start up, before any request arrived. If that does not work, I
> >> might be able to live with getting it with message context. Does the
> >> message context property TRANSPORT_ADDR give what I want to find?
> >>
> >> Thanks very much
> >> Srinath
> >>
> >>
> >
> >
> > --
> > Thank you!
> >
> >
> > http://blogs.deepal.org
> > http://deepal.org
> >
> >
>
>
>
> --
> ============================
> Srinath Perera:
>   Indiana University, Bloomington
>   http://www.cs.indiana.edu/~hperera/<http://www.cs.indiana.edu/%7Ehperera/>
>   http://www.bloglines.com/blog/hemapani
>



-- 
Thanks
Afkham Azeez

Blog: http://afkham.org
Developer Portal: http://www.wso2.org
WSAS Blog: http://wso2wsas.blogspot.com
Company: http://wso2.com
GPG Fingerprint: 643F C2AF EB78 F886 40C9  B2A2 4AE2 C887 665E 0760

Re: [Axis2]Finding current tomcat Port from Axis2

Posted by Srinath Perera <he...@gmail.com>.
Hi All;

It worked for me with 5555, but with simple axis server. I will later
chack with tomcat and let you know.

Thanks
Srinath

On Wed, Dec 17, 2008 at 11:15 PM, Thilina Gunarathne <cs...@gmail.com> wrote:
> Hi Srinath,
> Recently I tried doing this and ended up getting 8080 even if the port is
> changed, which forced me to switch back to passing the port number as a JVM
> property. Please make sure you test this with a  port other than 8080....
> Also let me know if it's working now :)...
>
> thanks,
> Thilina
>
> On Wed, Dec 17, 2008 at 10:21 AM, Srinath Perera <he...@gmail.com> wrote:
>>
>> I did not see a way to get a TransportListener from config contex,
>> however, in the listener manager, there is something called getEPR
>> forService(), which I think will do the trick. Will try it and let you
>> know.
>>
>> Thanks deepal, Azeez !!!
>>
>> Srinath
>>
>>
>> On Wed, Dec 17, 2008 at 10:09 AM, Deepal jayasinghe <de...@gmail.com>
>> wrote:
>> > Hi Srinath,
>> >
>> > Nice to see you asking a question in the list :)
>> > You can get the reply to address as follows
>> >  - first get the configuration context
>> > - from that you can get something called TransportListener
>> > - from that you can ask for a reply to address.
>> >
>> > Thank you!
>> > Deepal
>> >> Hi All;
>> >>
>> >> Is there a way to find the current tomcat port using Axis2 (I need it
>> >> to set a replyto address)? Ideally I want to find the service port at
>> >> the start up, before any request arrived. If that does not work, I
>> >> might be able to live with getting it with message context. Does the
>> >> message context property TRANSPORT_ADDR give what I want to find?
>> >>
>> >> Thanks very much
>> >> Srinath
>> >>
>> >>
>> >
>> >
>> > --
>> > Thank you!
>> >
>> >
>> > http://blogs.deepal.org
>> > http://deepal.org
>> >
>> >
>>
>>
>>
>> --
>> ============================
>> Srinath Perera:
>>   Indiana University, Bloomington
>>   http://www.cs.indiana.edu/~hperera/
>>   http://www.bloglines.com/blog/hemapani
>
>
>
> --
> Thilina Gunarathne  - http://thilinag.blogspot.com
>



-- 
============================
Srinath Perera:
   Indiana University, Bloomington
   http://www.cs.indiana.edu/~hperera/
   http://www.bloglines.com/blog/hemapani

Re: [Axis2]Finding current tomcat Port from Axis2

Posted by Thilina Gunarathne <cs...@gmail.com>.
Hi Srinath,
Recently I tried doing this and ended up getting 8080 even if the port is
changed, which forced me to switch back to passing the port number as a JVM
property. Please make sure you test this with a  port other than 8080....
Also let me know if it's working now :)...

thanks,
Thilina

On Wed, Dec 17, 2008 at 10:21 AM, Srinath Perera <he...@gmail.com> wrote:

> I did not see a way to get a TransportListener from config contex,
> however, in the listener manager, there is something called getEPR
> forService(), which I think will do the trick. Will try it and let you
> know.
>
> Thanks deepal, Azeez !!!
>
> Srinath
>
>
> On Wed, Dec 17, 2008 at 10:09 AM, Deepal jayasinghe <de...@gmail.com>
> wrote:
> > Hi Srinath,
> >
> > Nice to see you asking a question in the list :)
> > You can get the reply to address as follows
> >  - first get the configuration context
> > - from that you can get something called TransportListener
> > - from that you can ask for a reply to address.
> >
> > Thank you!
> > Deepal
> >> Hi All;
> >>
> >> Is there a way to find the current tomcat port using Axis2 (I need it
> >> to set a replyto address)? Ideally I want to find the service port at
> >> the start up, before any request arrived. If that does not work, I
> >> might be able to live with getting it with message context. Does the
> >> message context property TRANSPORT_ADDR give what I want to find?
> >>
> >> Thanks very much
> >> Srinath
> >>
> >>
> >
> >
> > --
> > Thank you!
> >
> >
> > http://blogs.deepal.org
> > http://deepal.org
> >
> >
>
>
>
> --
> ============================
> Srinath Perera:
>   Indiana University, Bloomington
>   http://www.cs.indiana.edu/~hperera/<http://www.cs.indiana.edu/%7Ehperera/>
>   http://www.bloglines.com/blog/hemapani
>



-- 
Thilina Gunarathne  - http://thilinag.blogspot.com

Re: [Axis2]Finding current tomcat Port from Axis2

Posted by Srinath Perera <he...@gmail.com>.
I did not see a way to get a TransportListener from config contex,
however, in the listener manager, there is something called getEPR
forService(), which I think will do the trick. Will try it and let you
know.

Thanks deepal, Azeez !!!

Srinath


On Wed, Dec 17, 2008 at 10:09 AM, Deepal jayasinghe <de...@gmail.com> wrote:
> Hi Srinath,
>
> Nice to see you asking a question in the list :)
> You can get the reply to address as follows
>  - first get the configuration context
> - from that you can get something called TransportListener
> - from that you can ask for a reply to address.
>
> Thank you!
> Deepal
>> Hi All;
>>
>> Is there a way to find the current tomcat port using Axis2 (I need it
>> to set a replyto address)? Ideally I want to find the service port at
>> the start up, before any request arrived. If that does not work, I
>> might be able to live with getting it with message context. Does the
>> message context property TRANSPORT_ADDR give what I want to find?
>>
>> Thanks very much
>> Srinath
>>
>>
>
>
> --
> Thank you!
>
>
> http://blogs.deepal.org
> http://deepal.org
>
>



-- 
============================
Srinath Perera:
   Indiana University, Bloomington
   http://www.cs.indiana.edu/~hperera/
   http://www.bloglines.com/blog/hemapani

Re: [Axis2]Finding current tomcat Port from Axis2

Posted by Deepal jayasinghe <de...@gmail.com>.
Hi Srinath,

Nice to see you asking a question in the list :)
You can get the reply to address as follows
 - first get the configuration context
- from that you can get something called TransportListener
- from that you can ask for a reply to address.

Thank you!
Deepal
> Hi All;
>
> Is there a way to find the current tomcat port using Axis2 (I need it
> to set a replyto address)? Ideally I want to find the service port at
> the start up, before any request arrived. If that does not work, I
> might be able to live with getting it with message context. Does the
> message context property TRANSPORT_ADDR give what I want to find?
>
> Thanks very much
> Srinath
>
>   


-- 
Thank you!


http://blogs.deepal.org
http://deepal.org


Re: [Axis2]Finding current tomcat Port from Axis2

Posted by Afkham Azeez <af...@gmail.com>.
The servlet API does not support getting the port before any requests have
arrived AFAIK. Also, you cannot write Tomcat specific code to get the ports
since Axis2 has to run on multiple App servers. However, if you can live
with writing custom Tomcat code, there is a Tomcat MBean that will give you
this information.



HTH
Azeez

On Wed, Dec 17, 2008 at 6:35 PM, Srinath Perera <he...@gmail.com> wrote:

> Hi All;
>
> Is there a way to find the current tomcat port using Axis2 (I need it
> to set a replyto address)? Ideally I want to find the service port at
> the start up, before any request arrived. If that does not work, I
> might be able to live with getting it with message context. Does the
> message context property TRANSPORT_ADDR give what I want to find?
>
> Thanks very much
> Srinath
>
> --
> ============================
> Srinath Perera:
>   Indiana University, Bloomington
>   http://www.cs.indiana.edu/~hperera/<http://www.cs.indiana.edu/%7Ehperera/>
>   http://www.bloglines.com/blog/hemapani
>



-- 
Thanks
Afkham Azeez

Blog: http://afkham.org
Developer Portal: http://www.wso2.org
WSAS Blog: http://wso2wsas.blogspot.com
Company: http://wso2.com
GPG Fingerprint: 643F C2AF EB78 F886 40C9  B2A2 4AE2 C887 665E 0760