Class ContextPathEncoderImpl
java.lang.Object
org.apache.tapestry5.internal.services.ContextPathEncoderImpl
- All Implemented Interfaces:
ContextPathEncoder
-
Constructor Summary
ConstructorsConstructorDescriptionContextPathEncoderImpl
(ContextValueEncoder valueEncoder, URLEncoder urlEncoder, TypeCoercer typeCoercer) -
Method Summary
Modifier and TypeMethodDescriptiondecodePath
(String path) Inverse ofContextPathEncoder.encodeIntoPath(Object[])
; the path is split into strings, and the string are decoded and constructed into anEventContext
.encodeIntoPath
(Object[] context) Encodes the context values into a path string.encodeIntoPath
(EventContext context) Encodes the context into a string.encodeValue
(Object value) Encodes a single value via theContextValueEncoder
service, returning the resulting string.
-
Constructor Details
-
ContextPathEncoderImpl
public ContextPathEncoderImpl(ContextValueEncoder valueEncoder, URLEncoder urlEncoder, TypeCoercer typeCoercer)
-
-
Method Details
-
encodeValue
Description copied from interface:ContextPathEncoder
Encodes a single value via theContextValueEncoder
service, returning the resulting string. Even null is encoded, as perURLEncoder.encode(String)
.- Specified by:
encodeValue
in interfaceContextPathEncoder
-
encodeIntoPath
Description copied from interface:ContextPathEncoder
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.- Specified by:
encodeIntoPath
in interfaceContextPathEncoder
- 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
Description copied from interface:ContextPathEncoder
Encodes the context into a string. Returns the empty string if the context is empty.- Specified by:
encodeIntoPath
in interfaceContextPathEncoder
- Parameters:
context
- to encode- Returns:
- encoded values separated by "/" characters, or the empty string
-
decodePath
Description copied from interface:ContextPathEncoder
Inverse ofContextPathEncoder.encodeIntoPath(Object[])
; the path is split into strings, and the string are decoded and constructed into anEventContext
.- Specified by:
decodePath
in interfaceContextPathEncoder
- Parameters:
path
- to decode, possibly empty or null- Returns:
- corresponding event context
-