Author: nbelaevski
Date: 2011-04-28 14:18:41 -0400 (Thu, 28 Apr 2011)
New Revision: 22452
Modified:
trunk/core/impl/src/main/java/org/richfaces/webapp/PushServlet.java
trunk/examples/irc-client/src/main/java/org/ircclient/listeners/TopicsInitializer.java
trunk/examples/push-demo/src/main/webapp/WEB-INF/web.xml
trunk/examples/push-demo/src/main/webapp/chat.xhtml
trunk/ui/core/ui/src/main/resources/META-INF/resources/org.richfaces/push.js
Log:
Latest push adjustments
Modified: trunk/core/impl/src/main/java/org/richfaces/webapp/PushServlet.java
===================================================================
--- trunk/core/impl/src/main/java/org/richfaces/webapp/PushServlet.java 2011-04-28
16:58:13 UTC (rev 22451)
+++ trunk/core/impl/src/main/java/org/richfaces/webapp/PushServlet.java 2011-04-28
18:18:41 UTC (rev 22452)
@@ -73,6 +73,10 @@
String parameter = config.getInitParameter(name);
if (parameter == null) {
+ parameter = config.getServletContext().getInitParameter(name);
+ }
+
+ if (parameter == null) {
parameter = DEFAULT_INIT_PARAMETERS.get(name);
}
@@ -85,6 +89,7 @@
Iterators.addAll(result, (Iterator<? extends String>)
DEFAULT_INIT_PARAMETERS.keySet());
Iterators.addAll(result,
Iterators.forEnumeration(config.getInitParameterNames()));
+ Iterators.addAll(result,
Iterators.forEnumeration(config.getServletContext().getInitParameterNames()));
return Iterators.asEnumeration(result.iterator());
}
Modified:
trunk/examples/irc-client/src/main/java/org/ircclient/listeners/TopicsInitializer.java
===================================================================
---
trunk/examples/irc-client/src/main/java/org/ircclient/listeners/TopicsInitializer.java 2011-04-28
16:58:13 UTC (rev 22451)
+++
trunk/examples/irc-client/src/main/java/org/ircclient/listeners/TopicsInitializer.java 2011-04-28
18:18:41 UTC (rev 22452)
@@ -31,7 +31,7 @@
import javax.servlet.http.HttpServletRequest;
import org.ircclient.controller.ChatBean;
-import org.richfaces.application.push.SubscriptionAbortedException;
+import org.richfaces.application.push.EventAbortedException;
import org.richfaces.application.push.Session;
import org.richfaces.application.push.SessionPreSubscriptionEvent;
import org.richfaces.application.push.SessionSubscriptionEvent;
@@ -57,14 +57,14 @@
topic.addTopicListener(new SessionTopicListener() {
- public void processUnsubscriptionEvent(SessionUnsubscriptionEvent event)
throws SubscriptionAbortedException {
+ public void processUnsubscriptionEvent(SessionUnsubscriptionEvent event)
throws EventAbortedException {
TopicKey topicKey = event.getTopicKey();
Session session = event.getSession();
System.out.println(MessageFormat.format("Session {0} disconnected
from {1}", session.getId(),
topicKey.getTopicAddress()));
}
- public void processSubscriptionEvent(SessionSubscriptionEvent event) throws
SubscriptionAbortedException {
+ public void processSubscriptionEvent(SessionSubscriptionEvent event) throws
EventAbortedException {
TopicKey topicKey = event.getTopicKey();
Session session = event.getSession();
@@ -75,11 +75,11 @@
topicKey.getTopicAddress(), hsr.getRemoteAddr()));
}
- public void processPreSubscriptionEvent(SessionPreSubscriptionEvent event)
throws SubscriptionAbortedException {
+ public void processPreSubscriptionEvent(SessionPreSubscriptionEvent event)
throws EventAbortedException {
ExternalContext externalContext =
FacesContext.getCurrentInstance().getExternalContext();
ChatBean chatBean = (ChatBean)
externalContext.getSessionMap().get("chatBean");
if (chatBean == null || !(chatBean.isConnected())) {
- throw new SubscriptionAbortedException("We are not connected to
IRC");
+ throw new EventAbortedException("We are not connected to
IRC");
}
}
});
Modified: trunk/examples/push-demo/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/examples/push-demo/src/main/webapp/WEB-INF/web.xml 2011-04-28 16:58:13 UTC (rev
22451)
+++ trunk/examples/push-demo/src/main/webapp/WEB-INF/web.xml 2011-04-28 18:18:41 UTC (rev
22452)
@@ -9,32 +9,9 @@
<param-value>Development</param-value>
</context-param>
- <listener>
-
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
- </listener>
- <filter>
- <filter-name>PushFilter</filter-name>
- <filter-class>org.richfaces.webapp.PushFilter</filter-class>
- <async-supported>true</async-supported>
- </filter>
-
- <filter-mapping>
- <filter-name>PushFilter</filter-name>
- <url-pattern>/faces/*</url-pattern>
- </filter-mapping>
-
- <!-- context-param>
+ <context-param>
<param-name>org.atmosphere.useWebSocket</param-name>
<param-value>true</param-value>
- </context-param-->
-
- <servlet>
- <servlet-name>Faces Servlet</servlet-name>
- <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
- <load-on-startup>1</load-on-startup>
- </servlet>
- <servlet-mapping>
- <servlet-name>Faces Servlet</servlet-name>
- <url-pattern>/faces/*</url-pattern>
- </servlet-mapping>
+ </context-param>
+
</web-app>
\ No newline at end of file
Modified: trunk/examples/push-demo/src/main/webapp/chat.xhtml
===================================================================
--- trunk/examples/push-demo/src/main/webapp/chat.xhtml 2011-04-28 16:58:13 UTC (rev
22451)
+++ trunk/examples/push-demo/src/main/webapp/chat.xhtml 2011-04-28 18:18:41 UTC (rev
22452)
@@ -28,6 +28,10 @@
overflow: auto;
}
</h:outputStylesheet>
+ <h:outputScript>
+ RichFaces.Push.transport = "websocket";
+ RichFaces.Push.fallbackTransport = "long-polling";
+ </h:outputScript>
</h:head>
<h:body>
<h:form id="form">
Modified: trunk/ui/core/ui/src/main/resources/META-INF/resources/org.richfaces/push.js
===================================================================
---
trunk/ui/core/ui/src/main/resources/META-INF/resources/org.richfaces/push.js 2011-04-28
16:58:13 UTC (rev 22451)
+++
trunk/ui/core/ui/src/main/resources/META-INF/resources/org.richfaces/push.js 2011-04-28
18:18:41 UTC (rev 22452)
@@ -184,8 +184,8 @@
_$(document).ready(richfaces.Push.updateConnection);
- richfaces.Push.transport = "websocket";
- richfaces.Push.fallbackTransport = "long-polling";
+ richfaces.Push.transport = "long-polling";// "websocket";
+ richfaces.Push.fallbackTransport = undefined;//"long-polling";
var ajaxEventHandler = function(event) {
if (event.type == 'event') {
Show replies by date