Top Description Inners Fields Constructors Methods
reactor.netty.http.server

pack-priv final Class HttpPredicate

extends Object
implements Predicate<HttpServerRequest>, Function<Object, Map<String, String>>
Class Inheritance
All Implemented Interfaces
java.util.function.Function, java.util.function.Predicate
Imports
java.util.ArrayList, .HashMap, .List, .Map, java.util.function.Function, .Predicate, java.util.regex.Matcher, .Pattern, io.netty.handler.codec.http.HttpMethod, .HttpVersion, reactor.netty.internal.util.MapUtils, reactor.util.annotation.Nullable

A Predicate to match against ServerRequest.
Author
Stephane Maldini

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static class
HttpPredicate.UriPathTemplate

Represents a URI template.

Field Summary

Modifier and TypeField and Description
pack-priv final HttpMethod
pack-priv final HttpVersion
pack-priv final HttpPredicate.UriPathTemplate
pack-priv final String

Constructor Summary

AccessConstructor and Description
public
HttpPredicate(String uri, HttpVersion protocol, HttpMethod method)

Method Summary

Modifier and TypeMethod and Description
public Map<String, String>
apply(Object
the function argument
key
)

Implements java.util.function.Function.apply.

Applies this function to the given argument.
public static Predicate<HttpServerRequest>

Returns:

The new Predicate.
delete
(String
The string to compile into a URI template and use for matching
uri
)

An alias for HttpPredicate#http.

public static Predicate<HttpServerRequest>

Returns:

The new Predicate.
get
(String
The string to compile into a URI template and use for matching
uri
)

An alias for HttpPredicate#http.

public static Predicate<HttpServerRequest>

Returns:

The new Predicate.
head
(String
The string to compile into a URI template and use for matching
uri
)

An alias for HttpPredicate#http.

public static Predicate<HttpServerRequest>

Returns:

The new HttpPredicate.
http
(String
The string to compile into a URI template and use for matching
uri
,
HttpVersion protocol, HttpMethod method)

Creates a Predicate based on a URI template.

public static Predicate<HttpServerRequest>

Returns:

The new Predicate.
options
(String
The string to compile into a URI template and use for matching
uri
)

An alias for HttpPredicate#http.

public static Predicate<HttpServerRequest>

Returns:

The new Predicate.
post
(String
The string to compile into a URI template and use for matching
uri
)

An alias for HttpPredicate#http.

public static Predicate<HttpServerRequest>

Returns:

The new Predicate.
prefix
(String prefix)

An alias for HttpPredicate#get prefix ([prefix]/**), useful for file system mapping.

public static Predicate<HttpServerRequest>

Returns:

The new Predicate.
prefix
(String prefix, HttpMethod method)

An alias for HttpPredicate#get prefix (/**), useful for file system mapping.

public static Predicate<HttpServerRequest>

Returns:

The new Predicate.
put
(String
The string to compile into a URI template and use for matching
uri
)

An alias for HttpPredicate#http.

public final boolean
test(HttpServerRequest
the input argument
key
)

Implements java.util.function.Predicate.test.

Evaluates this predicate on the given argument.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

methodback to summary
pack-priv final HttpMethod method
protocolback to summary
pack-priv final HttpVersion protocol
templateback to summary
pack-priv final HttpPredicate.UriPathTemplate template
uriback to summary
pack-priv final String uri

Constructor Detail

HttpPredicateback to summary
public HttpPredicate(String uri, HttpVersion protocol, HttpMethod method)

Method Detail

applyback to summary
public Map<String, String> apply(Object key)

Implements java.util.function.Function.apply.

Doc from java.util.function.Function.apply.

Applies this function to the given argument.

Parameters
key:Object

the function argument

Returns:Map<String, String>

the function result

Annotations
@Override
deleteback to summary
public static Predicate<HttpServerRequest> delete(String uri)

An alias for HttpPredicate#http.

Creates a Predicate based on a URI template filtering .

This will listen for DELETE Method.

Parameters
uri:String

The string to compile into a URI template and use for matching

Returns:Predicate<HttpServerRequest>

The new Predicate.

See Also
Predicate
getback to summary
public static Predicate<HttpServerRequest> get(String uri)

An alias for HttpPredicate#http.

Creates a Predicate based on a URI template filtering .

This will listen for GET Method.

Parameters
uri:String

The string to compile into a URI template and use for matching

Returns:Predicate<HttpServerRequest>

The new Predicate.

See Also
Predicate
headback to summary
public static Predicate<HttpServerRequest> head(String uri)

An alias for HttpPredicate#http.

Creates a Predicate based on a URI template filtering .

This will listen for HEAD Method.

Parameters
uri:String

The string to compile into a URI template and use for matching

Returns:Predicate<HttpServerRequest>

The new Predicate.

See Also
Predicate
httpback to summary
public static Predicate<HttpServerRequest> http(String uri, HttpVersion protocol, HttpMethod method)

Creates a Predicate based on a URI template. This will listen for all Methods.

Parameters
uri:String

The string to compile into a URI template and use for matching

Returns:Predicate<HttpServerRequest>

The new HttpPredicate.

See Also
Predicate
optionsback to summary
public static Predicate<HttpServerRequest> options(String uri)

An alias for HttpPredicate#http.

Creates a Predicate based on a URI template filtering .

This will listen for OPTIONS Method.

Parameters
uri:String

The string to compile into a URI template and use for matching

Returns:Predicate<HttpServerRequest>

The new Predicate.

See Also
Predicate
postback to summary
public static Predicate<HttpServerRequest> post(String uri)

An alias for HttpPredicate#http.

Creates a Predicate based on a URI template filtering .

