You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Nick Baker <nb...@pentaho.com> on 2014/11/17 16:34:48 UTC

Best way to determine HttpService URL

Hey All,

I've got a mixed environment where a Bundle can be deployed in an environment using the standard PAX-Web HttpService as well as one bridging out to Tomcat by way of Felix-HTTP Bridge. I need to be able to programmatically determine the URL for the HttpService regardless of where a bundle is deployed. There doesn't seem to be any way of determining this using the standard OSGI APIs.

Karaf is embedded within both environments. The PAX-Web setup will dynamically find an open port on startup and set the appropriate Configuration Admin entries before starting Karaf. The Tomcat environment does not need to do this work.

Any ideas appreciated,
-Nick

Re: Best way to determine HttpService URL

Posted by Achim Nierbeck <bc...@googlemail.com>.
To be honest I don't understand why you would like to run a container in a
container.
Just use plane karaf and you would be fine.

And that's probably the reason you don't find a good answer for that. Make
sure you control the http servicer port from the outside by setting some
env variable that goes to the config admin service.

But that's it.

Sorry, Achim

sent from mobile device
Am 17.11.2014 19:16 schrieb "Achim Nierbeck" <bc...@googlemail.com>:

> Unfortunately we can't process this kind of question right now.
>
> 400
>
> Live from apachecon
>
> Greetings
> Am 17.11.2014 16:35 schrieb "Nick Baker" <nb...@pentaho.com>:
>
>>  Hey All,
>>
>>  I’ve got a mixed environment where a Bundle can be deployed in an
>> environment using the standard PAX-Web HttpService as well as one bridging
>> out to Tomcat by way of Felix-HTTP Bridge. I need to be able to
>> programmatically determine the URL for the HttpService regardless of where
>> a bundle is deployed. There doesn’t seem to be any way of determining this
>> using the standard OSGI APIs.
>>
>>  Karaf is embedded within both environments. The PAX-Web setup will
>> dynamically find an open port on startup and set the appropriate
>> Configuration Admin entries before starting Karaf. The Tomcat environment
>> does not need to do this work.
>>
>>  Any ideas appreciated,
>> -Nick
>>
>

Re: Best way to determine HttpService URL

Posted by Achim Nierbeck <bc...@googlemail.com>.
Unfortunately we can't process this kind of question right now.

400

Live from apachecon

Greetings
Am 17.11.2014 16:35 schrieb "Nick Baker" <nb...@pentaho.com>:

>  Hey All,
>
>  I’ve got a mixed environment where a Bundle can be deployed in an
> environment using the standard PAX-Web HttpService as well as one bridging
> out to Tomcat by way of Felix-HTTP Bridge. I need to be able to
> programmatically determine the URL for the HttpService regardless of where
> a bundle is deployed. There doesn’t seem to be any way of determining this
> using the standard OSGI APIs.
>
>  Karaf is embedded within both environments. The PAX-Web setup will
> dynamically find an open port on startup and set the appropriate
> Configuration Admin entries before starting Karaf. The Tomcat environment
> does not need to do this work.
>
>  Any ideas appreciated,
> -Nick
>

Re: Best way to determine HttpService URL

Posted by Nick Baker <nb...@pentaho.com>.
Thanks Achim. This was pretty much my conclusion as well.

-Nick

From: Achim Nierbeck <bc...@googlemail.com>>
Reply-To: "user@karaf.apache.org<ma...@karaf.apache.org>" <us...@karaf.apache.org>>
Date: Tuesday, November 18, 2014 at 9:01 AM
To: "user@karaf.apache.org<ma...@karaf.apache.org>" <us...@karaf.apache.org>>
Subject: Re: Best way to determine HttpService URL

Hi Nick,

