felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anders Engström <epirea...@gmail.com>
Subject Setting up Http Servlet Bridge (relative paths)
Date Thu, 04 Feb 2016 14:34:40 GMT
Hi -

I’m trying to set up the Felix Servlet Bridge in Tomcat (8) as a proxy to a bunch of services
running in an embedded OSGi container. 

I’ve registered the `org.apache.felix.http.proxy.impl.ProxyServletContextListener` in web.xml
and I’ve got a servlet setup that uses the `org.apache.felix.http.proxy.DispatcherTracker`
to dispatch request to the bridge (which is installed in the OSGi container).

The reason I’m using a custom servlet is because our OSGi container isn’t started until
after the web-application have started (and the org.apache.felix.http.proxy.ProxyServlet requires
that the BundleContext is defined on servlet initiation).

Everything seems to work, if I register servlets (in the OSGi container) to the path `/bundles/{servlet}`.
That is — the OSGi component registering the Servlet *needs* to know to which context path
the proxy servlet is mapped.

Is this by design, or did I miss some configuration setting or did I do something wrong in
my setup?

The behaviour I was expecting was that when registering the servlet like this:

`httpService.registerServlet(“/demo”, theServlet, null, null);`

a call, through Tomcat, to `http://host:port/context/bundles/demo` <http://host:port/context/bundles/demo%60>
would be dispatched to the `theServlet`.

If the component registering the Servlet needs to know the servlet-path of the proxy-servlet
it’s really hard to make the servlet portable across different HttpService implementations

Best regards //Anders
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message