group of test apps
Revision | 0f09db7381aad47777acde4d3df319fb2e78fc66 (tree) |
---|---|
Time | 2014-01-29 11:54:01 |
Author | astoria-d <astoria-d@mail...> |
Commiter | astoria-d |
icetest added
@@ -0,0 +1,9 @@ | ||
1 | +*/build/* | |
2 | +*/dist/* | |
3 | +*/deleted/* | |
4 | +*/target/* | |
5 | +*.lnk | |
6 | +*.class | |
7 | + | |
8 | +aaa.txt | |
9 | + |
@@ -0,0 +1,5 @@ | ||
1 | +<factorypath> | |
2 | + <factorypathentry kind="PLUGIN" id="org.eclipse.jst.ws.annotations.core" enabled="true" runInBatchMode="false"/> | |
3 | + <factorypathentry kind="VARJAR" id="M2_REPO/org/hibernate/hibernate-jpamodelgen/1.1.1.Final/hibernate-jpamodelgen-1.1.1.Final.jar" enabled="true" runInBatchMode="false"/> | |
4 | + <factorypathentry kind="VARJAR" id="M2_REPO/org/hibernate/javax/persistence/hibernate-jpa-2.0-api/1.0.0.Final/hibernate-jpa-2.0-api-1.0.0.Final.jar" enabled="true" runInBatchMode="false"/> | |
5 | +</factorypath> |
@@ -0,0 +1,324 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!-- | |
3 | + JBoss, Home of Professional Open Source | |
4 | + Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual | |
5 | + contributors by the @authors tag. See the copyright.txt in the | |
6 | + distribution for a full listing of individual contributors. | |
7 | + | |
8 | + Licensed under the Apache License, Version 2.0 (the "License"); | |
9 | + you may not use this file except in compliance with the License. | |
10 | + You may obtain a copy of the License at | |
11 | + http://www.apache.org/licenses/LICENSE-2.0 | |
12 | + Unless required by applicable law or agreed to in writing, software | |
13 | + distributed under the License is distributed on an "AS IS" BASIS, | |
14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
15 | + See the License for the specific language governing permissions and | |
16 | + limitations under the License. | |
17 | +--> | |
18 | + | |
19 | + | |
20 | +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
21 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
22 | + <modelVersion>4.0.0</modelVersion> | |
23 | + | |
24 | + <groupId>icetest</groupId> | |
25 | + <artifactId>icetest</artifactId> | |
26 | + <version>1.0-SNAPSHOT</version> | |
27 | + <packaging>war</packaging> | |
28 | + <name>icetest</name> | |
29 | + <description>A starter Java EE 6 webapp project for use on JBoss AS 7 / EAP 6, generated from the jboss-javaee6-webapp archetype</description> | |
30 | + | |
31 | + <url>http://jboss.org/jbossas</url> | |
32 | + <licenses> | |
33 | + <license> | |
34 | + <name>Apache License, Version 2.0</name> | |
35 | + <distribution>repo</distribution> | |
36 | + <url>http://www.apache.org/licenses/LICENSE-2.0.html</url> | |
37 | + </license> | |
38 | + </licenses> | |
39 | + | |
40 | + <properties> | |
41 | + <!-- Explicitly declaring the source encoding eliminates the following | |
42 | + message: --> | |
43 | + <!-- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered | |
44 | + resources, i.e. build is platform dependent! --> | |
45 | + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
46 | + | |
47 | + <!-- JBoss dependency versions --> | |
48 | + <version.jboss.maven.plugin>7.4.Final</version.jboss.maven.plugin> | |
49 | + | |
50 | + <!-- Define the version of the JBoss BOMs we want to import to specify | |
51 | + tested stacks. --> | |
52 | + <version.jboss.bom>1.0.7.Final</version.jboss.bom> | |
53 | + <!-- Alternatively, comment out the above line, and un-comment the line | |
54 | + below to use version 1.0.4.Final-redhat-4 which is a release certified to | |
55 | + work with JBoss EAP 6. It requires you have access to the JBoss EAP 6 | |
56 | + maven repository. --> | |
57 | + <!-- <version.jboss.bom>1.0.4.Final-redhat-4</version.jboss.bom>> --> | |
58 | + | |
59 | + <!-- other plugin versions --> | |
60 | + <version.surefire.plugin>2.10</version.surefire.plugin> | |
61 | + <version.war.plugin>2.1.1</version.war.plugin> | |
62 | + | |
63 | + <!-- maven-compiler-plugin --> | |
64 | + <maven.compiler.target>1.6</maven.compiler.target> | |
65 | + <maven.compiler.source>1.6</maven.compiler.source> | |
66 | + </properties> | |
67 | + | |
68 | + | |
69 | + <dependencyManagement> | |
70 | + <dependencies> | |
71 | + <!-- JBoss distributes a complete set of Java EE 6 APIs including a Bill | |
72 | + of Materials (BOM). A BOM specifies the versions of a "stack" (or a collection) | |
73 | + of artifacts. We use this here so that we always get the correct versions | |
74 | + of artifacts. Here we use the jboss-javaee-6.0-with-tools stack (you can | |
75 | + read this as the JBoss stack of the Java EE 6 APIs, with some extras tools | |
76 | + for your project, such as Arquillian for testing) and the jboss-javaee-6.0-with-hibernate | |
77 | + stack you can read this as the JBoss stack of the Java EE 6 APIs, with extras | |
78 | + from the Hibernate family of projects) --> | |
79 | + <dependency> | |
80 | + <groupId>org.jboss.bom</groupId> | |
81 | + <artifactId>jboss-javaee-6.0-with-tools</artifactId> | |
82 | + <version>${version.jboss.bom}</version> | |
83 | + <type>pom</type> | |
84 | + <scope>import</scope> | |
85 | + </dependency> | |
86 | + <dependency> | |
87 | + <groupId>org.jboss.bom</groupId> | |
88 | + <artifactId>jboss-javaee-6.0-with-hibernate</artifactId> | |
89 | + <version>${version.jboss.bom}</version> | |
90 | + <type>pom</type> | |
91 | + <scope>import</scope> | |
92 | + </dependency> | |
93 | + </dependencies> | |
94 | + </dependencyManagement> | |
95 | + | |
96 | + <dependencies> | |
97 | + | |
98 | +<dependency> | |
99 | +<groupId>org.primefaces</groupId> | |
100 | +<artifactId>primefaces</artifactId> | |
101 | +<version>4.0</version> | |
102 | +</dependency> | |
103 | + | |
104 | +<dependency> | |
105 | +<groupId>org.atmosphere</groupId> | |
106 | +<artifactId>atmosphere-runtime</artifactId> | |
107 | +<version>2.0.1</version> | |
108 | +</dependency> | |
109 | + | |
110 | +<dependency> | |
111 | + <groupId>org.jboss.spec.javax.servlet</groupId> | |
112 | + <artifactId>jboss-servlet-api_3.0_spec</artifactId> | |
113 | + <version>1.0.0.Final</version> | |
114 | +</dependency> | |
115 | + | |
116 | + <!-- First declare the APIs we depend on and need for compilation. All | |
117 | + of them are provided by JBoss AS 7 --> | |
118 | + | |
119 | + <!-- Import the CDI API, we use provided scope as the API is included in | |
120 | + JBoss AS 7 --> | |
121 | + <dependency> | |
122 | + <groupId>javax.enterprise</groupId> | |
123 | + <artifactId>cdi-api</artifactId> | |
124 | + <scope>provided</scope> | |
125 | + </dependency> | |
126 | + | |
127 | + <!-- Import the Common Annotations API (JSR-250), we use provided scope | |
128 | + as the API is included in JBoss AS 7 --> | |
129 | + <dependency> | |
130 | + <groupId>org.jboss.spec.javax.annotation</groupId> | |
131 | + <artifactId>jboss-annotations-api_1.1_spec</artifactId> | |
132 | + <scope>provided</scope> | |
133 | + </dependency> | |
134 | + | |
135 | + <!-- Import the JAX-RS API, we use provided scope as the API is included | |
136 | + in JBoss AS 7 --> | |
137 | + <dependency> | |
138 | + <groupId>org.jboss.spec.javax.ws.rs</groupId> | |
139 | + <artifactId>jboss-jaxrs-api_1.1_spec</artifactId> | |
140 | + <scope>provided</scope> | |
141 | + </dependency> | |
142 | + | |
143 | + <!-- Import the JPA API, we use provided scope as the API is included in | |
144 | + JBoss AS 7 --> | |
145 | + <dependency> | |
146 | + <groupId>org.hibernate.javax.persistence</groupId> | |
147 | + <artifactId>hibernate-jpa-2.0-api</artifactId> | |
148 | + <scope>provided</scope> | |
149 | + </dependency> | |
150 | + | |
151 | + <!-- Import the EJB API, we use provided scope as the API is included in | |
152 | + JBoss AS 7 --> | |
153 | + <dependency> | |
154 | + <groupId>org.jboss.spec.javax.ejb</groupId> | |
155 | + <artifactId>jboss-ejb-api_3.1_spec</artifactId> | |
156 | + <scope>provided</scope> | |
157 | + </dependency> | |
158 | + | |
159 | + <!-- JSR-303 (Bean Validation) Implementation --> | |
160 | + <!-- Provides portable constraints such as @Email --> | |
161 | + <!-- Hibernate Validator is shipped in JBoss AS 7 --> | |
162 | + <dependency> | |
163 | + <groupId>org.hibernate</groupId> | |
164 | + <artifactId>hibernate-validator</artifactId> | |
165 | + <scope>provided</scope> | |
166 | + <exclusions> | |
167 | + <exclusion> | |
168 | + <groupId>org.slf4j</groupId> | |
169 | + <artifactId>slf4j-api</artifactId> | |
170 | + </exclusion> | |
171 | + </exclusions> | |
172 | + </dependency> | |
173 | + | |
174 | + <!-- Import the JSF API, we use provided scope as the API is included in | |
175 | + JBoss AS 7 --> | |
176 | + <dependency> | |
177 | + <groupId>org.jboss.spec.javax.faces</groupId> | |
178 | + <artifactId>jboss-jsf-api_2.1_spec</artifactId> | |
179 | + <scope>provided</scope> | |
180 | + </dependency> | |
181 | + | |
182 | + <!-- Now we declare any tools needed --> | |
183 | + | |
184 | + <!-- Annotation processor to generate the JPA 2.0 metamodel classes for | |
185 | + typesafe criteria queries --> | |
186 | + <dependency> | |
187 | + <groupId>org.hibernate</groupId> | |
188 | + <artifactId>hibernate-jpamodelgen</artifactId> | |
189 | + <scope>provided</scope> | |
190 | + </dependency> | |
191 | + | |
192 | + <!-- Annotation processor that raising compilation errors whenever constraint | |
193 | + annotations are incorrectly used. --> | |
194 | + <dependency> | |
195 | + <groupId>org.hibernate</groupId> | |
196 | + <artifactId>hibernate-validator-annotation-processor</artifactId> | |
197 | + <scope>provided</scope> | |
198 | + </dependency> | |
199 | + | |
200 | + <!-- Needed for running tests (you may also use TestNG) --> | |
201 | + <dependency> | |
202 | + <groupId>junit</groupId> | |
203 | + <artifactId>junit</artifactId> | |
204 | + <scope>test</scope> | |
205 | + </dependency> | |
206 | + | |
207 | + <!-- Optional, but highly recommended --> | |
208 | + <!-- Arquillian allows you to test enterprise code such as EJBs and Transactional(JTA) | |
209 | + JPA from JUnit/TestNG --> | |
210 | + <dependency> | |
211 | + <groupId>org.jboss.arquillian.junit</groupId> | |
212 | + <artifactId>arquillian-junit-container</artifactId> | |
213 | + <scope>test</scope> | |
214 | + </dependency> | |
215 | + | |
216 | + <dependency> | |
217 | + <groupId>org.jboss.arquillian.protocol</groupId> | |
218 | + <artifactId>arquillian-protocol-servlet</artifactId> | |
219 | + <scope>test</scope> | |
220 | + </dependency> | |
221 | + | |
222 | + </dependencies> | |
223 | + | |
224 | + <build> | |
225 | + <!-- Maven will append the version to the finalName (which is the name | |
226 | + given to the generated war, and hence the context root) --> | |
227 | + <finalName>${project.artifactId}</finalName> | |
228 | + <plugins> | |
229 | + <plugin> | |
230 | + <artifactId>maven-war-plugin</artifactId> | |
231 | + <version>${version.war.plugin}</version> | |
232 | + <configuration> | |
233 | + <!-- Java EE 6 doesn't require web.xml, Maven needs to catch up! --> | |
234 | + <failOnMissingWebXml>false</failOnMissingWebXml> | |
235 | + </configuration> | |
236 | + </plugin> | |
237 | + <!-- The JBoss AS plugin deploys your war to a local JBoss AS container --> | |
238 | + <!-- To use, run: mvn package jboss-as:deploy --> | |
239 | + <plugin> | |
240 | + <groupId>org.jboss.as.plugins</groupId> | |
241 | + <artifactId>jboss-as-maven-plugin</artifactId> | |
242 | + <version>${version.jboss.maven.plugin}</version> | |
243 | + </plugin> | |
244 | + </plugins> | |
245 | + </build> | |
246 | + | |
247 | + <profiles> | |
248 | + <profile> | |
249 | + <!-- The default profile skips all tests, though you can tune it to run | |
250 | + just unit tests based on a custom pattern --> | |
251 | + <!-- Seperate profiles are provided for running all tests, including Arquillian | |
252 | + tests that execute in the specified container --> | |
253 | + <id>default</id> | |
254 | + <activation> | |
255 | + <activeByDefault>true</activeByDefault> | |
256 | + </activation> | |
257 | + <build> | |
258 | + <plugins> | |
259 | + <plugin> | |
260 | + <artifactId>maven-surefire-plugin</artifactId> | |
261 | + <version>${version.surefire.plugin}</version> | |
262 | + <configuration> | |
263 | + <skip>true</skip> | |
264 | + </configuration> | |
265 | + </plugin> | |
266 | + </plugins> | |
267 | + </build> | |
268 | + </profile> | |
269 | + | |
270 | + <profile> | |
271 | + <!-- An optional Arquillian testing profile that executes tests in your | |
272 | + JBoss AS instance --> | |
273 | + <!-- This profile will start a new JBoss AS instance, and execute the | |
274 | + test, shutting it down when done --> | |
275 | + <!-- Run with: mvn clean test -Parq-jbossas-managed --> | |
276 | + <id>arq-jbossas-managed</id> | |
277 | + <dependencies> | |
278 | + <dependency> | |
279 | + <groupId>org.jboss.as</groupId> | |
280 | + <artifactId>jboss-as-arquillian-container-managed</artifactId> | |
281 | + <scope>test</scope> | |
282 | + </dependency> | |
283 | + </dependencies> | |
284 | + </profile> | |
285 | + | |
286 | + <profile> | |
287 | + <!-- An optional Arquillian testing profile that executes tests in a remote | |
288 | + JBoss AS instance --> | |
289 | + <!-- Run with: mvn clean test -Parq-jbossas-remote --> | |
290 | + <id>arq-jbossas-remote</id> | |
291 | + <dependencies> | |
292 | + <dependency> | |
293 | + <groupId>org.jboss.as</groupId> | |
294 | + <artifactId>jboss-as-arquillian-container-remote</artifactId> | |
295 | + <scope>test</scope> | |
296 | + </dependency> | |
297 | + </dependencies> | |
298 | + </profile> | |
299 | + | |
300 | + <profile> | |
301 | + <!-- When built in OpenShift the 'openshift' profile will be used when | |
302 | + invoking mvn. --> | |
303 | + <!-- Use this profile for any OpenShift specific customization your app | |
304 | + will need. --> | |
305 | + <!-- By default that is to put the resulting archive into the 'deployments' | |
306 | + folder. --> | |
307 | + <!-- http://maven.apache.org/guides/mini/guide-building-for-different-environments.html --> | |
308 | + <id>openshift</id> | |
309 | + <build> | |
310 | + <plugins> | |
311 | + <plugin> | |
312 | + <artifactId>maven-war-plugin</artifactId> | |
313 | + <version>${version.war.plugin}</version> | |
314 | + <configuration> | |
315 | + <outputDirectory>deployments</outputDirectory> | |
316 | + <warName>ROOT</warName> | |
317 | + </configuration> | |
318 | + </plugin> | |
319 | + </plugins> | |
320 | + </build> | |
321 | + </profile> | |
322 | + | |
323 | + </profiles> | |
324 | +</project> |
@@ -0,0 +1,89 @@ | ||
1 | +package icetest; | |
2 | + | |
3 | +import java.io.Serializable; | |
4 | +import javax.faces.bean.ManagedBean; | |
5 | +import javax.faces.bean.ViewScoped; | |
6 | +import javax.faces.context.FacesContext; | |
7 | +import javax.annotation.PostConstruct; | |
8 | + | |
9 | +import java.util.logging.Logger; | |
10 | +import javax.inject.Inject; | |
11 | + | |
12 | + | |
13 | +import java.util.ArrayList; | |
14 | + | |
15 | +@ManagedBean | |
16 | +@ViewScoped | |
17 | +public class ChatBean implements Serializable { | |
18 | + | |
19 | + @Inject | |
20 | + public Logger log; | |
21 | + | |
22 | + @Inject | |
23 | + private FacesContext context; | |
24 | + | |
25 | + private String msg; | |
26 | + private ArrayList<ChatMessage> msgList; | |
27 | + | |
28 | + public void setMsg(String msg) { | |
29 | + this.msg = msg; | |
30 | + } | |
31 | + public String getMsg() { | |
32 | + return ""; | |
33 | + } | |
34 | + | |
35 | + ///chat list data | |
36 | + public static class ChatMessage { | |
37 | + private String uname; | |
38 | + private String msg; | |
39 | + private String date; | |
40 | + public String getUname() { | |
41 | + return uname; | |
42 | + } | |
43 | + public String getMsg() { | |
44 | + return msg; | |
45 | + } | |
46 | + public String getDate() { | |
47 | + return date; | |
48 | + } | |
49 | + public void setUname(String uname) { | |
50 | + this.uname = uname; | |
51 | + } | |
52 | + public void setMsg(String msg) { | |
53 | + this.msg = msg; | |
54 | + } | |
55 | + public void setDate(String date) { | |
56 | + this.date = date; | |
57 | + } | |
58 | + } | |
59 | + | |
60 | + | |
61 | + @PostConstruct | |
62 | + public void initMsgList(){ | |
63 | + log.info("initMsgList:"); | |
64 | + msgList = new ArrayList<ChatMessage>(); | |
65 | + ChatMessage cm = new ChatMessage(); | |
66 | + cm.msg = "msg1"; | |
67 | + cm.date = "xxxxx"; | |
68 | + cm.uname = "uname1"; | |
69 | + msgList.add(cm); | |
70 | + | |
71 | + cm = new ChatMessage(); | |
72 | + cm.msg = "msg2"; | |
73 | + cm.date = "yyyy yy yy"; | |
74 | + cm.uname = "name2....."; | |
75 | + msgList.add(cm); | |
76 | + | |
77 | + cm = new ChatMessage(); | |
78 | + cm.msg = "msg3333"; | |
79 | + cm.date = "zzzz zzzzz"; | |
80 | + cm.uname = "NAME 3333!"; | |
81 | + msgList.add(cm); | |
82 | + } | |
83 | + | |
84 | + public ArrayList<ChatMessage> getMsgList(){ | |
85 | + return msgList; | |
86 | + } | |
87 | + | |
88 | + | |
89 | +} |
@@ -0,0 +1,41 @@ | ||
1 | +package icetest; | |
2 | + | |
3 | +import java.io.Serializable; | |
4 | + | |
5 | +import org.primefaces.push.PushContext; | |
6 | +import org.primefaces.push.PushContextFactory; | |
7 | + | |
8 | +import java.util.logging.Logger; | |
9 | +import javax.inject.Inject; | |
10 | + | |
11 | +public class GlobalCounterBean implements Serializable{ | |
12 | + @Inject | |
13 | + private Logger log; | |
14 | + | |
15 | + private int count; | |
16 | + | |
17 | + public int getCount() { | |
18 | + return count; | |
19 | + } | |
20 | + | |
21 | + public void setCount(int count) { | |
22 | + this.count = count; | |
23 | + } | |
24 | + | |
25 | + public synchronized void increment() { | |
26 | + log.info("incre!!!"); | |
27 | + count++; | |
28 | + | |
29 | + PushContext pushContext = PushContextFactory.getDefault().getPushContext(); | |
30 | + pushContext.push("/counter", String.valueOf(count)); | |
31 | + | |
32 | + ChatBean.ChatMessage cm = new ChatBean.ChatMessage(); | |
33 | + cm.setMsg("msg" + count); | |
34 | + cm.setDate("xxxxx"); | |
35 | + cm.setUname("uname1"); | |
36 | + | |
37 | + pushContext.push("/chatmsg", cm); | |
38 | + } | |
39 | +} | |
40 | + | |
41 | + |
@@ -0,0 +1,43 @@ | ||
1 | +package icetest; | |
2 | + | |
3 | +import javax.inject.Inject; | |
4 | +import javax.enterprise.inject.Produces; | |
5 | +import javax.enterprise.inject.spi.InjectionPoint; | |
6 | +import java.util.logging.Logger; | |
7 | + | |
8 | +import javax.enterprise.context.RequestScoped; | |
9 | +import javax.faces.context.FacesContext; | |
10 | + | |
11 | +import javax.naming.InitialContext; | |
12 | +import javax.naming.NamingException; | |
13 | + | |
14 | + | |
15 | +import javax.faces.context.FacesContext; | |
16 | +import javax.faces.context.ExternalContext; | |
17 | +import javax.servlet.http.HttpServletRequest; | |
18 | +import javax.servlet.http.HttpSession; | |
19 | + | |
20 | +public class Resources { | |
21 | + | |
22 | + private static Logger log = Logger.getLogger(Resources.class.getName()); | |
23 | + | |
24 | + //injection producer.... | |
25 | + @Produces | |
26 | + public Logger produceLog(InjectionPoint injectionPoint) { | |
27 | + return Logger.getLogger(injectionPoint.getMember().getDeclaringClass().getName()); | |
28 | + } | |
29 | + | |
30 | + @Produces | |
31 | + @RequestScoped | |
32 | + public FacesContext produceFacesContext() { | |
33 | + return FacesContext.getCurrentInstance(); | |
34 | + } | |
35 | + | |
36 | + public static HttpSession getSession() { | |
37 | + FacesContext context = FacesContext.getCurrentInstance(); | |
38 | + ExternalContext exContext = context.getExternalContext(); | |
39 | + HttpServletRequest req = (HttpServletRequest) exContext.getRequest(); | |
40 | + HttpSession session = req.getSession(); | |
41 | + return session; | |
42 | + } | |
43 | +} |
@@ -0,0 +1,25 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!-- | |
3 | + JBoss, Home of Professional Open Source | |
4 | + Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual | |
5 | + contributors by the @authors tag. See the copyright.txt in the | |
6 | + distribution for a full listing of individual contributors. | |
7 | + | |
8 | + Licensed under the Apache License, Version 2.0 (the "License"); | |
9 | + you may not use this file except in compliance with the License. | |
10 | + You may obtain a copy of the License at | |
11 | + http://www.apache.org/licenses/LICENSE-2.0 | |
12 | + Unless required by applicable law or agreed to in writing, software | |
13 | + distributed under the License is distributed on an "AS IS" BASIS, | |
14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
15 | + See the License for the specific language governing permissions and | |
16 | + limitations under the License. | |
17 | +--> | |
18 | +<!-- This file can be an empty text file (0 bytes) --> | |
19 | +<!-- We're declaring the schema to save you time if you do have to configure | |
20 | + this in the future --> | |
21 | +<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
22 | + xsi:schemaLocation=" | |
23 | + http://java.sun.com/xml/ns/javaee | |
24 | + http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"> | |
25 | +</beans> |
@@ -0,0 +1,36 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!-- | |
3 | + JBoss, Home of Professional Open Source | |
4 | + Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual | |
5 | + contributors by the @authors tag. See the copyright.txt in the | |
6 | + distribution for a full listing of individual contributors. | |
7 | + | |
8 | + Licensed under the Apache License, Version 2.0 (the "License"); | |
9 | + you may not use this file except in compliance with the License. | |
10 | + You may obtain a copy of the License at | |
11 | + http://www.apache.org/licenses/LICENSE-2.0 | |
12 | + Unless required by applicable law or agreed to in writing, software | |
13 | + distributed under the License is distributed on an "AS IS" BASIS, | |
14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
15 | + See the License for the specific language governing permissions and | |
16 | + limitations under the License. | |
17 | +--> | |
18 | +<!-- This file is not required if you don't need any extra configuration. --> | |
19 | +<faces-config version="2.0" xmlns="http://java.sun.com/xml/ns/javaee" | |
20 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
21 | + xsi:schemaLocation=" | |
22 | + http://java.sun.com/xml/ns/javaee | |
23 | + http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"> | |
24 | + | |
25 | + <!-- This descriptor activates the JSF 2.0 Servlet --> | |
26 | + | |
27 | + <!-- Write your navigation rules here. You are encouraged to use CDI | |
28 | + for creating @Named managed beans. --> | |
29 | + | |
30 | + <managed-bean> | |
31 | + <managed-bean-name>globalCounter</managed-bean-name> | |
32 | + <managed-bean-class>icetest.GlobalCounterBean</managed-bean-class> | |
33 | + <managed-bean-scope>application</managed-bean-scope> | |
34 | + </managed-bean> | |
35 | + | |
36 | +</faces-config> |
@@ -0,0 +1,28 @@ | ||
1 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
2 | +"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
3 | +<html xmlns="http://www.w3.org/1999/xhtml" | |
4 | + xmlns:h="http://java.sun.com/jsf/html" | |
5 | + xmlns:composite="http://java.sun.com/jsf/composite" | |
6 | + xmlns:f="http://java.sun.com/jsf/core" | |
7 | + xmlns:ui="http://java.sun.com/jsf/facelets"> | |
8 | +<h:head> | |
9 | +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
10 | + | |
11 | +<title> | |
12 | + <ui:insert name="pageTitle">JFS Template</ui:insert> | |
13 | +</title> | |
14 | + <ui:insert name="header"/> | |
15 | + | |
16 | +</h:head> | |
17 | + | |
18 | +<body> | |
19 | + | |
20 | + <div id="pageHeader" style="FONT-FAMILY: 'Britannic Bold'; BACKGROUND-COLOR: #800000; color:#FFF"> | |
21 | + <h1>moto chat app</h1> | |
22 | + </div> | |
23 | + | |
24 | + <!-- c. 各ページで異なるコンテンツを表示する領域 --> | |
25 | + <ui:insert name="body">ページごとのコンテンツ</ui:insert> | |
26 | + | |
27 | +</body> | |
28 | +</html> | |
\ No newline at end of file |
@@ -0,0 +1,27 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<web-app version="2.5" | |
3 | + xmlns="http://java.sun.com/xml/ns/javaee" | |
4 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
5 | + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" > | |
6 | + | |
7 | + <servlet> | |
8 | + <servlet-name>Faces Servlet</servlet-name> | |
9 | + <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> | |
10 | + </servlet> | |
11 | + | |
12 | + <servlet-mapping> | |
13 | + <servlet-name>Faces Servlet</servlet-name> | |
14 | + <url-pattern>*.jsf</url-pattern> | |
15 | + </servlet-mapping> | |
16 | + | |
17 | + <servlet> | |
18 | + <servlet-name>Push Servlet</servlet-name> | |
19 | + <servlet-class>org.primefaces.push.PushServlet</servlet-class> | |
20 | + </servlet> | |
21 | + | |
22 | + <servlet-mapping> | |
23 | + <servlet-name>Push Servlet</servlet-name> | |
24 | + <url-pattern>/primepush/*</url-pattern> | |
25 | + </servlet-mapping> | |
26 | + | |
27 | +</web-app> |
@@ -0,0 +1,23 @@ | ||
1 | +<!-- | |
2 | + JBoss, Home of Professional Open Source | |
3 | + Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual | |
4 | + contributors by the @authors tag. See the copyright.txt in the | |
5 | + distribution for a full listing of individual contributors. | |
6 | + | |
7 | + Licensed under the Apache License, Version 2.0 (the "License"); | |
8 | + you may not use this file except in compliance with the License. | |
9 | + You may obtain a copy of the License at | |
10 | + http://www.apache.org/licenses/LICENSE-2.0 | |
11 | + Unless required by applicable law or agreed to in writing, software | |
12 | + distributed under the License is distributed on an "AS IS" BASIS, | |
13 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | + See the License for the specific language governing permissions and | |
15 | + limitations under the License. | |
16 | +--> | |
17 | +<!-- Plain HTML page that kicks us into the app --> | |
18 | + | |
19 | +<html> | |
20 | +<head> | |
21 | +<meta http-equiv="Refresh" content="0; URL=index.jsf"> | |
22 | +</head> | |
23 | +</html> |
@@ -0,0 +1,88 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!-- | |
3 | + JBoss, Home of Professional Open Source | |
4 | + Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual | |
5 | + contributors by the @authors tag. See the copyright.txt in the | |
6 | + distribution for a full listing of individual contributors. | |
7 | + | |
8 | + Licensed under the Apache License, Version 2.0 (the "License"); | |
9 | + you may not use this file except in compliance with the License. | |
10 | + You may obtain a copy of the License at | |
11 | + http://www.apache.org/licenses/LICENSE-2.0 | |
12 | + Unless required by applicable law or agreed to in writing, software | |
13 | + distributed under the License is distributed on an "AS IS" BASIS, | |
14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
15 | + See the License for the specific language governing permissions and | |
16 | + limitations under the License. | |
17 | +--> | |
18 | +<ui:composition xmlns="http://www.w3.org/1999/xhtml" | |
19 | + xmlns:ui="http://java.sun.com/jsf/facelets" | |
20 | + xmlns:f="http://java.sun.com/jsf/core" | |
21 | + xmlns:h="http://java.sun.com/jsf/html" | |
22 | + xmlns:p="http://primefaces.org/ui" | |
23 | + template="/WEB-INF/templates/moto-template.xhtml"> | |
24 | + | |
25 | + <ui:define name="header"> | |
26 | + <style type="text/css"> | |
27 | + .display { | |
28 | + font-size: 36px !important; | |
29 | + } | |
30 | + </style> | |
31 | + | |
32 | + <script type="text/javascript"> | |
33 | + //<![CDATA[ | |
34 | + function handleMessage(data) { | |
35 | + $('.display').html(data); | |
36 | + } | |
37 | + | |
38 | + function handleChatMsg(data) { | |
39 | + var msgList = document.getElementById("msgList"); | |
40 | + | |
41 | + var newRow = msgList.insertRow(msgList.rows.length); | |
42 | + | |
43 | + var newNameCell = newRow.insertCell(0); | |
44 | + var newMsgCell = newRow.insertCell(1); | |
45 | + var newDateCell = newRow.insertCell(2); | |
46 | + | |
47 | + newNameCell.innerHTML = data.uname; | |
48 | + newMsgCell.innerHTML = data.msg; | |
49 | + newDateCell.innerHTML = data.date; | |
50 | + } | |
51 | + | |
52 | + //]]> | |
53 | + </script> | |
54 | + </ui:define> | |
55 | + | |
56 | + <ui:define name="pageHeader"> | |
57 | + </ui:define> | |
58 | + | |
59 | + <ui:define name="body"> | |
60 | + | |
61 | +<h:form> | |
62 | +<h:outputText value="#{globalCounter.count}" styleClass="display" /> | |
63 | +<p:commandButton value="Click" actionListener="#{globalCounter.increment}" /> | |
64 | +</h:form> | |
65 | + | |
66 | +<p:socket onMessage="handleMessage" channel="/counter" /> | |
67 | + | |
68 | +<p:socket onMessage="handleChatMsg" channel="/chatmsg" /> | |
69 | + | |
70 | + <h:dataTable id="msgList" var="_chat" value="#{chatBean.msgList}" | |
71 | + rendered="#{not empty chatBean.msgList}" border="0"> | |
72 | + | |
73 | + <h:column> | |
74 | + <f:facet name="header">user name</f:facet> | |
75 | + #{_chat.uname} | |
76 | + </h:column> | |
77 | + <h:column> | |
78 | + <f:facet name="header">msg</f:facet> | |
79 | + #{_chat.msg} | |
80 | + </h:column> | |
81 | + <h:column> | |
82 | + <f:facet name="header">date</f:facet> | |
83 | + #{_chat.date} | |
84 | + </h:column> | |
85 | + </h:dataTable> | |
86 | + | |
87 | + </ui:define> | |
88 | +</ui:composition> |