org.apache.tapestry5.internal.services
Class ContextPathEncoderImpl

java.lang.Object
  extended by org.apache.tapestry5.internal.services.ContextPathEncoderImpl
All Implemented Interfaces:
ContextPathEncoder

public class ContextPathEncoderImpl
extends Object
implements ContextPathEncoder


Constructor Summary
ContextPathEncoderImpl(ContextValueEncoder valueEncoder, URLEncoder urlEncoder, TypeCoercer typeCoercer)
           
 
Method Summary
 EventContext decodePath(String path)
          Inverse of ContextPathEncoder.encodeIntoPath(Object[]); the path is split into strings, and the string are decoded and constructed into an EventContext.
 String encodeIntoPath(EventContext context)
          Encodes the context into a string.
 String encodeIntoPath(Object[] context)
          Encodes the context values into a path string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContextPathEncoderImpl

public ContextPathEncoderImpl(ContextValueEncoder valueEncoder,
                              URLEncoder urlEncoder,
                              TypeCoercer typeCoercer)
Method Detail

encodeIntoPath

public String encodeIntoPath(Object[] context)
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 the ContextValueEncoder service. Those values are then encoded, via URLEncoder.encode(String) into URL-safe strings. The URL-safe strings are then concatinated together, seperated with "/" characters.

Specified by:
encodeIntoPath in interface ContextPathEncoder
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

public String encodeIntoPath(EventContext context)
Description copied from interface: ContextPathEncoder
Encodes the context into a string. Returns the empty string if the context is empty.

Specified by:
encodeIntoPath in interface ContextPathEncoder
Parameters:
context - to encode
Returns:
encoded values seperated by "/" characters, or the empty string

decodePath

public EventContext decodePath(String path)
Description copied from interface: ContextPathEncoder
Inverse of ContextPathEncoder.encodeIntoPath(Object[]); the path is split into strings, and the string are decoded and constructed into an EventContext.

Specified by:
decodePath in interface ContextPathEncoder
Parameters:
path - to decode, possibly empty or null
Returns:
corresponding event context


Copyright © 2006-2009 Apache Software Foundation. All Rights Reserved.