我需要在Firebase中存储像“áčšěž”这样的多字节字符串。当我使用Javascript API时 - 它的工作原理和字符串“áčšěž”在Firebase中。但是当我在Java ref.setValue("áčšěž");
中尝试它时它不起作用。没有错误消息,但Firebase将我的客户端设置为已断开连接,但未触发方法onDisconnect。
我的servlet代码是:
@SuppressWarnings("serial")
@WebServlet(urlPatterns = {"/server/*", "/set/*"})
public class FbServlet extends HttpServlet {
private final Firebase ref = new Firebase(FbRef.refD + "xx");
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
ref.child("first").setValue("work"); //this is the first time okey
ref.child("nowork").setValue("áčšěž"); //this do not work and after this command firebase do not work
ref.child("last").setValue("dontwork"); //this do not work
}
}
我在WildFly 8和Tomcat 7.0.41上尝试。我使用的是JDK 1.7,maven和Windows XP。
然后我尝试推送到Openshift(WildFly 8)并且它可以工作,但是写了“?????”。 :(
所以我的问题是,是否有办法如何做到这一点? (逃避字符串,或类似的东西)
日志:
17:00:16,375 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] ViewManager: Raising events for /.info/authenticated
17:00:16,375 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] ViewManager: Doing onDiff with changes: []
17:00:16,375 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] ViewManager: Marking queries complete for /.info/authenticated
17:00:16,375 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] ViewManager: Marking queries complete for /.info/authenticated
17:00:16,375 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] ViewManager: Marking queryMap complete:null
17:00:16,375 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] ViewManager: Marking queries complete for /.info/authenticated
17:00:16,375 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] ViewManager: Marking queryMap complete:null
17:00:16,375 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] ViewManager: Raising events for /.info/connected
17:00:16,375 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] ViewManager: Doing onDiff with changes: []
17:00:16,375 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] ViewManager: Marking queries complete for /.info/connected
17:00:16,375 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] ViewManager: Marking queries complete for /.info/connected
17:00:16,375 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] ViewManager: Marking queryMap complete:null
17:00:16,375 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] ViewManager: Marking queries complete for /.info/connected
17:00:16,375 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] ViewManager: Marking queryMap complete:null
17:00:16,390 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] Connection: conn_0 - Opening a connection
17:00:16,390 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] RepoOperation: set: /data/xx/first
17:00:16,390 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] DataOperation: set: /data/xx/first com.firebase.client.snapshot.StringNode@1a
565fb
17:00:16,390 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] Transaction: Aborting transactions for path: /data/xx/first. Affected: /data/
xx/first
17:00:16,390 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] ViewManager: Raising events for /data/xx/first
17:00:16,390 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] ViewManager: Marking queries complete for /data/xx/first
17:00:16,390 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] ViewManager: Marking queryMap complete:null
17:00:16,390 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] RepoOperation: set: /data/xx/nowork
17:00:16,390 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] DataOperation: set: /data/xx/nowork com.firebase.client.snapshot.StringNode@6
7ab84
17:00:16,390 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] Transaction: Aborting transactions for path: /data/xx/nowork. Affected: /data
/xx/nowork
17:00:16,390 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] ViewManager: Raising events for /data/xx/nowork
17:00:16,390 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] ViewManager: Marking queries complete for /data/xx/nowork
17:00:16,390 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] ViewManager: Marking queryMap complete:null
17:00:16,390 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] RepoOperation: set: /data/xx/last
17:00:16,406 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] DataOperation: set: /data/xx/last com.firebase.client.snapshot.StringNode@2d8
40a
17:00:16,406 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] Transaction: Aborting transactions for path: /data/xx/last. Affected: /data/x
x/last
17:00:16,406 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] ViewManager: Raising events for /data/xx/last
17:00:16,406 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] ViewManager: Marking queries complete for /data/xx/last
17:00:16,406 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] ViewManager: Marking queryMap complete:null
17:00:16,406 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] Connection: conn_0 - closing realtime connection
17:00:16,406 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] WebSocket: ws_0 - websocket is being closed
17:00:16,421 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] PersistentConnection: pc_0 - Got on disconnect
17:00:16,421 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] ViewManager: Raising events for /.info/connected
17:00:16,421 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] ViewManager: Marking queries complete for /.info/connected
17:00:16,421 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:16 CEST 2014 [DEBU
G] ViewManager: Marking queryMap complete:null
17:00:17,937 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:17 CEST 2014 [DEBU
G] WebSocket: ws_0 - websocket opened
17:00:17,937 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:17 CEST 2014 [DEBU
G] WebSocket: ws_0 - Reset keepAlive
17:00:17,937 INFO [stdout] (TubeSockReader-1) Wed May 21 17:00:17 CEST 2014 [DE
BUG] WebSocket: ws_0 - ws message: {"d":{"t":"r","d":"s-dal5-nss-23.firebaseio.c
om"},"t":"c"}
17:00:17,937 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:17 CEST 2014 [DEBU
G] WebSocket: ws_0 - Reset keepAlive. Remaining: 44999
17:00:17,953 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:17 CEST 2014 [DEBU
G] WebSocket: ws_0 - HandleNewFrameCount: 1
17:00:17,953 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:17 CEST 2014 [DEBU
G] WebSocket: ws_0 - handleIncomingFrame complete frame: {d={t=r, d=s-dal5-nss-2
3.firebaseio.com}, t=c}
17:00:17,953 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:17 CEST 2014 [DEBU
G] Connection: conn_0 - Got control message: {t=r, d=s-dal5-nss-23.firebaseio.co
m}
17:00:17,953 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:17 CEST 2014 [DEBU
G] Connection: conn_0 - Got a reset; killing connection to ttdmmoq.firebaseio.co
m; instead connecting to s-dal5-nss-23.firebaseio.com
17:00:17,953 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:17 CEST 2014 [DEBU
G] WebSocket: ws_0 - had an error: com.firebase.tubesock.WebSocketException: IO
Error
17:00:17,953 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:17 CEST 2014 [DEBU
G] WebSocket: ws_0 - |IO Error|
17:00:17,953 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:17 CEST 2014 [DEBU
G] WebSocket: ws_0 - closed
17:00:17,953 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:17 CEST 2014 [DEBU
G] WebSocket: ws_0 - had an error: com.firebase.tubesock.WebSocketException: IO
Exception
17:00:17,953 INFO [stdout] (FirebaseWorker) Wed May 21 17:00:17 CEST 2014 [DEBU
G] WebSocket: ws_0 - |IO Exception|