felix-users mailing list archives

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

that’s interesting.. code you provide a pointer to some sample code?

/Anders

> On 04 Feb 2016, at 16:45, Carsten Ziegeler <cziegeler@apache.org> wrote:
> 
> Hi,
> 
> I dont know the details, but we use the bridge in Apache Sling and in
> some other projects. And if we register a servlet at /demo it's not
> directly reachable at /demo, but /context/{servlet}/demo
> 
> Carsten
> 
> Anders Engström wrote
>> 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`>
<http://host:port/context/bundles/demo%60 <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
>> 
> 
> 
> 
> -- 
> Carsten Ziegeler
> Adobe Research Switzerland
> cziegeler@apache.org <mailto:cziegeler@apache.org>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org <mailto:users-unsubscribe@felix.apache.org>
> For additional commands, e-mail: users-help@felix.apache.org <mailto:users-help@felix.apache.org>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message