@Override public EchoResponse execute(EchoRequest echoRequest, CommandContext context) { String reply = String.format("WildFly Monitor Agent Echo: [%s]", echoRequest.getEchoMessage()); // return the response EchoResponse echoResponse = new EchoResponse(); echoResponse.setReply(reply); return echoResponse; }
@Override public EchoResponse execute( EchoRequest echoRequest, BinaryData binaryData, CommandContext context) { String echo = String.format("ECHO [%s]", echoRequest.getEchoMessage()); StringBuilder extra = new StringBuilder(); if (binaryData != null) { try (Scanner scanner = new Scanner(binaryData, "UTF-8")) { scanner.useDelimiter("\\A"); extra.append(scanner.next()); } catch (NoSuchElementException nsee) { } } // return the response EchoResponse echoResponse = new EchoResponse(); echoResponse.setReply(echo + extra.toString()); return echoResponse; }