Class StringFunctions.PathToken
java.lang.Object
org.apache.juneau.commons.svl.TypedFunction
org.apache.juneau.commons.svl.functions.StringFunctions.PathToken
- All Implemented Interfaces:
VarFunction
- Enclosing class:
- StringFunctions
#{pathToken(s)} — normalize a user-supplied path token for safe interpolation
into a path= template.
Strips leading and trailing /, plus a trailing /* (or * that
sits immediately after a /). Multi-segment paths are preserved.
Edge cases:
""→"""/"→"""/*"→"""jsp"→"jsp""/jsp"→"jsp""/jsp/"→"jsp""/jsp/*"→"jsp""jsp/*"→"jsp""/api/v1/*"→"api/v1"
Used in SVL-configurable mixin paths so users can supply
"jsp", "/jsp", "/jsp/", "/jsp/*", or "jsp/*" and
the template /#{pathToken(${juneau.jsp.path:jsp})}/* always resolves to a clean
/jsp/*.
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.apache.juneau.commons.svl.TypedFunction
invoke, maxArity, minArity
-
Constructor Details
-
PathToken
public PathToken()
-
-
Method Details
-
name
Description copied from interface:VarFunctionThe function's invocation name as it appears between#{}and the opening parenthesis in the template. Must consist of ASCII letters, digits, and underscores; must begin with a letter.- Returns:
- The invocation name. Never
nullor empty.
-
invoke
-