...
This commit is contained in:
parent
0b654e53f1
commit
889f59c7ae
|
@ -15,6 +15,8 @@ import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.http.HttpEntity;
|
import org.springframework.http.HttpEntity;
|
||||||
|
@ -39,6 +41,7 @@ import java.util.*;
|
||||||
@Api(tags = "网关统计")
|
@Api(tags = "网关统计")
|
||||||
@Log4j2
|
@Log4j2
|
||||||
public class MonitorController {
|
public class MonitorController {
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(MonitorController.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RestTemplate restTemplate;
|
private RestTemplate restTemplate;
|
||||||
|
@ -151,9 +154,20 @@ public class MonitorController {
|
||||||
outputStream.write(buffer, 0, len);
|
outputStream.write(buffer, 0, len);
|
||||||
len = inputStream.read(buffer);
|
len = inputStream.read(buffer);
|
||||||
}
|
}
|
||||||
|
outputStream.close();
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error("网关接口异常", e);
|
||||||
|
response.setStatus(500);
|
||||||
|
try {
|
||||||
|
ServletOutputStream outputStream = response.getOutputStream();
|
||||||
|
outputStream.write("api error".getBytes());
|
||||||
|
outputStream.flush();
|
||||||
|
outputStream.close();
|
||||||
|
} catch (Exception exception) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue