All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.nepxion.discovery.common.handler.RestErrorHandler Maven / Gradle / Ivy

Go to download

Nepxion Discovery is a solution for Spring Cloud with blue green, gray, weight, limitation, circuit breaker, degrade, isolation, monitor, tracing, dye, failover, async agent

There is a newer version: 6.22.0
Show newest version
package com.nepxion.discovery.common.handler;

/**
 * 

Title: Nepxion Discovery

*

Description: Nepxion Discovery

*

Copyright: Copyright (c) 2017-2050

*

Company: Nepxion

* @author Haojun Ren * @version 1.0 */ import java.io.IOException; import java.io.InputStream; import org.apache.commons.io.IOUtils; import org.springframework.http.client.ClientHttpResponse; import org.springframework.web.client.DefaultResponseErrorHandler; import com.nepxion.discovery.common.constant.DiscoveryConstant; public class RestErrorHandler extends DefaultResponseErrorHandler { private String cause; @Override public void handleError(ClientHttpResponse response) throws IOException { // 这里绝对不能关闭InputStream InputStream inputStream = response.getBody(); cause = IOUtils.toString(inputStream, DiscoveryConstant.ENCODING_UTF_8); } public String getCause() { return cause; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy