org.springframework.extensions.surf.uri
Class UriUtils

java.lang.Object
  extended by org.springframework.extensions.surf.uri.UriUtils

public final class UriUtils
extends Object

Utility functions for dealing with URI and token replacement.

Author:
Kevin Roast

Method Summary
static String replaceUriTokens(String s, Map<String,String> tokens)
          Helper to replace tokens in a string with values from a map of token->value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

replaceUriTokens

public static String replaceUriTokens(String s,
                                      Map<String,String> tokens)
Helper to replace tokens in a string with values from a map of token->value. Token names in the string are delimited by '{' and '}' - the entire token name plus the delimiters are replaced by the value found in the supplied replacement map. If no replacement value is found for the token name, it is replaced by the empty string.

Parameters:
s - String to work on - cannot be null
tokens - Map of token name -> token value for replacements
Returns:
the replaced string or the original if no tokens found or a failure occurs


Copyright © 2009 SpringSource, Inc. All Rights Reserved.