public NetResponse pullCookies(String strUrl, String strBody, IRhoSession oSession) throws Exception { Hashtable headers = new Hashtable(); m_bIgnoreSuffixOnSim = false; m_bCancel = false; NetResponse resp = doRequest /*Try*/("POST", strUrl, strBody, oSession, headers); if (resp.isOK()) { resp.setCharData(resp.getCookies()); LOG.INFO("pullCookies: " + resp.getCharData()); } return resp; }
public NetResponse pullFile( String strUrl, String strFileName, IRhoSession oSession, Hashtable headers) throws Exception { IRAFile file = null; NetResponse resp = null; m_nMaxPacketSize = RhoClassFactory.getNetworkAccess().getMaxPacketSize(); m_bFlushFileAfterWrite = RhoConf.getInstance().getBool("use_persistent_storage"); m_bCancel = false; try { if (!strFileName.startsWith("file:")) { try { strFileName = FilePath.join(RhoClassFactory.createFile().getDirPath(""), strFileName); } catch (IOException x) { LOG.ERROR("getDirPath failed.", x); throw x; } } file = RhoClassFactory.createFSRAFile(); file.open(strFileName, "rw"); file.seek(file.size()); do { resp = pullFile1(strUrl, file, file.size(), oSession, headers); } while (!m_bCancel && (resp == null || resp.isOK()) && m_nCurDownloadSize > 0 && m_nMaxPacketSize > 0); } finally { if (file != null) { file.close(); file = null; } } copyHashtable(m_OutHeaders, headers); return resp != null && !m_bCancel ? resp : makeResponse("", IHttpConnection.HTTP_INTERNAL_ERROR); }
boolean callNotify(SyncNotification oNotify, String strBody) throws Exception { if (getSync().isNoThreadedMode()) { m_strNotifyBody = strBody; return false; } if (oNotify.m_strUrl.length() == 0) return true; NetResponse resp = getNet().pushData(oNotify.m_strUrl, strBody, null); if (!resp.isOK()) LOG.ERROR( "Fire object notification failed. Code: " + resp.getRespCode() + "; Error body: " + resp.getCharData()); else { String szData = resp.getCharData(); return szData != null && szData.equals("stop"); } return false; }
private NetResponse makeResponse(String strRespBody, int nErrorCode) throws Exception { NetResponse pResp = new NetResponse(strRespBody != null ? strRespBody : "", nErrorCode); if (pResp.isOK()) pResp.setCookies(makeClientCookie(m_OutHeaders)); return pResp; }