Commit 7815ba36 authored by Quxl's avatar Quxl

x

parent 9bad7bc7
......@@ -11,10 +11,15 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.alibaba.fastjson.JSON;
public class HttpUtil {
static Log logger = LogFactory.getLog(HttpUtil.class);
public static String get(String requestUrl, Map<String, String> headers) {
HttpURLConnection connection = null;
try {
......@@ -76,6 +81,9 @@ public class HttpUtil {
}
public static String post(String requestUrl, Map<String, Object> parameters, Map<String, String> headers) {
logger.debug(requestUrl);
logger.debug(JSON.toJSONString(parameters));
logger.debug(JSON.toJSONString(headers));
HttpURLConnection connection = null;
try {
String requestBody = toQueryString(parameters);
......@@ -91,7 +99,9 @@ public class HttpUtil {
}
}
connection.connect();
return responseBody(connection);
String result = responseBody(connection);
logger.debug(result);
return result;
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
......@@ -101,6 +111,9 @@ public class HttpUtil {
public static String postRaw(String requestUrl, Map<String, Object> parameters, Map<String, String> headers) {
logger.debug(requestUrl);
logger.debug(JSON.toJSONString(parameters));
logger.debug(JSON.toJSONString(headers));
HttpURLConnection connection = null;
OutputStream os = null;
try {
......@@ -120,7 +133,9 @@ public class HttpUtil {
String rawData = JSON.toJSONString(parameters);
os.write(rawData.getBytes());
os.flush();
return responseBody(connection);
String result = responseBody(connection);
logger.debug(result);
return result;
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
......
......@@ -38,6 +38,8 @@
</root>
</springProfile>
<logger name="com.egolm.sso" level="DEBUG" />
<logger name="com.egolm.sso.config.ExceptionAspect" level="ERROR">
<appender-ref ref="errorAppender" />
</logger>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment