1、修改获取临时token日志
This commit is contained in:
@ -125,7 +125,7 @@ public class FeignConfig implements RequestInterceptor {
|
|||||||
public String getAccessToken () {
|
public String getAccessToken () {
|
||||||
StringBuffer strBf = new StringBuffer();
|
StringBuffer strBf = new StringBuffer();
|
||||||
try {
|
try {
|
||||||
log.info("token=======access_token===clientHttpUrl==="+clientHttpUrl);
|
log.debug("token=======access_token===clientHttpUrl==="+clientHttpUrl);
|
||||||
URL realUrl = new URL(clientHttpUrl);
|
URL realUrl = new URL(clientHttpUrl);
|
||||||
//将realUrl以 open方法返回的urlConnection 连接强转为HttpURLConnection连接 (标识一个url所引用的远程对象连接)
|
//将realUrl以 open方法返回的urlConnection 连接强转为HttpURLConnection连接 (标识一个url所引用的远程对象连接)
|
||||||
// 此时cnnection只是为一个连接对象,待连接中
|
// 此时cnnection只是为一个连接对象,待连接中
|
||||||
@ -143,16 +143,16 @@ public class FeignConfig implements RequestInterceptor {
|
|||||||
//设置请求头里面的各个属性 (以下为设置内容的类型,设置为经过urlEncoded编码过的from参数)
|
//设置请求头里面的各个属性 (以下为设置内容的类型,设置为经过urlEncoded编码过的from参数)
|
||||||
connection.setRequestProperty("Content-Type", "application/json;charset=utf-8");
|
connection.setRequestProperty("Content-Type", "application/json;charset=utf-8");
|
||||||
//建立连接 (请求未开始,直到connection.getInputStream()方法调用时才发起,以上各个参数设置需在此方法之前进行)
|
//建立连接 (请求未开始,直到connection.getInputStream()方法调用时才发起,以上各个参数设置需在此方法之前进行)
|
||||||
log.info("token=======access_token===建立连接===");
|
log.debug("token=======access_token===建立连接===");
|
||||||
connection.connect();
|
connection.connect();
|
||||||
log.info("token=======access_token===创建输入输===");
|
log.debug("token=======access_token===创建输入输===");
|
||||||
//创建输入输出流,用于往连接里面输出携带的参数,(输出内容为?后面的内容)
|
//创建输入输出流,用于往连接里面输出携带的参数,(输出内容为?后面的内容)
|
||||||
DataOutputStream dataout = new DataOutputStream(connection.getOutputStream());
|
DataOutputStream dataout = new DataOutputStream(connection.getOutputStream());
|
||||||
// //将参数输出到连接
|
// //将参数输出到连接
|
||||||
// 输出完成后刷新并关闭流
|
// 输出完成后刷新并关闭流
|
||||||
dataout.flush();
|
dataout.flush();
|
||||||
dataout.close(); // 重要且易忽略步骤 (关闭流,切记!)
|
dataout.close(); // 重要且易忽略步骤 (关闭流,切记!)
|
||||||
log.info("token=======access_token===reader===");
|
log.debug("token=======access_token===reader===");
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8));
|
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8));
|
||||||
String lines;
|
String lines;
|
||||||
while ((lines = reader.readLine()) != null) {
|
while ((lines = reader.readLine()) != null) {
|
||||||
@ -161,11 +161,11 @@ public class FeignConfig implements RequestInterceptor {
|
|||||||
}
|
}
|
||||||
reader.close();
|
reader.close();
|
||||||
connection.disconnect();
|
connection.disconnect();
|
||||||
log.info("toke返回数据:---------------------- "+strBf.toString());
|
log.debug("toke返回数据:---------------------- "+strBf.toString());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.info("toke返回数据:----------------------失败 "+e.getMessage());
|
log.info("toke返回数据:----------------------失败 "+e.getMessage());
|
||||||
}
|
}
|
||||||
log.info("toke返回数据:----------strBf------------ "+strBf.toString());
|
log.debug("toke返回数据:----------strBf------------ "+strBf.toString());
|
||||||
JSONObject json= JSON.parseObject(strBf.toString());
|
JSONObject json= JSON.parseObject(strBf.toString());
|
||||||
if((boolean)json.get("success")){
|
if((boolean)json.get("success")){
|
||||||
return ((JSONObject)json.get("data")).get("value").toString();
|
return ((JSONObject)json.get("data")).get("value").toString();
|
||||||
|
Reference in New Issue
Block a user