\/\*.*\*\/
to replace any */ in /*
quote
/* */ public static String requestPost(String params, HttpURLConnection httpConn, String encode)
/* */ throws Exception
/* */ {
/* 161 */ String result = "";
/* 162 */ OutputStream output = null;
/* 163 */ OutputStreamWriter writer = null;
/* 164 */ InputStream input = null;
/* 165 */ InputStreamReader iReader = null;
/* 166 */ BufferedReader bReader = null;
/* 167 */ StringBuffer rBuffer = new StringBuffer();
/* 168 */ String line = null;
/* 169 */ logger.debug("请求地址:" + httpConn.getURL().getPath());
/* 170 */ logger.debug("请求参数:" + params);
/* */ try {
/* 172 */ output = httpConn.getOutputStream();
/* 173 */ writer = new OutputStreamWriter(output);
/* 174 */ writer.write(params);
/* 175 */ writer.flush();
/* 176 */ input = httpConn.getInputStream();
/* 177 */ iReader = new InputStreamReader(input, encode);
/* 178 */ bReader = new BufferedReader(iReader);
/* 179 */ while ((line = bReader.readLine()) != null) {
/* 180 */ rBuffer.append(line);
/* */ }
/* 182 */ result = rBuffer.toString();
/* 183 */ logger.debug("请求结果:" + result);
/* 184 */ return result;
/* */ } catch (Exception e) {
/* 186 */ logger.error(e.getMessage(), e);
/* 187 */ return "";
/* */ } finally {
/* 189 */ if (output != null) output.close();
/* 190 */ if (writer != null) writer.close();
/* 191 */ if (input != null) input.close();
/* 192 */ if (iReader != null) iReader.close();
/* 193 */ if (bReader != null) bReader.close();
/* 194 */ httpConn.disconnect();
/* */ }
/* */ }
quote
public static String requestPost(String params, HttpURLConnection httpConn, String encode)
throws Exception
{
String result = "";
OutputStream output = null;
OutputStreamWriter writer = null;
InputStream input = null;
InputStreamReader iReader = null;
BufferedReader bReader = null;
StringBuffer rBuffer = new StringBuffer();
String line = null;
logger.debug("请求地址:" + httpConn.getURL().getPath());
logger.debug("请求参数:" + params);
try {
output = httpConn.getOutputStream();
writer = new OutputStreamWriter(output);
writer.write(params);
writer.flush();
input = httpConn.getInputStream();
iReader = new InputStreamReader(input, encode);
bReader = new BufferedReader(iReader);
while ((line = bReader.readLine()) != null) {
rBuffer.append(line);
}
result = rBuffer.toString();
logger.debug("请求结果:" + result);
return result;
} catch (Exception e) {
logger.error(e.getMessage(), e);
return "";
} finally {
if (output != null) output.close();
if (writer != null) writer.close();
if (input != null) input.close();
if (iReader != null) iReader.close();
if (bReader != null) bReader.close();
httpConn.disconnect();
}
}