Access AtmosphereResource from @PushEndPoint annotated class

UI Components for JSF
Post Reply
Miguel Cubells
Posts: 99
Joined: 25 Feb 2015, 11:02

17 Mar 2015, 03:36

Hi all.

We are using PrimeFaces 5.1 with Atmosphere 2.2.6 and it works great.

However, we are using Apache Shiro for securing the web app, and we want to access the Shiro Subject from inside a @PushEndPoint class.

Atmosphere has a built-in interceptor called ShiroInterceptor, that can inject the Shiro subject as an attribute of the AtmosphereResource for each request.
This is configured in the web.xml as follows:

Code: Select all

   <servlet>
        <servlet-name>Push Servlet</servlet-name>
        <servlet-class>org.primefaces.push.PushServlet</servlet-class>
        <init-param>
            <param-name>org.atmosphere.cpr.broadcasterCacheClass</param-name>
            <param-value>org.atmosphere.cache.UUIDBroadcasterCache</param-value>
        </init-param>
        <init-param>
            <param-name>org.atmosphere.cpr.AtmosphereInterceptor</param-name>
      		<param-value>org.atmosphere.interceptor.ShiroInterceptor</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
        <async-supported>true</async-supported>
    </servlet>
But now the problem is ... how can we get access to the AtmosphereResource object from inside a @PushEndPoint annotated class ??

In the below link there is some clue:
https://jfarcand.wordpress.com/2011/07/ ... comet-app/

But it requires the usage of the @ManagedService and the @Ready annotations from Atmosphere, and we are unsure how to combine this with the @PushEndPoint.

Any help would be greatly appreciated !!

Miguel
PrimeFaces 6.1 / PF Extensions 6.1.1 / Atmosphere 2.4.3
Apache Mojarra 2.2.13+
WildFly 10.1.0.Final

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

17 Mar 2015, 20:06

forum search

shiro
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

Miguel Cubells
Posts: 99
Joined: 25 Feb 2015, 11:02

18 Mar 2015, 03:26

smithh032772 wrote:forum search

shiro
Thanks for the help.
Unfortunately I already did that search before, but no topic can help with my problem so far.

The problem is very simple: How to get access to a AtmosphereResource from a @PushEndPoint class, no matter if Shiro is being used or not.
PrimeFaces 6.1 / PF Extensions 6.1.1 / Atmosphere 2.4.3
Apache Mojarra 2.2.13+
WildFly 10.1.0.Final

kartahon1
Posts: 1
Joined: 30 Mar 2015, 08:52

31 Mar 2015, 08:53

Nothing special to do, just make sure you have the (name of) the endpoint where you want to publish the message to available in your jms message or in your topic listener????
You can get score highest marks in ccna certification and latest comptia bc and test king which are prepared by top certified professionals, caltech.edu ccna wireless training.

Miguel Cubells
Posts: 99
Joined: 25 Feb 2015, 11:02

08 Apr 2015, 15:41

kartahon1 wrote:Nothing special to do, just make sure you have the (name of) the endpoint where you want to publish the message to available in your jms message or in your topic listener????
Thanks kartahon1 for the tip ... not sure however if I understand your explanation.
Is there any place / web site, where we could see an example of that in action ??

Thanks a lot again in advance !
PrimeFaces 6.1 / PF Extensions 6.1.1 / Atmosphere 2.4.3
Apache Mojarra 2.2.13+
WildFly 10.1.0.Final

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

09 Apr 2015, 13:16

ignore the post by kartahon1. It is totally off topic

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 50 guests