• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

moto web application


Commit MetaInfo

修訂ea9e2d0c5c30b75af2e93606fa1451bdbe16f25b (tree)
時間2014-02-05 17:30:06
作者astoria-d <astoria-d@mail...>
Commiterastoria-d

Log Message

push utf-8 charecter supported

Change Summary

差異

--- a/WEB-INF/classes/motoSample/AtmosRes.java
+++ b/WEB-INF/classes/motoSample/AtmosRes.java
@@ -3,10 +3,12 @@ package motoSample;
33 import org.atmosphere.config.service.Disconnect;
44 import org.atmosphere.config.service.ManagedService;
55 import org.atmosphere.config.service.Ready;
6+import org.atmosphere.config.service.Get;
67 import org.atmosphere.cpr.AtmosphereResource;
78 import org.atmosphere.cpr.AtmosphereResourceEvent;
89 import org.slf4j.Logger;
910 import org.slf4j.LoggerFactory;
11+import javax.servlet.http.HttpServletResponse;
1012
1113 import static org.atmosphere.cpr.ApplicationConfig.MAX_INACTIVE;
1214
@@ -25,6 +27,15 @@ public class AtmosRes {
2527 logger.info("Browser {} connected.", r.uuid());
2628 }
2729
30+ @Get
31+ public void onGet(final AtmosphereResource r) {
32+ logger.info("Browser Get from {}", r.uuid());
33+ //set character encoding...
34+ HttpServletResponse response = r.getResponse();
35+ response.setCharacterEncoding("UTF-8");
36+ //response.setContentType("application/json;charset=UTF-8");
37+ }
38+
2839 /**
2940 * Invoked when the client disconnect or when an unexpected closing of the underlying connection happens.
3041 *
--- a/WEB-INF/classes/motoSample/ChatBean.java
+++ b/WEB-INF/classes/motoSample/ChatBean.java
@@ -183,7 +183,7 @@ public class ChatBean implements Serializable {
183183
184184 //in order to update the display, notify the message to the other chat users (including myself.).
185185 PushMsg pm = PushMsg.newChatMessage();
186- PushMsg.ChatMessage cm = pm.getChatMessage();
186+ ChatMessage cm = pm.getChatMessage();
187187 cm.setMsg(msg);
188188 cm.setDate(dt);
189189 cm.setUname(userBean.getUid());
--- a/WEB-INF/classes/motoSample/PushMsg.java
+++ b/WEB-INF/classes/motoSample/PushMsg.java
@@ -1,5 +1,6 @@
11 package motoSample;
22
3+import motoSample.ChatBean.ChatMessage;
34
45 public class PushMsg {
56
@@ -13,19 +14,6 @@ public class PushMsg {
1314 public boolean getLogin() { return login; }
1415 }
1516
16- public static class ChatMessage {
17- private String uname;
18- private String msg;
19- private String date;
20-
21- public String getUname() { return uname; }
22- public String getMsg() { return msg; }
23- public String getDate() { return date; }
24- public void setUname(String uname) { this.uname = uname; }
25- public void setMsg(String msg) { this.msg = msg; }
26- public void setDate(String date) { this.date = date; }
27- }
28-
2917 private String pushType;
3018 private LoginUser lu;
3119 private ChatMessage cm;