Package org.apache.tapestry5.services
Interface ContextPathEncoder
-
- All Known Implementing Classes:
ContextPathEncoderImpl
public interface ContextPathEncoder
A service to provide utilities needed for event context encoding and decoding to and from (partial) URL paths. This is used for both component event contexts and page activation contexts.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description EventContext
decodePath(java.lang.String path)
Inverse ofencodeIntoPath(Object[])
; the path is split into strings, and the string are decoded and constructed into anEventContext
.java.lang.String
encodeIntoPath(java.lang.Object[] context)
Encodes the context values into a path string.java.lang.String
encodeIntoPath(EventContext context)
Encodes the context into a string.java.lang.String
encodeValue(java.lang.Object value)
Encodes a single value via theContextValueEncoder
service, returning the resulting string.
-
-
-
Method Detail
-
encodeValue
java.lang.String encodeValue(java.lang.Object value)
Encodes a single value via theContextValueEncoder
service, returning the resulting string. Even null is encoded, as perURLEncoder.encode(String)
.- Since:
- 5.2.2
-
encodeIntoPath
java.lang.String encodeIntoPath(java.lang.Object[] context)
Encodes the context values into a path string. Each context value (if non-null) is first value encoded into a string via theContextValueEncoder
service. Those values are then encoded, viaURLEncoder.encode(String)
into URL-safe strings. The URL-safe strings are then concatenated together, separated with "/" characters.- Parameters:
context
- an array of objects to encode as the context (may be null)- Returns:
- the path-encoded context, or the blank string if the context is empty
-
encodeIntoPath
java.lang.String encodeIntoPath(EventContext context)
Encodes the context into a string. Returns the empty string if the context is empty.- Parameters:
context
- to encode- Returns:
- encoded values separated by "/" characters, or the empty string
- Since:
- 5.1.0.2
-
decodePath
EventContext decodePath(java.lang.String path)
Inverse ofencodeIntoPath(Object[])
; the path is split into strings, and the string are decoded and constructed into anEventContext
.- Parameters:
path
- to decode, possibly empty or null- Returns:
- corresponding event context
-
-