This will listen for POST Method.

Parameters
uri:String

The string to compile into a URI template and use for matching

Returns:Predicate<HttpServerRequest>

The new Predicate.

See Also
Predicate
prefixback to summary
public static Predicate<HttpServerRequest> prefix(String prefix)

An alias for HttpPredicate#get prefix ([prefix]/**), useful for file system mapping.

Creates a Predicate based on a URI template filtering .

This will listen for WebSocket Method.

Returns:Predicate<HttpServerRequest>

The new Predicate.

See Also
Predicate
prefixback to summary
public static Predicate<HttpServerRequest> prefix(String prefix, HttpMethod method)

An alias for HttpPredicate#get prefix (/**), useful for file system mapping.

Creates a Predicate based on a URI template filtering .

This will listen for WebSocket Method.

Returns:Predicate<HttpServerRequest>

The new Predicate.

See Also
Predicate
putback to summary
public static Predicate<HttpServerRequest> put(String uri)

An alias for HttpPredicate#http.

Creates a Predicate based on a URI template filtering .

This will listen for PUT Method.

Parameters
uri:String

The string to compile into a URI template and use for matching

Returns:Predicate<HttpServerRequest>

The new Predicate.

See Also
Predicate
testback to summary
public final boolean test(HttpServerRequest key)

Implements java.util.function.Predicate.test.

Doc from java.util.function.Predicate.test.

Evaluates this predicate on the given argument.

Parameters
key:HttpServerRequest

the input argument

Returns:boolean

true if the input argument matches the predicate, otherwise false

Annotations
@Override
reactor.netty.http.server back to summary

pack-priv final Class HttpPredicate.HttpPrefixPredicate

extends Object
implements Predicate<HttpServerRequest>
Class Inheritance
All Implemented Interfaces
java.util.function.Predicate

Field Summary

Modifier and TypeField and Description
pack-priv final HttpMethod
pack-priv final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
test(HttpServerRequest
the input argument
key
)

Implements java.util.function.Predicate.test.

Evaluates this predicate on the given argument.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

methodback to summary
pack-priv final HttpMethod method
prefixback to summary
pack-priv final String prefix

Constructor Detail

HttpPrefixPredicateback to summary
public HttpPrefixPredicate(String prefix, HttpMethod method)

Method Detail

testback to summary
public boolean test(HttpServerRequest key)

Implements java.util.function.Predicate.test.

Doc from java.util.function.Predicate.test.

Evaluates this predicate on the given argument.

Parameters
key:HttpServerRequest

the input argument

Returns:boolean

true if the input argument matches the predicate, otherwise false

Annotations
@Override
reactor.netty.http.server back to summary

pack-priv final Class HttpPredicate.UriPathTemplate

extends Object
Class Inheritance

Represents a URI template. A URI template is a URI-like String that contains variables enclosed by braces ({, }), which can be expanded to produce an actual URI.
Authors
Arjen Poutsma, Juergen Hoeller, Jon Brisbin
See Also
RFC 6570: URI Templates

Field Summary

Modifier and TypeField and Description
private static final Pattern
private static final String
private static final Pattern
private static final Pattern
private final List<String>
private final Pattern
private static final Pattern

Constructor Summary

AccessConstructor and Description
pack-priv
UriPathTemplate(String
The pattern to be used by the template
uriPattern
)

Creates a new UriPathTemplate from the given uriPattern.

Method Summary

Modifier and TypeMethod and Description
pack-priv static String
pack-priv static String
private static String
private static String
pack-priv final Map<String, String>

Returns:

the path parameters from the uri. Never null.
match
(String
The uri to match
uri
)

Matches the template against the given uri returning a map of path parameters extracted from the uri, keyed by the names in the template.

private Matcher
public boolean

Returns:

true if there's a match, false otherwise
matches
(String
The uri to match
uri
)

Tests the given uri against this template, returning true if the uri matches the template, false otherwise.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

FULL_SPLAT_PATTERNback to summary
private static final Pattern FULL_SPLAT_PATTERN
FULL_SPLAT_REPLACEMENTback to summary
private static final String FULL_SPLAT_REPLACEMENT
NAME_PATTERNback to summary
private static final Pattern NAME_PATTERN
NAME_SPLAT_PATTERNback to summary
private static final Pattern NAME_SPLAT_PATTERN
pathVariablesback to summary
private final List<String> pathVariables
uriPatternback to summary
private final Pattern uriPattern
URL_PATTERNback to summary
private static final Pattern URL_PATTERN

Constructor Detail

UriPathTemplateback to summary
pack-priv UriPathTemplate(String uriPattern)

Creates a new UriPathTemplate from the given uriPattern.

Parameters
uriPattern:String

The pattern to be used by the template

Method Detail

filterHostAndPortback to summary
pack-priv static String filterHostAndPort(String uri)
filterQueryParamsback to summary
pack-priv static String filterQueryParams(String uri)
getNameReplacementback to summary
private static String getNameReplacement(String name)
getNameSplatReplacementback to summary
private static String getNameSplatReplacement(String name)
matchback to summary
pack-priv final Map<String, String> match(String uri)

Matches the template against the given uri returning a map of path parameters extracted from the uri, keyed by the names in the template. If the uri does not match, or there are no path parameters, an empty map is returned.

Parameters
uri:String

The uri to match

Returns:Map<String, String>

the path parameters from the uri. Never null.

matcherback to summary
private Matcher matcher(String uri)
matchesback to summary
public boolean matches(String uri)

Tests the given uri against this template, returning true if the uri matches the template, false otherwise.

Parameters
uri:String

The uri to match

Returns:boolean

true if there's a match, false otherwise