| | |
| | | |
| | | public class HttpClient { |
| | | private static final String TAG=HttpClient.class.getSimpleName(); |
| | | |
| | | private static boolean showErrorInfo = false; |
| | | |
| | | public static void SetShowErrorInfo(boolean isShow){ |
| | | showErrorInfo = isShow; |
| | | } |
| | | |
| | | /** |
| | | * post |
| | | * |
| | |
| | | * @return |
| | | */ |
| | | public static String post(String urlStr, String paramStr, String contentType, String debugTag,int timeOut) throws IOException { |
| | | LogUtil.debugLog(TAG,urlStr+"..."+paramStr); |
| | | LogUtil.debugLog(TAG,urlStr+"..debuglogHdlkaede.."+paramStr); |
| | | HttpsURLConnection conn = null; |
| | | String resultData = ""; |
| | | OutputStream outputStream = null; |
| | |
| | | baos.flush(); |
| | | if (debugTag != null) |
| | | LogUtil.debugLog(debugTag, "request data " + resultData); |
| | | } else |
| | | throw new IOException(String.format("http_get failed: status=%d", responseCode)); |
| | | } else { |
| | | if(showErrorInfo) { |
| | | throw new IOException(String.format("http_get failed: status=%d : url=%d", responseCode,urlStr)); |
| | | } |
| | | } |
| | | } catch (IOException e) { |
| | | throw e; |
| | | } catch (Throwable e) { |