I feared an answer like that was about to come ...
... still there is not auto-magic way of knowing ports from the inside of the container. Most likely you will
have to do something yourself.
Maybe you could have an Rest Servlet running inside your Pax Web container, that will pick up messages for configuring ports.
As the default will be the one you initially set or 8181.
>From there on the servlet will need to take the new parameters and set these parameters through the configuration admin service, which again will fire up the Pax Web Jetty instance with the new parameters configured.
That's most likely the only way to control this from the outside.

regards, Achim

2014-11-17 23:00 GMT+01:00 Nick Baker <nb...@pentaho.com>>:
Achim:
We¹re in a transitional phase right now. OSGI is replacing 4 different
home-grown plugin systems to become the modular framework for future
development. In time we will have everything within the OSGI container,
but that time is not now.

JB:
We do use Pax-Web in our Thick Client applications (Swing, SWT). There
embedded browser components within those applications display web content
served from the OSGI container. This is the primary reason why I need to
know the URL of the Http Service.

Our Server offering runs in any J2EE application server. We maintain an
embedded Karaf instance there with the HttpService bridged out to the
outside Servlet Container (primarily Tomcat). I know some people proxy out
to PAX-Web, but this won¹t work for us.

-Nick


On 11/17/14, 1:35 PM, "Jean-Baptiste Onofré" <jb...@nanthrax.net>> wrote:

>Hi Nick,
>
>why not just using Pax Web ?
>
>Pax Web register the servlet as service, so you can do a simple lookup.
>
>Regards
>JB
>
>On 11/17/2014 04:34 PM, Nick Baker wrote:
>> Hey All,
>>
>> I¹ve got a mixed environment where a Bundle can be deployed in an
>> environment using the standard PAX-Web HttpService as well as one
>> bridging out to Tomcat by way of Felix-HTTP Bridge. I need to be able to
>> programmatically determine the URL for the HttpService regardless of
>> where a bundle is deployed. There doesn¹t seem to be any way of
>> determining this using the standard OSGI APIs.
>>
>> Karaf is embedded within both environments. The PAX-Web setup will
>> dynamically find an open port on startup and set the appropriate
>> Configuration Admin entries before starting Karaf. The Tomcat
>> environment does not need to do this work.
>>
>> Any ideas appreciated,
>> -Nick
>
>--
>Jean-Baptiste Onofré
>jbonofre@apache.org<ma...@apache.org>
>http://blog.nanthrax.net
>Talend - http://www.talend.com




--

Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer & Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master


Re: Best way to determine HttpService URL

Posted by Achim Nierbeck <bc...@googlemail.com>.
Hi Nick,

I feared an answer like that was about to come ...
... still there is not auto-magic way of knowing ports from the inside of
the container. Most likely you will
have to do something yourself.
Maybe you could have an Rest Servlet running inside your Pax Web container,
that will pick up messages for configuring ports.
As the default will be the one you initially set or 8181.
>From there on the servlet will need to take the new parameters and set
these parameters through the configuration admin service, which again will
fire up the Pax Web Jetty instance with the new parameters configured.
That's most likely the only way to control this from the outside.

regards, Achim

2014-11-17 23:00 GMT+01:00 Nick Baker <nb...@pentaho.com>:

