Cookies Java ME中的解码响应(诺基亚Asha)
我正在实现小型javame应用程序。此应用程序从第三方资源获取一些数据,需要在验证之前进行验证。我第一次调用获取cookies很简单,第二次调用此cookies获取数据。我在谷歌上搜索了一下怎么做,找到了下一个解决方案- 出于我的目的,我已将此代码更改为next:Cookies Java ME中的解码响应(诺基亚Asha),cookies,java-me,httpconnection,connector,Cookies,Java Me,Httpconnection,Connector,我正在实现小型javame应用程序。此应用程序从第三方资源获取一些数据,需要在验证之前进行验证。我第一次调用获取cookies很简单,第二次调用此cookies获取数据。我在谷歌上搜索了一下怎么做,找到了下一个解决方案- 出于我的目的,我已将此代码更改为next: public void getData(String url,String cookie) { HttpConnection hpc = null; InputStream is = null; try {
public void getData(String url,String cookie) {
HttpConnection hpc = null;
InputStream is = null;
try {
hpc = (HttpConnection) Connector.open(url);
hpc.setRequestProperty("cookie", cookie);
hpc.setRequestProperty("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
hpc.setRequestProperty("Accept-Encoding", "gzip, deflate");
hpc.setRequestProperty("Accept-Language", "en-US,en;q=0.5");
is = hpc.openInputStream();
int length = (int) hpc.getLength();
byte[] response = new byte[length];
is.read(response);
String strResponse = new String(response);
} catch (Exception e) {
System.out.println(e.getMessage() + " " + e.toString());
} finally {
try {
if (is != null)
is.close();
if (hpc != null)
hpc.close();
} catch (Exception e) {}
}
}
我想去下一个
??ÑÁNÃ0à;O±(²§M}A-?@
.?PYS¨Ôe¥Í@\üìde??XÊo}Vâ]hk?6ëµóA|µvÞz'Íà?wAúêmw4í0?ÐÆ?ÚMW=?òêz CÛUa:6Ö7¼T?<oF?nh6[_0?l4?äê&)?çó³?ÅÕúf¨ä(.? ªDÙ??§?ÊP+??(:?Á,Si¾ïA¥ã-jJÅÄ8ÊbBçL)gs.S.þG5ÌÀÆéX}CÁíÑ-þ?BDK`²?\¶?ó3I÷ô±e]°6¬c?q?Ó?¼?Y.¯??Y?%?ÏP1è?ìw;?È Ò??e
|ôh0?
我怎么能破译这个?我真蠢。我没有考虑下一个代码:hpc.setRequestPropertyAccept-Encoding,gzip,deflate;我得到了ZIP响应的编码,所有我需要的东西都被解码了