diff --git a/src/main/java/io/sinistral/proteus/ProteusApplication.java b/src/main/java/io/sinistral/proteus/ProteusApplication.java index 4291776..f844fe3 100644 --- a/src/main/java/io/sinistral/proteus/ProteusApplication.java +++ b/src/main/java/io/sinistral/proteus/ProteusApplication.java @@ -381,37 +381,51 @@ public void printStatus() StringBuilder sb = new StringBuilder(); - sb.append("\n\nUsing global headers: \n\n"); - sb.append(globalHeadersParameters.entrySet().stream().map(e -> "\t" + e.getKey() + " = " + e.getValue()).collect(Collectors.joining("\n"))); - sb.append("\n\nRegistered endpoints: \n\n"); + sb.append("\nUsing global headers: \n"); - List tableHeaders = Arrays.asList("Method","Path","Consumes","Produces","Controller"); + List tableHeaders = Arrays.asList("Header","Value"); - List> tableRows = this.registeredEndpoints.stream().sorted().map( e -> { + List> tableRows = globalHeadersParameters.entrySet().stream().map( e -> { + + return Arrays.asList( e.getKey(), e.getValue() ); + + }).collect(Collectors.toList()); + + TablePrinter printer = new TablePrinter(tableHeaders, tableRows); + + sb.append(printer.toString()); + + sb.append("\nRegistered endpoints: \n"); + + tableHeaders = Arrays.asList("Method","Path","Consumes","Produces","Controller"); + + tableRows = this.registeredEndpoints.stream().sorted().map( e -> { return Arrays.asList( e.getMethod().toString(), e.getPathTemplate(), String.format("[%s]", e.getConsumes()), String.format("[%s]", e.getProduces()), String.format("(%s.%s)", e.getControllerName() , e.getControllerMethod() ) ); }).collect(Collectors.toList()); - TablePrinter printer = new TablePrinter(tableHeaders, tableRows); + printer = new TablePrinter(tableHeaders, tableRows); sb.append(printer.toString()); - sb.append("\n\nRegistered services: \n\n"); + sb.append("\nRegistered services: \n"); ImmutableMultimap serviceStateMap = this.serviceManager.servicesByState(); - String serviceStrings = serviceStateMap.asMap().entrySet().stream().sorted().flatMap(e -> { + tableHeaders = Arrays.asList("Service","State"); + + tableRows = serviceStateMap.asMap().entrySet().stream().flatMap(e -> { return e.getValue().stream().map(s -> { - return "\t" + s.getClass().getSimpleName() + "\t" + e.getKey(); + return Arrays.asList(s.getClass().getSimpleName() , e.getKey().toString() ); }); - }).collect(Collectors.joining("\n")); - - sb.append(serviceStrings); + }).collect(Collectors.toList()); - sb.append("\n"); + printer = new TablePrinter(tableHeaders, tableRows); + + sb.append(printer.toString()); sb.append("\nListening on: " + this.ports);