Class PathMatcher<L>
- All Implemented Interfaces:
scala.Function1<Uri.Path,PathMatcher.Matching<L>>
- Direct Known Subclasses:
PathMatchers.NumberMatcher,PathMatchers.PathEnd$,PathMatchers.Remaining$,PathMatchers.RemainingPath$,PathMatchers.Segment$,PathMatchers.Slash$
Opentelemetry Java Instrumentation relies on the apply(Path) method of this class (and of every
subclass) so avoid changing it. The agent uses it to derive the http.route attribute.
See https://github.com/apache/pekko-http/issues/1241 and
https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/6f9ca5672ce84edbbe36ce0e14386c31d68f479f/instrumentation/pekko/pekko-http-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/pekkohttp/v1_0/server/route/PathMatcherStaticInstrumentation.java
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic interfacestatic classstatic interfacestatic classstatic classstatic classstatic classstatic class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PathMatcher<scala.Tuple1<String>>_regex2PathMatcher(scala.util.matching.Regex regex) static PathMatcher<scala.runtime.BoxedUnit>_segmentStringToPathMatcher(String segment) static <T> PathMatcher<scala.Tuple1<T>>_stringExtractionPair2PathMatcher(scala.Tuple2<String, T> tuple) static PathMatcher<scala.runtime.BoxedUnit>static <T> PathMatcher<scala.Tuple1<T>>_valueMap2PathMatcher(scala.collection.immutable.Map<String, T> valueMap) <R> PathMatcher<Object>append(PathMatcher<R> other, TupleOps.Join<L, R> join) static <L> PathMatcher<L>Creates a PathMatcher that matches and consumes the given path prefix and extracts the given list of extractions.static <L> PathMatcher<L>apply(PathMatcher<L> magnet) Provoke implicit conversions to PathMatcher to be appliedstatic PathMatcher.Matched<scala.Tuple1<String>>The empty match returned when a Regex matcher matches the empty pathev()<R> PathMatcher<R>or(PathMatcher<? extends R> other, Tuple<R> evidence$2) static <L> PathMatcher<L>Creates a PathMatcher that always matches, consumes nothing and extracts the given Tuple of values.repeat(int min, int max, PathMatcher<scala.runtime.BoxedUnit> separator, PathMatcher.Lift<L, scala.collection.immutable.List> lift) Turns thisPathMatcherinto one that matches a number of times (with the given separator) and potentially extracts aListof the underlying matcher's extractions.repeat(int count, PathMatcher.Lift<L, scala.collection.immutable.List> lift) Same asrepeat(min = count, max = count).repeat(int count, PathMatcher<scala.runtime.BoxedUnit> separator, PathMatcher.Lift<L, scala.collection.immutable.List> lift) Same asrepeat(min = count, max = count, separator = separator).slash()<R> PathMatcher<Object>slash(PathMatcher<R> other, TupleOps.Join<L, R> join) <R> PathMatcher<R><R> PathMatcher<R><R> PathMatcher<R>transform(scala.Function1<PathMatcher.Matching<L>, PathMatcher.Matching<R>> f, Tuple<R> evidence$3) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface scala.Function1
andThen, apply, apply$mcDD$sp, apply$mcDF$sp, apply$mcDI$sp, apply$mcDJ$sp, apply$mcFD$sp, apply$mcFF$sp, apply$mcFI$sp, apply$mcFJ$sp, apply$mcID$sp, apply$mcIF$sp, apply$mcII$sp, apply$mcIJ$sp, apply$mcJD$sp, apply$mcJF$sp, apply$mcJI$sp, apply$mcJJ$sp, apply$mcVD$sp, apply$mcVF$sp, apply$mcVI$sp, apply$mcVJ$sp, apply$mcZD$sp, apply$mcZF$sp, apply$mcZI$sp, apply$mcZJ$sp, compose, toString
-
Constructor Details
-
PathMatcher
-
-
Method Details
-
provide
Creates a PathMatcher that always matches, consumes nothing and extracts the given Tuple of values.- Parameters:
extractions- (undocumented)ev- (undocumented)- Returns:
- (undocumented)
-
apply
Creates a PathMatcher that matches and consumes the given path prefix and extracts the given list of extractions. If the given prefix is empty the returned PathMatcher matches always and consumes nothing.Opentelemetry Java Instrumentation relies on this method so avoid changing it. The agent matches on the method name, on the
Pathfirst parameter and on thePathMatcherreturn type, and uses it to derive thehttp.routeattribute. See https://github.com/apache/pekko-http/issues/1241- Parameters:
prefix- (undocumented)extractions- (undocumented)ev- (undocumented)- Returns:
- (undocumented)
-
apply
Provoke implicit conversions to PathMatcher to be applied -
EmptyMatch
The empty match returned when a Regex matcher matches the empty path -
_stringExtractionPair2PathMatcher
public static <T> PathMatcher<scala.Tuple1<T>> _stringExtractionPair2PathMatcher(scala.Tuple2<String, T> tuple) -
_segmentStringToPathMatcher
-
_stringNameOptionReceptacle2PathMatcher
public static PathMatcher<scala.runtime.BoxedUnit> _stringNameOptionReceptacle2PathMatcher(NameOptionReceptacle<String> nr) -
_regex2PathMatcher
-
_valueMap2PathMatcher
public static <T> PathMatcher<scala.Tuple1<T>> _valueMap2PathMatcher(scala.collection.immutable.Map<String, T> valueMap) -
ev
-
slash
-
slash
-
or
-
append
-
transform
public <R> PathMatcher<R> transform(scala.Function1<PathMatcher.Matching<L>, PathMatcher.Matching<R>> f, Tuple<R> evidence$3) -
tmap
-
tflatMap
-
repeat
public PathMatcher<Object> repeat(int count, PathMatcher.Lift<L, scala.collection.immutable.List> lift) Same asrepeat(min = count, max = count).- Parameters:
count- (undocumented)lift- (undocumented)- Returns:
- (undocumented)
-
repeat
public PathMatcher<Object> repeat(int count, PathMatcher<scala.runtime.BoxedUnit> separator, PathMatcher.Lift<L, scala.collection.immutable.List> lift) Same asrepeat(min = count, max = count, separator = separator).- Parameters:
count- (undocumented)separator- (undocumented)lift- (undocumented)- Returns:
- (undocumented)
-
repeat
public PathMatcher<Object> repeat(int min, int max, PathMatcher<scala.runtime.BoxedUnit> separator, PathMatcher.Lift<L, scala.collection.immutable.List> lift) Turns thisPathMatcherinto one that matches a number of times (with the given separator) and potentially extracts aListof the underlying matcher's extractions. If less thanminapplications of the underlying matcher have succeeded the produced matcher fails, otherwise it matches up to the givenmaxnumber of applications. Note that it won't fail even if more thanmaxapplications could succeed! The "surplus" path elements will simply be left unmatched.The result type depends on the type of the underlying matcher:
If a matcheris of typethen matcher.repeat(...)is of typePathMatcher0PathMatcher0PathMatcher1[T]PathMatcher1[List[T]PathMatcher[L :Tuple]PathMatcher[List[L}- Parameters:
min- (undocumented)max- (undocumented)separator- (undocumented)lift- (undocumented)- Returns:
- (undocumented)
-