[英]How to make a partial proxy using Spring Boot
The goal is to create a mock server for testing the Rest. 目的是创建一个用于测试其余服务器的模拟服务器。 I created the controller, made the mapping, and entities.
我创建了控制器,进行了映射,并创建了实体。
@RestController
public class GreetingController {
private static final String template = "Hello, %s!";
private final AtomicLong counter = new AtomicLong();
@RequestMapping("/greeting")
public GreetingResponse greeting(@RequestParam(value="name", defaultValue="World")
String name) {
return new GreetingResponse(counter.incrementAndGet(),
String.format(template, name));
}
}
How can I make a proxy so that all requests that are not equal to "/greeting"
are passed to the other server unchanged and the response that the client would receive through our application? 我该如何做一个代理,以便所有不等于
"/greeting"
请求都"/greeting"
传递到另一台服务器,以及客户端将通过我们的应用程序收到的响应?
Maybe response.sendRedirect? 也许response.sendRedirect? Or so
或者
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.