net.craftforge.essential.controller.utils
Class UriUtils

java.lang.Object
  extended by net.craftforge.essential.controller.utils.UriUtils

public class UriUtils
extends Object

Utilities for controller actions.

Since:
02.12.2010
Author:
Christian Bick

Constructor Summary
UriUtils()
           
 
Method Summary
static Map<String,String[]> getUrlParameters(String encoding, String uriQueryPart)
          Gets the parameters from an uri query part as a map-list combination.
static String slimUri(String uri)
          Replaces all duplicate slashes of an URI and removes leading as well as following slashes.
static String[] splitPath(String path)
          Splits a resource path into path parts.
static String standardUri(String uri)
          Replaces all duplicate slashes of an URI, removes all following slashes and ensures a leading slash.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UriUtils

public UriUtils()
Method Detail

slimUri

public static String slimUri(String uri)
Replaces all duplicate slashes of an URI and removes leading as well as following slashes.

Parameters:
uri - The URI
Returns:
The slimmed URI

standardUri

public static String standardUri(String uri)
Replaces all duplicate slashes of an URI, removes all following slashes and ensures a leading slash.

Parameters:
uri - The URI
Returns:
The standardized URI

getUrlParameters

public static Map<String,String[]> getUrlParameters(String encoding,
                                                    String uriQueryPart)
                                             throws UnsupportedEncodingException
Gets the parameters from an uri query part as a map-list combination. Accepts params with same name and multiple values ("param=5¶m=6") as well as array like params ("param[0]=7¶m[1]=8").

Parameters:
encoding - The URL encoding
uriQueryPart - The query part of the uri without leading question mark
Returns:
The parameters as a map-list combination
Throws:
UnsupportedEncodingException - if encoding is not supported by URLDecoder

splitPath

public static String[] splitPath(String path)
Splits a resource path into path parts.

Parameters:
path - The resource path
Returns:
The path parts


Copyright © 2011. All Rights Reserved.