Hi,
Unfortunately, I think we can't just use the Shiro Core because our
application is a hybrid one, based on Vaadin web framework. One classic
example could be seen here [1].
Besides the fact we are stucked in some old servlet api version, we can
have such dynamicity that a bundle-web based application provided by
OSGi Web Servers as Glassfish, Jetty or any other can provide. Plus we
can have all good stuff provided by OSGi as : auto-update provided by
p2, remote admin, remote services and so on.
Next week I will investigate better the alternatives that you suggested.
Another alternative that was sent to me was to create one bridge-servlet
to register the shiro listener in the name of our application...
thanks for your time,
Cristiano
[1] - http://www.toedter.com/blog/?p=412
On 19/01/12 18:26, [email protected] wrote:
Here's one approach:
1) Build a WebEnvironment
(http://shiro.apache.org/static/1.2.0/apidocs/org/apache/shiro/web/env/WebEnvironment.html)
2) Load the WebEnvironment with an EnvironmentLoader
(http://shiro.apache.org/static/1.2.0/apidocs/org/apache/shiro/web/env/EnvironmentLoader.html)
For this approach, you'll probably also need to write a minimal
implementation of ServletContext to use with the above classes.
But all things considered, you might be better off just using the
functionality in Shiro Core to build something more in line with
general OSGi principles. Shiro Web makes extensive use of the servlet
specification, most of which isn't supported in the OSGi specification
(though you can achieve a compromise with many of the Shiro Web classes).
On Thu, Jan 19, 2012 at 4:05 PM, Cristiano Gavião - [email protected]
<mailto:[email protected]> wrote:
Well, I think it was because I don't know that I could do that :)
Could you please, point me to any place showing how could I do that?
thanks
Cristiano
On 19/01/12 17:32, [email protected]
<mailto:[email protected]> wrote:
Why can't you just initialize the Environment manually in your
bundle activator?
On Thu, Jan 19, 2012 at 3:23 PM, Cristiano Gavião -
[email protected] <mailto:[email protected]> wrote:
Answering myself for the records...
Yes, you can use shiro 1.2 with any OSGi environment that
uses the org.osgi.service.http, with each container specific
extended(Felix and Equinox has one), but ONLY if you use the
deprecated Filter org.apache.shiro.web.servlet.IniShiroFilter
If you try to use the new recomended filter
org.apache.shiro.web.servlet.ShiroFilter you will receive
this error:
ERROR org.eclipse.equinox.cm <http://org.eclipse.equinox.cm>
- javax.servlet.ServletException:
java.lang.IllegalStateException: No WebEnvironment found: no
EnvironmentLoaderListener registered?
java.lang.RuntimeException: javax.servlet.ServletException:
java.lang.IllegalStateException: No WebEnvironment found: no
EnvironmentLoaderListener registered?
To use IniShiroFilter you MUST create a Bundle-Fragment and
include the shiro.ini inside it and export it.
regards
On 18/01/12 13:55, Cristiano Gavião wrote:
Hi,
I have one web application that is running inside a equinox
osgi container and it don't use web.xml.
Now I'm trying to figure out how could I use Shiro in such
environment.
I already could figure out how to setup the Filter using
equinox ExtendedHttpService. But I couldn't find in Equinox
a defined API to register listeners.
So, would be possible to use Shiro without registering the
org.apache.shiro.web.env.EnvironmentLoaderListener ?
thanks for any tip.
regards,
Cristiano