|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2021 the original author or authors. |
|
|
|
* Copyright 2002-2022 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -24,7 +24,6 @@ import java.time.Instant; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Collections; |
|
|
|
import java.util.Collections; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashSet; |
|
|
|
|
|
|
|
import java.util.LinkedHashMap; |
|
|
|
import java.util.LinkedHashMap; |
|
|
|
import java.util.LinkedHashSet; |
|
|
|
import java.util.LinkedHashSet; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
@ -73,6 +72,7 @@ public abstract class RequestPredicates { |
|
|
|
|
|
|
|
|
|
|
|
private static final Log logger = LogFactory.getLog(RequestPredicates.class); |
|
|
|
private static final Log logger = LogFactory.getLog(RequestPredicates.class); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Return a {@code RequestPredicate} that always matches. |
|
|
|
* Return a {@code RequestPredicate} that always matches. |
|
|
|
* @return a predicate that always matches |
|
|
|
* @return a predicate that always matches |
|
|
|
@ -535,7 +535,6 @@ public abstract class RequestPredicates { |
|
|
|
public String toString() { |
|
|
|
public String toString() { |
|
|
|
return this.pattern.getPatternString(); |
|
|
|
return this.pattern.getPatternString(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -564,12 +563,13 @@ public abstract class RequestPredicates { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static class ContentTypePredicate extends HeadersPredicate { |
|
|
|
private static class ContentTypePredicate extends HeadersPredicate { |
|
|
|
|
|
|
|
|
|
|
|
private final Set<MediaType> mediaTypes; |
|
|
|
private final Set<MediaType> mediaTypes; |
|
|
|
|
|
|
|
|
|
|
|
public ContentTypePredicate(MediaType... mediaTypes) { |
|
|
|
public ContentTypePredicate(MediaType... mediaTypes) { |
|
|
|
this(new HashSet<>(Arrays.asList(mediaTypes))); |
|
|
|
this(Set.of(mediaTypes)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private ContentTypePredicate(Set<MediaType> mediaTypes) { |
|
|
|
private ContentTypePredicate(Set<MediaType> mediaTypes) { |
|
|
|
@ -601,12 +601,13 @@ public abstract class RequestPredicates { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static class AcceptPredicate extends HeadersPredicate { |
|
|
|
private static class AcceptPredicate extends HeadersPredicate { |
|
|
|
|
|
|
|
|
|
|
|
private final Set<MediaType> mediaTypes; |
|
|
|
private final Set<MediaType> mediaTypes; |
|
|
|
|
|
|
|
|
|
|
|
public AcceptPredicate(MediaType... mediaTypes) { |
|
|
|
public AcceptPredicate(MediaType... mediaTypes) { |
|
|
|
this(new HashSet<>(Arrays.asList(mediaTypes))); |
|
|
|
this(Set.of(mediaTypes)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private AcceptPredicate(Set<MediaType> mediaTypes) { |
|
|
|
private AcceptPredicate(Set<MediaType> mediaTypes) { |
|
|
|
@ -696,7 +697,6 @@ public abstract class RequestPredicates { |
|
|
|
this.extension : |
|
|
|
this.extension : |
|
|
|
this.extensionPredicate); |
|
|
|
this.extensionPredicate); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -807,6 +807,7 @@ public abstract class RequestPredicates { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* {@link RequestPredicate} that negates a delegate predicate. |
|
|
|
* {@link RequestPredicate} that negates a delegate predicate. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@ -849,6 +850,7 @@ public abstract class RequestPredicates { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* {@link RequestPredicate} where either {@code left} or {@code right} predicates |
|
|
|
* {@link RequestPredicate} where either {@code left} or {@code right} predicates |
|
|
|
* may match. |
|
|
|
* may match. |
|
|
|
@ -1053,8 +1055,6 @@ public abstract class RequestPredicates { |
|
|
|
return this.request.session(); |
|
|
|
return this.request.session(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Optional<Principal> principal() { |
|
|
|
public Optional<Principal> principal() { |
|
|
|
return this.request.principal(); |
|
|
|
return this.request.principal(); |
|
|
|
@ -1084,7 +1084,6 @@ public abstract class RequestPredicates { |
|
|
|
public String toString() { |
|
|
|
public String toString() { |
|
|
|
return method() + " " + path(); |
|
|
|
return method() + " " + path(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|