felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carsten Ziegeler <cziege...@apache.org>
Subject Re: ServletContextListener
Date Mon, 11 May 2015 15:53:24 GMT
Hi Thomas,

the http/whiteboard project is the "old" proprietary whiteboard support
from Apache Felix. The new RFC-189 based stuff requires you to compile
the api, base and jetty projects and use the api and jetty bundle at
runtime.

Carsten

Am 11.05.15 um 17:16 schrieb Thomas Driessen:
> Hi Carsten,
> 
> thanks for the quick response.
> 
> What I've done so far:
> I followed your advice and cloned the felix trunk from this location [1]. I
> then compiled the subproject http/whiteboard via "mvn clean install" and
> added the created jar (org.apache.felix.http.whiteboard.3_0_0_SNAPSHOT.jar)
> to my bnd local repository. I've added the jar to my runrequirements for
> the project I'm currently building and everything was resolved without
> errors.
> I've written a ServletContextListener, which just does some console outputs
> on initialization and destruction. Now i wanted to test this Listener and
> registered it as a Service via the @Component Annotation. (Per default it
> should be registered under the ServletContextListener interface, as I'm
> implementing it).
> 
> My Problem:
> As described in section 5.2.7.2 of the RFC-189, I would have expected to
> see some print outs when starting my project (contains jetty and registers
> some Rest Resources) as the method contextInitialized should be called, but
> nothing happens.
> Am I missing something here? Do I have to add some special properties to
> the service which I maybe overread in the specification?
> 
> Any advice is appreciated :)
> 
> Best regards,
> Thomas
> 
> 
> [1]https://github.com/apache/felix
> 
> 2015-05-09 14:17 GMT+02:00 Carsten Ziegeler <cziegeler@apache.org>:
> 
>> Hi Thomas,
>>
>> felix trunk contains the new http implementation which implements the
>> new OSGi Http Whiteboard Service implementation. And that one supports
>> the ServletContextListener. I suggest you read up the RFC 189 for that
>> specification; a draft spec from the OSGi alliance will hopefully be
>> available soon.
>>
>> Regards
>> Carsten
>>
>> Am 08.05.15 um 15:29 schrieb Thomas Driessen:
>>> Hi!
>>>
>>> I'm currently trying to integrate Apache Shiro into my OSGi
>>> (Web-)Application which is built upon Apache Felix.
>>> According to the Shiro Setup Tutorial for normal Web Applications I have
>> to
>>> add the following lines in my web.xml:
>>>
>>> <listener>
>>>
>>  <listener-class>org.apache.shiro.web.env.EnvironmentLoaderListener</listener-class></listener>
>>> <filter>
>>>     <filter-name>ShiroFilter</filter-name>
>>>
>>  <filter-class>org.apache.shiro.web.servlet.ShiroFilter</filter-class></filter>
>>>
>>> and some entries for the filter-mapping.
>>>
>>> As I'm working with felix.http and felix.whiteboard I thought, I could
>>> achieve the same result by registering the EnvironmentLoaderListener
>> under
>>> the ServletContextListener Interface and the ShiroFilter under the Filter
>>> Interface via an Activator, like this:
>>>
>>> public class DMActivator extends DependencyActivatorBase {
>>>
>>> @Override
>>> public void destroy(BundleContext arg0, DependencyManager dm) throws
>>> Exception {}
>>>
>>> @Override
>>> public void init(BundleContext arg0, DependencyManager dm) throws
>> Exception
>>> {
>>> dm.add(createComponent()
>>> .setImplementation(EnvironmentLoaderListener.class)
>>> .setInterface(ServletContextListener.class.getName(), null));
>>> dm.add(createComponent()
>>> .setImplementation(ShiroFilter.class)
>>> .setInterface(Filter.class.getName(), null));
>>> }
>>> }
>>>
>>> Unfortunately, the documentation of felix states, that
>>> ServletContextListener are not supported (but should be in the near
>> future)
>>> by felix. Is there any other way I can add shiro to my webapp, that I'm
>> not
>>> aware of? Is the documentation up-to-date or is the
>> ServletContextListener
>>> maybe already added?
>>>
>>> Any advice is appreciated :)
>>>
>>> Thanks in advance for your help.
>>>
>>> Best regards,
>>> Thomas
>>>
>>>
>>
>>
>> --
>> Carsten Ziegeler
>> Adobe Research Switzerland
>> cziegeler@apache.org
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
> 
> 


-- 
Carsten Ziegeler
Adobe Research Switzerland
cziegeler@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Mime
View raw message