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


-- 
M.Sc. Thomas Driessen
Software Methodologies for Distributed Systems
Institute of Computer Science
University of Augsburg
Universitätsstr. 6a
86135 Augsburg, Germany

Tel:    +49 821 598-2486
email: [email protected]

Reply via email to