1919import java .util .List ;
2020import java .util .Map ;
2121import java .util .Set ;
22- import java .util .stream .Stream ;
2322
2423/**
2524 * Route contains information about the HTTP method, path pattern, which content types consumes and
@@ -307,7 +306,7 @@ public interface Handler extends Serializable {
307306
308307 private static final Map EMPTY_MAP = Collections .emptyMap ();
309308
310- private Map <String , MessageDecoder > parsers = EMPTY_MAP ;
309+ private Map <String , MessageDecoder > decoders = EMPTY_MAP ;
311310
312311 private final String pattern ;
313312
@@ -626,7 +625,7 @@ public Route(@Nonnull String method, @Nonnull String pattern, @Nonnull Handler h
626625 * @return MessageDecoder.
627626 */
628627 public @ Nonnull MessageDecoder decoder (@ Nonnull MediaType contentType ) {
629- return parsers .getOrDefault (contentType .getValue (), MessageDecoder .UNSUPPORTED_MEDIA_TYPE );
628+ return decoders .getOrDefault (contentType .getValue (), MessageDecoder .UNSUPPORTED_MEDIA_TYPE );
630629 }
631630
632631 /**
@@ -635,7 +634,7 @@ public Route(@Nonnull String method, @Nonnull String pattern, @Nonnull Handler h
635634 * @return Message decoders.
636635 */
637636 public @ Nonnull Map <String , MessageDecoder > getDecoders () {
638- return parsers ;
637+ return decoders ;
639638 }
640639
641640 /**
@@ -645,30 +644,38 @@ public Route(@Nonnull String method, @Nonnull String pattern, @Nonnull Handler h
645644 * @return This route.
646645 */
647646 public @ Nonnull Route setDecoders (@ Nonnull Map <String , MessageDecoder > decoders ) {
648- this .parsers = decoders ;
647+ this .decoders = decoders ;
649648 return this ;
650649 }
651650
652651 public boolean isHttpOptions () {
653652 return supportedMethod != null && supportedMethod .contains (Router .OPTIONS );
654653 }
655654
656- public @ Nonnull Route setSupports (String ... httpMethods ) {
655+ public boolean isHttpTrace () {
656+ return supportedMethod != null && supportedMethod .contains (Router .TRACE );
657+ }
658+
659+ public @ Nonnull Route setHttpOptions (boolean enabled ) {
657660 if (supportedMethod == null ) {
658661 supportedMethod = new HashSet <>();
659662 }
660- Stream .of (httpMethods ).forEach (m -> supportedMethod .add (m .toUpperCase ()));
663+ if (enabled ) {
664+ supportedMethod .add (Router .OPTIONS );
665+ } else {
666+ supportedMethod .remove (Router .OPTIONS );
667+ }
661668 return this ;
662669 }
663670
664- public @ Nonnull Route setHttpOptions (boolean enabled ) {
671+ public @ Nonnull Route setHttpTrace (boolean enabled ) {
665672 if (supportedMethod == null ) {
666673 supportedMethod = new HashSet <>();
667674 }
668675 if (enabled ) {
669- supportedMethod .add (Router .OPTIONS );
676+ supportedMethod .add (Router .TRACE );
670677 } else {
671- supportedMethod .remove (Router .OPTIONS );
678+ supportedMethod .remove (Router .TRACE );
672679 }
673680 return this ;
674681 }
0 commit comments