org.hippoecm.hst.util
Class PathUtils

java.lang.Object
  extended by org.hippoecm.hst.util.PathUtils

public class PathUtils
extends Object

Helper class to encode and decode node from and to urls TODO: Add test cases: without them it's very tricky to get this exactly right


Method Summary
static String decodePath(String path)
          Decode the url: split url in url parts on '/' url decode the url parts with utf-8 jcr encode the decoded node name using utf-8 append last url part twice for handle in document model Always return at least a single slash
static String encodePath(String rewrite)
          Encode the url: split url in url parts on '/' decode the jcr node name url encode the decoded name using utf-8 append '.html' to the last url part
static String normalizePath(String path)
          remove trailing and leading slashes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

normalizePath

public static String normalizePath(String path)
remove trailing and leading slashes

Parameters:
path -
Returns:
normalized path which is the original path with all leading and trailing slashes removed

encodePath

public static String encodePath(String rewrite)
Encode the url:

Parameters:
prefix -
uriLevels -
rewrite -
Returns:
the encoded url

decodePath

public static String decodePath(String path)
Decode the url: Always return at least a single slash

Parameters:
path -
Returns:
the decoded url starting with a slash


Copyright © 2008-2012 Hippo. All Rights Reserved.