diff --git a/rxlib/src/main/java/org/rx/spring/MxController.java b/rxlib/src/main/java/org/rx/spring/MxController.java index fa53c4ef..a6b95f05 100644 --- a/rxlib/src/main/java/org/rx/spring/MxController.java +++ b/rxlib/src/main/java/org/rx/spring/MxController.java @@ -15,6 +15,7 @@ import org.rx.io.IOStream; import org.rx.net.NetEventWait; import org.rx.net.Sockets; +import org.rx.net.http.HttpClient; import org.rx.net.socks.SocksContext; import org.rx.util.BeanMapFlag; import org.rx.util.BeanMapper; @@ -28,6 +29,7 @@ import javax.annotation.PostConstruct; import javax.servlet.ServletInputStream; import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import java.lang.management.ManagementFactory; import java.lang.reflect.Method; import java.net.InetAddress; @@ -138,15 +140,19 @@ public Object health(HttpServletRequest request) { } } - // @PostMapping("directOffer") -// public void directOffer(String appName, String socksId, String endpoint, MultipartFile binary) { -// SendPack pack = new SendPack(appName, socksId, Sockets.parseEndpoint(endpoint)); -// pack.setBinary(binary); -// server.frontendOffer(pack); -// } -// + @RequestMapping("health/p") + public void healthP(HttpServletRequest request, HttpServletResponse response) { + String fu = request.getParameter("fu"); + Integer tm = Reflects.convertQuietly(request.getParameter("tm"), Integer.class); + HttpClient client = new HttpClient(); + if (tm != null) { + client.withTimeoutMillis(tm); + } + client.forward(request, response, fu); + } + // @SneakyThrows -// @PostMapping("directPoll") +// @PostMapping("directPoll/Offer") // public void directPoll(String appName, String socksId, String endpoint, HttpServletResponse response) { // ReceivePack pack = server.frontendPoll(new SendPack(appName, socksId, Sockets.parseEndpoint(endpoint))); // ServletOutputStream out = response.getOutputStream();