refactoring

This commit is contained in:
rusefi 2020-07-25 02:48:49 -04:00
parent 425149f0a8
commit d08f2a4e0c
1 changed files with 18 additions and 17 deletions

View File

@ -18,6 +18,7 @@ import org.jetbrains.annotations.NotNull;
import org.takes.Take; import org.takes.Take;
import org.takes.facets.fork.FkRegex; import org.takes.facets.fork.FkRegex;
import org.takes.facets.fork.TkFork; import org.takes.facets.fork.TkFork;
import org.takes.http.Front;
import org.takes.http.FtBasic; import org.takes.http.FtBasic;
import org.takes.rs.RsHtml; import org.takes.rs.RsHtml;
import org.takes.rs.RsJson; import org.takes.rs.RsJson;
@ -101,8 +102,7 @@ public class Backend implements Closeable {
try { try {
log.info("Starting http backend on " + httpPort); log.info("Starting http backend on " + httpPort);
try { try {
new FtBasic( Take forkTake = new TkFork(showOnlineControllers,
new TkFork(showOnlineControllers,
showOnlineApplications, showOnlineApplications,
new Monitoring(this).showStatistics, new Monitoring(this).showStatistics,
new FkRegex(ProxyClient.VERSION_PATH, ProxyClient.BACKEND_VERSION), new FkRegex(ProxyClient.VERSION_PATH, ProxyClient.BACKEND_VERSION),
@ -116,8 +116,9 @@ public class Backend implements Closeable {
"<br/><br/><br/><a href='" + ProxyClient.LIST_CONTROLLERS_PATH + "'>Controllers</a>\n" + "<br/><br/><br/><a href='" + ProxyClient.LIST_CONTROLLERS_PATH + "'>Controllers</a>\n" +
"<br/><br/><br/><a href='" + ProxyClient.LIST_APPLICATIONS_PATH + "'>Applications</a>\n" + "<br/><br/><br/><a href='" + ProxyClient.LIST_APPLICATIONS_PATH + "'>Applications</a>\n" +
"</body></html>\n")) "</body></html>\n"))
), httpPort );
).start(() -> isClosed); Front frontEnd = new FtBasic(forkTake, httpPort);
frontEnd.start(() -> isClosed);
} catch (BindException e) { } catch (BindException e) {
throw new IllegalStateException("While binding " + httpPort, e); throw new IllegalStateException("While binding " + httpPort, e);
} }