> Achim:
> We¹re in a transitional phase right now. OSGI is replacing 4 different
> home-grown plugin systems to become the modular framework for future
> development. In time we will have everything within the OSGI container,
> but that time is not now.
>
> JB:
> We do use Pax-Web in our Thick Client applications (Swing, SWT). There
> embedded browser components within those applications display web content
> served from the OSGI container. This is the primary reason why I need to
> know the URL of the Http Service.
>
> Our Server offering runs in any J2EE application server. We maintain an
> embedded Karaf instance there with the HttpService bridged out to the
> outside Servlet Container (primarily Tomcat). I know some people proxy out
> to PAX-Web, but this won¹t work for us.
>
> -Nick
>
>
> On 11/17/14, 1:35 PM, "Jean-Baptiste Onofré" <jb...@nanthrax.net> wrote:
>
> >Hi Nick,
> >
> >why not just using Pax Web ?
> >
> >Pax Web register the servlet as service, so you can do a simple lookup.
> >
> >Regards
> >JB
> >
> >On 11/17/2014 04:34 PM, Nick Baker wrote:
> >> Hey All,
> >>
> >> I¹ve got a mixed environment where a Bundle can be deployed in an
> >> environment using the standard PAX-Web HttpService as well as one
> >> bridging out to Tomcat by way of Felix-HTTP Bridge. I need to be able to
> >> programmatically determine the URL for the HttpService regardless of
> >> where a bundle is deployed. There doesn¹t seem to be any way of
> >> determining this using the standard OSGI APIs.
> >>
> >> Karaf is embedded within both environments. The PAX-Web setup will
> >> dynamically find an open port on startup and set the appropriate
> >> Configuration Admin entries before starting Karaf. The Tomcat
> >> environment does not need to do this work.
> >>
> >> Any ideas appreciated,
> >> -Nick
> >
> >--
> >Jean-Baptiste Onofré
> >jbonofre@apache.org
> >http://blog.nanthrax.net
> >Talend - http://www.talend.com
>
>


-- 

Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master

Re: Best way to determine HttpService URL

Posted by Nick Baker <nb...@pentaho.com>.
Achim: 
We¹re in a transitional phase right now. OSGI is replacing 4 different
home-grown plugin systems to become the modular framework for future
development. In time we will have everything within the OSGI container,
but that time is not now.

JB:
We do use Pax-Web in our Thick Client applications (Swing, SWT). There
embedded browser components within those applications display web content
served from the OSGI container. This is the primary reason why I need to
know the URL of the Http Service.

Our Server offering runs in any J2EE application server. We maintain an
embedded Karaf instance there with the HttpService bridged out to the
outside Servlet Container (primarily Tomcat). I know some people proxy out
to PAX-Web, but this won¹t work for us.

-Nick


On 11/17/14, 1:35 PM, "Jean-Baptiste Onofré" <jb...@nanthrax.net> wrote:

>Hi Nick,
>
>why not just using Pax Web ?
>
>Pax Web register the servlet as service, so you can do a simple lookup.
>
>Regards
>JB
>
>On 11/17/2014 04:34 PM, Nick Baker wrote:
>> Hey All,
>>
>> I¹ve got a mixed environment where a Bundle can be deployed in an
>> environment using the standard PAX-Web HttpService as well as one
>> bridging out to Tomcat by way of Felix-HTTP Bridge. I need to be able to
>> programmatically determine the URL for the HttpService regardless of
>> where a bundle is deployed. There doesn¹t seem to be any way of
>> determining this using the standard OSGI APIs.
>>
>> Karaf is embedded within both environments. The PAX-Web setup will
>> dynamically find an open port on startup and set the appropriate
>> Configuration Admin entries before starting Karaf. The Tomcat
>> environment does not need to do this work.
>>
>> Any ideas appreciated,
>> -Nick
>
>-- 
>Jean-Baptiste Onofré
>jbonofre@apache.org
>http://blog.nanthrax.net
>Talend - http://www.talend.com


Re: Best way to determine HttpService URL

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Nick,

why not just using Pax Web ?

Pax Web register the servlet as service, so you can do a simple lookup.

Regards
JB

On 11/17/2014 04:34 PM, Nick Baker wrote:
> Hey All,
>
> I’ve got a mixed environment where a Bundle can be deployed in an
> environment using the standard PAX-Web HttpService as well as one
> bridging out to Tomcat by way of Felix-HTTP Bridge. I need to be able to
> programmatically determine the URL for the HttpService regardless of
> where a bundle is deployed. There doesn’t seem to be any way of
> determining this using the standard OSGI APIs.
>
> Karaf is embedded within both environments. The PAX-Web setup will
> dynamically find an open port on startup and set the appropriate
> Configuration Admin entries before starting Karaf. The Tomcat
> environment does not need to do this work.
>
> Any ideas appreciated,
> -Nick

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com