docs:optimize tsf example. (#1711)

pull/1716/head
Haotian Zhang 3 weeks ago committed by GitHub
parent 88a9214c3c
commit f3d5ded24d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -21,4 +21,5 @@
- [feat: support config event and monitor address list.](https://github.com/Tencent/spring-cloud-tencent/pull/1692)
- [feat:Modify the annotations.](https://github.com/Tencent/spring-cloud-tencent/pull/1693)
- [fix: polaris.discovery.heartbeat.enabled not effective.](https://github.com/Tencent/spring-cloud-tencent/pull/1694)
- [feat: support config ratelimit addresses and remote task interval.](https://github.com/Tencent/spring-cloud-tencent/pull/1679)
- [feat: support config ratelimit addresses and remote task interval.](https://github.com/Tencent/spring-cloud-tencent/pull/1695)
- [docs:optimize tsf example.](https://github.com/Tencent/spring-cloud-tencent/pull/1711)

@ -21,6 +21,8 @@ import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import com.tencent.cloud.tsf.demo.provider.config.ProviderNameConfig;
import com.tencent.cloud.tsf.demo.provider.entity.User;
@ -119,8 +121,11 @@ public class ProviderController {
responseBody = "mock 5xx return.";
break;
default:
LOG.info("provider-demo -- request param: [" + param + "]");
responseBody = String.format("from host-ip: %s, request param: %s, response from %s",
getInet4Address(), param, providerNameConfig.getName());
LOG.info("provider-demo -- provider config name: [" + providerNameConfig.getName() + ']');
LOG.info("provider-demo -- response info: [" + responseBody + "]");
status = HttpServletResponse.SC_OK;
break;
}
@ -170,4 +175,23 @@ public class ProviderController {
LOG.info(response);
return response;
}
/**
*
* token = provider-demo
*
* @param token
* @return
*/
@RequestMapping(value = "/checkToken", method = RequestMethod.GET)
public Map<String, Object> checkToken(@RequestParam String token) {
LOG.info("provider-demo -- request param: [" + token + "]");
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("result", "provider-demo".equalsIgnoreCase(token));
resultMap.put("payload", "this is payload");
LOG.info("provider-demo -- response info: [" + resultMap + "]");
return resultMap;
}
}

Loading…
Cancel
Save