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?