@@ -156,7 +156,7 @@ public void handle(final HttpServletRequest request, final HttpServletResponse r
156156 // TODO: move me to an error handler feature
157157 Map <String , Object > model = errorModel (req , ex , status );
158158 try {
159- res
159+ res . format ()
160160 .when (MediaType .html , () -> Viewable .of ("/status/" + status .value (), model ))
161161 .when (MediaType .all , () -> model )
162162 .send ();
@@ -401,26 +401,23 @@ private HttpException handle406or415(final String verb, final String path,
401401 @ Override
402402 public String toString () {
403403 StringBuilder buffer = new StringBuilder ();
404- int routeMax = 0 , consumesMax = 0 , producesMax = 0 ;
405- for (RouteDefinition routeDefinition : routeDefs ) {
406- int routeLen = routeDefinition .pattern ().toString ().length ();
407- if (routeLen > routeMax ) {
408- routeMax = routeLen ;
409- }
410- //
411- int consumeLen = routeDefinition .consumes ().toString ().length ();
412- if (consumeLen > consumesMax ) {
413- consumesMax = consumeLen ;
414- }
415- int producesLen = routeDefinition .produces ().toString ().length ();
416- if (producesLen > producesMax ) {
417- producesMax = producesLen ;
418- }
404+ int verbMax = 0 , routeMax = 0 , consumesMax = 0 , producesMax = 0 ;
405+ for (RouteDefinition routeDef : routeDefs ) {
406+ verbMax = Math .max (verbMax , routeDef .verb ().length ());
407+
408+ routeMax = Math .max (routeMax , routeDef .pattern ().length ());
409+
410+ consumesMax = Math .max (consumesMax , routeDef .consumes ().toString ().length ());
411+
412+ producesMax = Math .max (producesMax , routeDef .produces ().toString ().length ());
419413 }
420- String format = " %-" + routeMax + "s %" + consumesMax + "s %" + producesMax + "s\n " ;
421- for (RouteDefinition routeDefinition : routeDefs ) {
422- buffer .append (String .format (format , routeDefinition .pattern (), routeDefinition .consumes (),
423- routeDefinition .produces ()));
414+
415+ String format = " %-" + verbMax + "s %-" + routeMax + "s %" + consumesMax + "s %"
416+ + producesMax + "s (%s)\n " ;
417+
418+ for (RouteDefinition routeDef : routeDefs ) {
419+ buffer .append (String .format (format , routeDef .verb (), routeDef .pattern (),
420+ routeDef .consumes (), routeDef .produces (), routeDef .name ()));
424421 }
425422 return buffer .toString ();
426423 }
0 commit comments