From 45017ec914c5286e63825000e4f68264e7a9c6bb Mon Sep 17 00:00:00 2001 From: Alex Black Date: Thu, 5 Sep 2019 17:55:52 +1000 Subject: [PATCH] Fixes for remote UI (#242) Signed-off-by: AlexDBlack --- .../ui/module/remote/RemoteReceiverModule.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/deeplearning4j/deeplearning4j-ui-parent/deeplearning4j-play/src/main/java/org/deeplearning4j/ui/module/remote/RemoteReceiverModule.java b/deeplearning4j/deeplearning4j-ui-parent/deeplearning4j-play/src/main/java/org/deeplearning4j/ui/module/remote/RemoteReceiverModule.java index 4230d16cf..4709b89ba 100644 --- a/deeplearning4j/deeplearning4j-ui-parent/deeplearning4j-play/src/main/java/org/deeplearning4j/ui/module/remote/RemoteReceiverModule.java +++ b/deeplearning4j/deeplearning4j-ui-parent/deeplearning4j-play/src/main/java/org/deeplearning4j/ui/module/remote/RemoteReceiverModule.java @@ -19,23 +19,20 @@ package org.deeplearning4j.ui.module.remote; import com.fasterxml.jackson.databind.JsonNode; import lombok.extern.slf4j.Slf4j; import org.deeplearning4j.api.storage.*; -import org.deeplearning4j.ui.api.FunctionType; import org.deeplearning4j.ui.api.HttpMethod; import org.deeplearning4j.ui.api.Route; import org.deeplearning4j.ui.api.UIModule; import org.deeplearning4j.ui.i18n.I18NResource; +import play.mvc.Http; import play.mvc.Result; import play.mvc.Results; import javax.xml.bind.DatatypeConverter; -import java.io.File; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; -import static play.mvc.Http.Context.Implicit.request; - /** * * Used to receive UI updates remotely. @@ -73,7 +70,7 @@ public class RemoteReceiverModule implements UIModule { @Override public List getRoutes() { - Route r = new Route("/remoteReceive", HttpMethod.POST, FunctionType.Supplier, this::receiveData); + Route r = Route.request0Function("/remoteReceive", HttpMethod.POST, this::receiveData); return Collections.singletonList(r); } @@ -98,7 +95,7 @@ public class RemoteReceiverModule implements UIModule { return Collections.emptyList(); } - private Result receiveData() { + private Result receiveData(Http.Request request) { if (!enabled.get()) { return Results.forbidden( "UI server remote listening is currently disabled. Use UIServer.getInstance().enableRemoteListener()"); @@ -109,7 +106,7 @@ public class RemoteReceiverModule implements UIModule { "UI Server remote listener: no StatsStorage instance is set/available to store results"); } - JsonNode jn = request().body().asJson(); + JsonNode jn = request.body().asJson(); JsonNode type = jn.get("type"); JsonNode dataClass = jn.get("class"); JsonNode data = jn.get("data");