-1
我正在使用smack庫從我的android應用程序接收消息到服務器。 下面是我的代碼:如何從smack庫的packetlistener中調用java servlet的doGet方法?
String username=this.GCM_SENDER_ID+"@gcm.googleapis.com";
String password=this.GCM_SERVER_KEY;
config = new ConnectionConfiguration(GCM_SERVER, GCM_PORT);
config.setSecurityMode(SecurityMode.enabled);
config.setReconnectionAllowed(true);
config.setRosterLoadedAtLogin(false);
config.setSendPresence(false);
config.setSocketFactory(SSLSocketFactory.getDefault());
config.setDebuggerEnabled(false);
connection=new XMPPTCPConnection(config);
connection.connect();
connection.addConnectionListener(new AppConnectionListener());
connection.addPacketListener(new AppPacketListener(),new PacketTypeFilter(Message.class));
connection.addPacketInterceptor(new AppPacketInterceptor(), new PacketTypeFilter(Message.class));
connection.login(username, password);
現在,當有新郵件在服務器接收,AppPacketListener被調用。 我想要的是調用一個java servlet的doGet方法或發送一個get請求到其他jsp頁面。 我該怎麼做?有小費嗎?