Author: ilya_shaikovsky
Date: 2011-01-27 06:24:20 -0500 (Thu, 27 Jan 2011)
New Revision: 21266
Added:
trunk/examples/irc-client/
trunk/examples/irc-client/.checkstyle
trunk/examples/irc-client/pom.xml
trunk/examples/irc-client/readme.txt
trunk/examples/irc-client/src/
trunk/examples/irc-client/src/main/
trunk/examples/irc-client/src/main/java/
trunk/examples/irc-client/src/main/java/org/
trunk/examples/irc-client/src/main/java/org/ircclient/
trunk/examples/irc-client/src/main/java/org/ircclient/controller/
trunk/examples/irc-client/src/main/java/org/ircclient/controller/ChatBean.java
trunk/examples/irc-client/src/main/java/org/ircclient/listeners/
trunk/examples/irc-client/src/main/java/org/ircclient/listeners/TopicsInitializer.java
trunk/examples/irc-client/src/main/java/org/ircclient/view/
trunk/examples/irc-client/src/main/java/org/ircclient/view/SkinBean.java
trunk/examples/irc-client/src/main/webapp/
trunk/examples/irc-client/src/main/webapp/WEB-INF/
trunk/examples/irc-client/src/main/webapp/WEB-INF/faces-config.xml
trunk/examples/irc-client/src/main/webapp/WEB-INF/jboss-scanning.xml
trunk/examples/irc-client/src/main/webapp/WEB-INF/web.xml
trunk/examples/irc-client/src/main/webapp/index.jsp
trunk/examples/irc-client/src/main/webapp/templates/
trunk/examples/irc-client/src/main/webapp/templates/includes/
trunk/examples/irc-client/src/main/webapp/templates/includes/skin-chooser.xhtml
trunk/examples/irc-client/src/main/webapp/templates/template.xhtml
trunk/examples/irc-client/src/main/webapp/welcome.xhtml
Log:
https://issues.jboss.org/browse/RF-9160
Added: trunk/examples/irc-client/.checkstyle
===================================================================
--- trunk/examples/irc-client/.checkstyle (rev 0)
+++ trunk/examples/irc-client/.checkstyle 2011-01-27 11:24:20 UTC (rev 21266)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<fileset-config file-format-version="1.2.0" simple-config="true"
sync-formatter="false">
+ <fileset name="all" enabled="true"
check-config-name="rf" local="false">
+ <file-match-pattern match-pattern="."
include-pattern="true"/>
+ </fileset>
+</fileset-config>
Added: trunk/examples/irc-client/pom.xml
===================================================================
--- trunk/examples/irc-client/pom.xml (rev 0)
+++ trunk/examples/irc-client/pom.xml 2011-01-27 11:24:20 UTC (rev 21266)
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.richfaces.examples</groupId>
+ <artifactId>richfaces-example-parent</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <relativePath>../parent/pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.richfaces.examples</groupId>
+ <artifactId>irc-client</artifactId>
+ <name>Richfaces Examples: Richfaces IRC Client Application</name>
+ <version>4.0.0-SNAPSHOT</version>
+ <packaging>war</packaging>
+
+ <
url>http://jboss.org/richfaces</url>
+
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <build>
+ <finalName>irc-client</finalName>
+ <plugins>
+ <plugin>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <webResources>
+ <resource>
+ <directory>${basedir}/src/main/java</directory>
+ <targetPath>/WEB-INF/src</targetPath>
+ </resource>
+ </webResources>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>richfaces-components-ui</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>richfaces-components-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.core</groupId>
+ <artifactId>richfaces-core-impl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>jsp-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jstl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>net.sf.ehcache</groupId>
+ <artifactId>ehcache</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.atmosphere</groupId>
+ <artifactId>atmosphere-runtime</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>pircbot</groupId>
+ <artifactId>pircbot</artifactId>
+ <version>1.4.2</version>
+ </dependency>
+ <!-- Tests -->
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>5.10</version>
+ <classifier>jdk15</classifier>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
Added: trunk/examples/irc-client/readme.txt
===================================================================
--- trunk/examples/irc-client/readme.txt (rev 0)
+++ trunk/examples/irc-client/readme.txt 2011-01-27 11:24:20 UTC (rev 21266)
@@ -0,0 +1,3 @@
+IRC Client Application is a sample which shows RichFaces Push in action.
+
+Targetted to JBoss AS 6
Added: trunk/examples/irc-client/src/main/java/org/ircclient/controller/ChatBean.java
===================================================================
--- trunk/examples/irc-client/src/main/java/org/ircclient/controller/ChatBean.java
(rev 0)
+++
trunk/examples/irc-client/src/main/java/org/ircclient/controller/ChatBean.java 2011-01-27
11:24:20 UTC (rev 21266)
@@ -0,0 +1,188 @@
+package org.ircclient.controller;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.text.MessageFormat;
+import java.util.Date;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.SessionScoped;
+import javax.faces.context.FacesContext;
+import javax.faces.event.ValueChangeEvent;
+
+import org.jibble.pircbot.IrcException;
+import org.jibble.pircbot.NickAlreadyInUseException;
+import org.jibble.pircbot.PircBot;
+import org.jibble.pircbot.User;
+import org.richfaces.application.push.MessageException;
+import org.richfaces.application.push.TopicKey;
+import org.richfaces.application.push.TopicsContext;
+import org.richfaces.log.LogFactory;
+import org.richfaces.log.Logger;
+
+@ManagedBean
+@SessionScoped
+public class ChatBean extends PircBot implements Serializable {
+
+ private static final long serialVersionUID = -4945680041914388092L;
+ private static final String SERVER_URL = "irc.freenode.org";
+ private static final int SERVER_PORT = 6667;
+ private static final String CHANNEL_PREFIX = "#";
+ private static final String SUBTOPIC_SEPARATOR = "_";
+ private static final String DEFAULT_CHANNEL = "richfaces";
+ private static final Logger LOGGER = LogFactory.getLogger(ChatBean.class);
+
+ private String channelName;
+ private String message;
+ private transient TopicsContext topicsContext;
+
+ public void connect() {
+ try {
+ this.connect(SERVER_URL, SERVER_PORT);
+ this.joinChannel(CHANNEL_PREFIX + DEFAULT_CHANNEL);
+ channelName = DEFAULT_CHANNEL;
+ } catch (NickAlreadyInUseException e) {
+ FacesContext.getCurrentInstance().addMessage(
+ null,
+ new FacesMessage(FacesMessage.SEVERITY_ERROR, this.getName() + "
nick already in use", this.getName()
+ + " nick already in use"));
+ } catch (IOException e) {
+ FacesContext.getCurrentInstance().addMessage(
+ null,
+ new FacesMessage(FacesMessage.SEVERITY_ERROR, "Sorry, server
unresponsible. Try again later.",
+ "Sorry, server unresponsible. Try again later."));
+ } catch (IrcException e) {
+ FacesContext.getCurrentInstance().addMessage(
+ null,
+ new FacesMessage(FacesMessage.SEVERITY_ERROR,
+ "Sorry, we encountered IRC services problems. Try again
later.",
+ "Sorry, we encountered IRC services problems. Try again
later."));
+ }
+ }
+
+ public void leave() {
+ this.disconnect();
+ }
+
+ private TopicsContext getTopicsContext() {
+ if (topicsContext == null) {
+ topicsContext = TopicsContext.lookup();
+ }
+ return topicsContext;
+ }
+
+ @Override
+ protected void onMessage(String channel, String sender, String login, String
hostname, String message) {
+ String channelName = channel.replace(CHANNEL_PREFIX, "");
+ try {
+ getTopicsContext().publish(new TopicKey("chat", this.getUserName()
+ SUBTOPIC_SEPARATOR + channelName),
+ MessageFormat.format("{0,time,medium} {1}: {2}", new Date(),
sender, message));
+ } catch (MessageException e) {
+ LOGGER.error(e.getMessage(), e);
+ }
+ }
+
+ @Override
+ protected void onUserList(String channel, User[] users) {
+ try {
+ getTopicsContext().publish(new TopicKey("chat", this.getUserName()
+ SUBTOPIC_SEPARATOR + channelName + "List"), null);
+ } catch (MessageException e) {
+ LOGGER.error(e.getMessage(), e);
+ }
+ }
+
+ @Override
+ protected void onJoin(String channel, String sender, String login, String hostname)
{
+ try {
+ getTopicsContext().publish(new TopicKey("chat", this.getUserName()
+ SUBTOPIC_SEPARATOR + channelName + "List"), null);
+ getTopicsContext().publish(new TopicKey("chat", this.getUserName()
+ SUBTOPIC_SEPARATOR + channelName),
+ MessageFormat.format("{0,time,medium} {1}: {2}", new Date(),
sender, "joined channel"));
+ } catch (MessageException e) {
+ LOGGER.error(e.getMessage(), e);
+ }
+ }
+
+ @Override
+ protected void onPart(String channel, String sender, String login, String hostname)
{
+ try {
+ getTopicsContext().publish(new TopicKey("chat", this.getUserName()
+ SUBTOPIC_SEPARATOR + channelName + "List"), null);
+ getTopicsContext().publish(new TopicKey("chat", this.getUserName()
+ SUBTOPIC_SEPARATOR + channelName),
+ MessageFormat.format("{0,time,medium} {1}: {2}", new Date(),
sender, "left channel"));
+ } catch (MessageException e) {
+ LOGGER.error(e.getMessage(), e);
+ }
+ }
+
+ @Override
+ protected void onNickChange(String oldNick, String login, String hostname, String
newNick) {
+ try {
+ getTopicsContext().publish(new TopicKey("chat", this.getUserName()
+ SUBTOPIC_SEPARATOR + channelName + "List"), null);
+ getTopicsContext().publish(new TopicKey("chat", this.getUserName()
+ SUBTOPIC_SEPARATOR + channelName),
+ MessageFormat.format("{0,time,medium} {1}", new Date(), oldNick
+ " changed nick to " + newNick));
+ } catch (MessageException e) {
+ LOGGER.error(e.getMessage(), e);
+ }
+ }
+
+ @Override
+ protected void onQuit(String sourceNick, String sourceLogin, String sourceHostname,
String reason) {
+ try {
+ getTopicsContext().publish(new TopicKey("chat", this.getUserName()
+ SUBTOPIC_SEPARATOR + channelName + "List"), null);
+ getTopicsContext().publish(new TopicKey("chat", this.getUserName()
+ SUBTOPIC_SEPARATOR + channelName),
+ MessageFormat.format("{0,time,medium} {1}: {2} {3}", new
Date(), sourceNick, "joined channel", reason));
+ } catch (MessageException e) {
+ LOGGER.error(e.getMessage(), e);
+ }
+ }
+
+ public User[] getUsers() {
+ return this.getUsers(CHANNEL_PREFIX + channelName);
+ }
+
+ public void send() {
+ this.sendMessage(CHANNEL_PREFIX + channelName, message);
+ try {
+ getTopicsContext().publish(new TopicKey("chat", this.getUserName()
+ SUBTOPIC_SEPARATOR + channelName),
+ MessageFormat.format("{0,time,medium} {1}: {2}", new Date(),
this.getName(), message));
+ } catch (MessageException e) {
+ LOGGER.error(e.getMessage(), e);
+ }
+ }
+
+ public void changeNick(ValueChangeEvent event) {
+ this.changeNick((String) event.getNewValue());
+ }
+
+ public String getServerName() {
+ return SERVER_URL;
+ }
+
+ public void setUserName(String userName) {
+ this.setName(userName);
+ }
+
+ public String getUserName() {
+ if (this.getName().equalsIgnoreCase("PircBot")) {
+ return "";
+ } else {
+ return this.getName();
+ }
+ }
+
+ public String getChannelName() {
+ return channelName;
+ }
+
+ public void setChannelName(String channelName) {
+ this.channelName = channelName;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+}
Added:
trunk/examples/irc-client/src/main/java/org/ircclient/listeners/TopicsInitializer.java
===================================================================
---
trunk/examples/irc-client/src/main/java/org/ircclient/listeners/TopicsInitializer.java
(rev 0)
+++
trunk/examples/irc-client/src/main/java/org/ircclient/listeners/TopicsInitializer.java 2011-01-27
11:24:20 UTC (rev 21266)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.ircclient.listeners;
+
+import java.text.MessageFormat;
+
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.SystemEvent;
+import javax.faces.event.SystemEventListener;
+import javax.servlet.http.HttpServletRequest;
+
+import org.ircclient.controller.ChatBean;
+import org.richfaces.application.push.EventAbortedException;
+import org.richfaces.application.push.Session;
+import org.richfaces.application.push.SessionPreSubscriptionEvent;
+import org.richfaces.application.push.SessionSubscriptionEvent;
+import org.richfaces.application.push.SessionTopicListener;
+import org.richfaces.application.push.SessionUnsubscriptionEvent;
+import org.richfaces.application.push.Topic;
+import org.richfaces.application.push.TopicKey;
+import org.richfaces.application.push.TopicsContext;
+import org.richfaces.application.push.impl.DefaultMessageDataSerializer;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class TopicsInitializer implements SystemEventListener {
+
+ public void processEvent(SystemEvent event) throws AbortProcessingException {
+ TopicsContext topicsContext = TopicsContext.lookup();
+
+ Topic topic = topicsContext.getOrCreateTopic(new TopicKey("chat"));
+
+ topic.setMessageDataSerializer(DefaultMessageDataSerializer.instance());
+
+ topic.addTopicListener(new SessionTopicListener() {
+
+ 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
EventAbortedException {
+ TopicKey topicKey = event.getTopicKey();
+ Session session = event.getSession();
+
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ HttpServletRequest hsr = (HttpServletRequest)
facesContext.getExternalContext().getRequest();
+
+ System.out.println(MessageFormat.format("Session {0} connected to
{1} from {2}", session.getId(),
+ topicKey.getTopicAddress(), hsr.getRemoteAddr()));
+ }
+
+ 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 EventAbortedException("We are not connected to
IRC");
+ }
+ }
+ });
+ }
+
+ public boolean isListenerForSource(Object source) {
+ return true;
+ }
+
+}
Added: trunk/examples/irc-client/src/main/java/org/ircclient/view/SkinBean.java
===================================================================
--- trunk/examples/irc-client/src/main/java/org/ircclient/view/SkinBean.java
(rev 0)
+++ trunk/examples/irc-client/src/main/java/org/ircclient/view/SkinBean.java 2011-01-27
11:24:20 UTC (rev 21266)
@@ -0,0 +1,70 @@
+/**
+ *
+ */
+package org.ircclient.view;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.PostConstruct;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ManagedProperty;
+import javax.faces.bean.SessionScoped;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author ishaikovsky
+ */
+@ManagedBean(name = "skinBean")
+@SessionScoped
+public class SkinBean implements Serializable {
+ /**
+ *
+ */
+ private static final long serialVersionUID = -2399884208294434812L;
+ private static final String SKIN_VIEW_PARAMETER = "skin";
+ @ManagedProperty(value = "blueSky")
+ private String skin;
+ private List<String> skins;
+
+ @PostConstruct
+ public void initialize() {
+ skins = new ArrayList<String>();
+ skins.add("blueSky");
+ skins.add("classic");
+ skins.add("deepMarine");
+ skins.add("emeraldTown");
+ skins.add("japanCherry");
+ skins.add("ruby");
+ skins.add("wine");
+ }
+
+ // TODO: move to utility class. used in navigator also.
+ private String getViewParameter(String name) {
+ FacesContext fc = FacesContext.getCurrentInstance();
+ String param = (String)
fc.getExternalContext().getRequestParameterMap().get(name);
+ if (param != null && param.trim().length() > 0) {
+ return param;
+ } else {
+ return null;
+ }
+ }
+
+ public String getSkin() {
+ String currentSkin = getViewParameter(SKIN_VIEW_PARAMETER);
+ if (currentSkin != null) {
+ skin = currentSkin;
+ }
+ return skin;
+ }
+
+ public void setSkin(String skin) {
+ this.skin = skin;
+ }
+
+ public List<String> getSkins() {
+ return skins;
+ }
+
+}
Added: trunk/examples/irc-client/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/examples/irc-client/src/main/webapp/WEB-INF/faces-config.xml
(rev 0)
+++ trunk/examples/irc-client/src/main/webapp/WEB-INF/faces-config.xml 2011-01-27 11:24:20
UTC (rev 21266)
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<faces-config version="2.0"
xmlns="http://java.sun.com/xml/ns/javaee"
+
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd">
+
+ <application>
+ <system-event-listener>
+ <system-event-listener-class>org.ircclient.listeners.TopicsInitializer</system-event-listener-class>
+ <system-event-class>javax.faces.event.PostConstructApplicationEvent</system-event-class>
+ </system-event-listener>
+ </application>
+
+</faces-config>
Added: trunk/examples/irc-client/src/main/webapp/WEB-INF/jboss-scanning.xml
===================================================================
--- trunk/examples/irc-client/src/main/webapp/WEB-INF/jboss-scanning.xml
(rev 0)
+++ trunk/examples/irc-client/src/main/webapp/WEB-INF/jboss-scanning.xml 2011-01-27
11:24:20 UTC (rev 21266)
@@ -0,0 +1,11 @@
+<scanning xmlns="urn:jboss:scanning:1.0">
+<!--
+ For JBoss AS 6 integration there is a conflict with guava, and
+ google-collections. JBAS-8361
+-->
+ <path name="WEB-INF/classes"></path>
+
+ <path name="WEB-INF/lib/guava-r07.jar">
+ <exclude name="com.google.common.collect" />
+ </path>
+</scanning>
\ No newline at end of file
Added: trunk/examples/irc-client/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/examples/irc-client/src/main/webapp/WEB-INF/web.xml (rev
0)
+++ trunk/examples/irc-client/src/main/webapp/WEB-INF/web.xml 2011-01-27 11:24:20 UTC (rev
21266)
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xmlns="http://java.sun.com/xml/ns/javaee"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+ id="WebApp_ID" version="3.0">
+ <display-name>IRC-Client Application</display-name>
+ <context-param>
+ <param-name>javax.faces.PROJECT_STAGE</param-name>
+ <param-value>Development</param-value>
+ </context-param>
+ <context-param>
+ <param-name>javax.faces.SKIP_COMMENTS</param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.richfaces.skin</param-name>
+ <param-value>#{skinBean.skin}</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.richfaces.push.jms.connectionUsername</param-name>
+ <param-value>guest</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.richfaces.push.jms.connectionPassword</param-name>
+ <param-value>guest</param-value>
+ </context-param>
+ <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>
+ <servlet-name>Faces Servlet</servlet-name>
+ </filter-mapping>
+ <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>*.jsf</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>/faces/*</url-pattern>
+ </servlet-mapping>
+ <session-config>
+ <session-timeout>30</session-timeout>
+ </session-config>
+ <mime-mapping>
+ <extension>ecss</extension>
+ <mime-type>text/css</mime-type>
+ </mime-mapping>
+ <welcome-file-list>
+ <welcome-file>index.jsp</welcome-file>
+ </welcome-file-list>
+ <login-config>
+ <auth-method>BASIC</auth-method>
+ </login-config>
+</web-app>
Added: trunk/examples/irc-client/src/main/webapp/index.jsp
===================================================================
--- trunk/examples/irc-client/src/main/webapp/index.jsp (rev 0)
+++ trunk/examples/irc-client/src/main/webapp/index.jsp 2011-01-27 11:24:20 UTC (rev
21266)
@@ -0,0 +1,7 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head></head>
+ <body>
+ <jsp:forward page="/welcome.jsf" />
+ </body>
+</html>
\ No newline at end of file
Added: trunk/examples/irc-client/src/main/webapp/templates/includes/skin-chooser.xhtml
===================================================================
--- trunk/examples/irc-client/src/main/webapp/templates/includes/skin-chooser.xhtml
(rev 0)
+++
trunk/examples/irc-client/src/main/webapp/templates/includes/skin-chooser.xhtml 2011-01-27
11:24:20 UTC (rev 21266)
@@ -0,0 +1,25 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich">
+
+<ui:composition>
+ <h:form>
+ <rich:panel styleClass="skin-chooser">
+ <a4j:repeat var="skin" value="#{skinBean.skins}"
+ iterationStatusVar="iterStatus">
+ <h:link value="#{skin}" includeViewParams="true">
+ <f:param name="skin" value="#{skin}" />
+ <f:attribute name="style"
+ value="#{(skin==skinBean.skin) ? 'color:orange' : ''}"
/>
+ </h:link>
+ <h:outputText value=" | " rendered="#{not iterStatus.last}"
/>
+ </a4j:repeat>
+ </rich:panel>
+ </h:form>
+</ui:composition>
+
+</html>
\ No newline at end of file
Added: trunk/examples/irc-client/src/main/webapp/templates/template.xhtml
===================================================================
--- trunk/examples/irc-client/src/main/webapp/templates/template.xhtml
(rev 0)
+++ trunk/examples/irc-client/src/main/webapp/templates/template.xhtml 2011-01-27 11:24:20
UTC (rev 21266)
@@ -0,0 +1,21 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:a4j="http://richfaces.org/a4j">
+<f:view contentType="text/html">
+ <f:metadata>
+ <f:viewParam name="skin" value="#{skinBean.skin}" />
+ </f:metadata>
+ <h:head>
+ <title><ui:define name="title">Application
Title</ui:define></title>
+ <meta http-equiv="content-type" content="text/xhtml;
charset=UTF-8" />
+ </h:head>
+
+ <h:body>
+ <ui:include src="/templates/includes/skin-chooser.xhtml" />
+ <ui:insert name="body">Default content</ui:insert>
+ </h:body>
+</f:view>
+</html>
Added: trunk/examples/irc-client/src/main/webapp/welcome.xhtml
===================================================================
--- trunk/examples/irc-client/src/main/webapp/welcome.xhtml (rev
0)
+++ trunk/examples/irc-client/src/main/webapp/welcome.xhtml 2011-01-27 11:24:20 UTC (rev
21266)
@@ -0,0 +1,80 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich"
+
xmlns:c="http://java.sun.com/jsp/jstl/core"
+ template="/templates/template.xhtml">
+ <ui:define name="body">
+ <style>
+.chatOutput {
+ overflow: auto;
+ width: 80%;
+ height: 200px;
+ float: left;
+}
+
+.chatList {
+ float: right;
+ width: 19%;
+ height: 200px;
+ overflow: auto;
+}
+</style>
+ <rich:panel header="Connect to IRC"
+ rendered="#{not chatBean.connected}">
+ <h:form>
+ <a4j:outputPanel ajaxRendered="true">
+ <h:messages style="color:red" />
+ </a4j:outputPanel>
+ <h:panelGrid columns="2">
+ <h:outputText value="Your nickname:" />
+ <h:inputText required="true" id="name"
value="#{chatBean.userName}" />
+ <h:outputText value="Channel:" />
+ <h:outputText value="RichFaces"
style="font-weight:bold"/>
+ <h:outputText value="Server:" />
+ <h:outputText value="irc.freenode.org"
style="font-weight:bold"/>
+ </h:panelGrid>
+ <a4j:commandButton value="Connect" execute="@form"
render="@all"
+ action="#{chatBean.connect}" />
+ </h:form>
+ </rich:panel>
+ <rich:panel
+ header="Welcome to #{chatBean.channelName} channel at
#{chatBean.serverName}"
+ rendered="#{chatBean.connected}" id="chatpanel">
+ <rich:panel styleClass="chatOutput"
+ bodyClass="#{chatBean.channelName}Output" />
+ <rich:panel styleClass="chatList">
+ <rich:list value="#{chatBean.users}" var="user"
id="users"
+ type="unordered">
+ #{user.nick}
+ </rich:list>
+ </rich:panel>
+ <br clear="all" />
+ <hr />
+ <h:form>
+ <a4j:push
address="#{chatBean.userName}_#{chatBean.channelName}List@chat"
+ onerror="alert(event.rf.data)">
+ <a4j:ajax event="dataavailable" render="users"
execute="@none" />
+ </a4j:push>
+ <a4j:push address="#{chatBean.userName}_#{chatBean.channelName}@chat"
+ onerror="alert(event.rf.data)"
+ ondataavailable="jQuery('<div
/>').prependTo('.#{chatBean.channelName}Output').text(event.rf.data)"
/>
+ <h:inputTextarea value="#{chatBean.message}" rows="3"
+ style="width:80%" id="nm" />
+ <a4j:commandButton value="Send" action="#{chatBean.send}"
+ render="@none" execute="@form" />
+ </h:form>
+ <hr />
+ <h:form>
+ <rich:panel header="Change nickname:">
+ <h:inputText valueChangeListener="#{chatBean.changeNick}"
id="cn" />
+ <a4j:commandButton value="Change" execute="@form"
render="@none"/>
+ </rich:panel>
+ <a4j:commandButton value="disconnect"
action="#{chatBean.leave}" execute="@none"
render="@all"/>
+ </h:form>
+ </rich:panel>
+ </ui:define>
+</ui:composition>
\ No newline at end of file