|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.clerezza.triaxrs.util.UriHelper
public class UriHelper
Various methods for URI/URL manipulation.
| Method Summary | |
|---|---|
static String |
appendAltToPath(String uri,
javax.ws.rs.core.MediaType mediaType)
Append an alt parameter to an uri. |
static String |
appendPathToBaseUri(String baseUri,
String path)
Appends a path a baseUri. |
static String |
appendQueryParamsToPath(String uri,
Map<String,String[]> queryParams,
boolean escapeKeyParam)
The method appends query parameters to path |
static String |
contructUri(String scheme,
String userInfo,
String host,
int port,
String path,
String query,
String fragment)
Constructs a string with URI in unescaped form. |
static String |
getNameFromPath(String uri)
Get the last section of the path. |
static String |
getQueryParamsStr(Map<String,String[]> queryParams,
boolean escapeKeyParam)
The method builds the query parameters String e.g. |
static String |
getQueryString(String requestUri)
Get query string. |
static List<String> |
hidePassword(List<String> urls)
Hides password from all the urls in the list. |
static String |
hidePassword(String url)
Hide password from the URL. |
static String |
hidePassword(URI url)
Hide password from the URL. |
static String |
normalize(String uri)
Normalize input uri according to href="http://www.ietf.org/rfc/rfc3986.txt">RFC 3986 section 6.2.2. |
static List<javax.ws.rs.core.PathSegment> |
parsePath(String path)
Parses a uri path into a list of PathSegements |
static javax.ws.rs.core.MultivaluedMap<String,String> |
parseQuery(String queryStr)
Parses a query string (without the leading '?') into a map of parameters and values |
static String |
relativize(String basePath,
String pathToRelativize)
Relativize URI path. |
static String |
removeStartSlash(String s)
|
static String |
removeTrailingSlash(String uri)
Normalize URI: The last character in URI is NOT '/' |
static String |
stripName(String requestUri)
Strip name (last section in the path). |
static String |
stripQueryString(String requestUri)
Remove parameters for the url |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static String removeTrailingSlash(String uri)
uri - input URI
public static String stripQueryString(String requestUri)
requestUri - input URI
public static String getQueryString(String requestUri)
requestUri - input URI
public static String stripName(String requestUri)
requestUri - input URI
public static String getNameFromPath(String uri)
uri - URI.
public static String hidePassword(URI url)
url - the URL to hide the password from
public static String hidePassword(String url)
url - the URL to hide the password from
public static List<String> hidePassword(List<String> urls)
urls - the list of urls to hide the password from
public static String relativize(String basePath,
String pathToRelativize)
basePath - relative against this pathpathToRelativize - path to change
public static String removeStartSlash(String s)
s - a non-null string
public static String appendPathToBaseUri(String baseUri,
String path)
baseUri - the base uri, can but needn't to end with a '/', not
nullpath - path append, can but needn't to start with a '/'
public static String appendAltToPath(String uri,
javax.ws.rs.core.MediaType mediaType)
uri - an uri without any parameters, not nullmediaType - the value of the alt parameter, not null
public static String contructUri(String scheme,
String userInfo,
String host,
int port,
String path,
String query,
String fragment)
new Uri(constructUri(...)).toASCIIString() should be the
original URI.
scheme - URI.getSchemeuserInfo - URI.getRawUserInfohost - URI.getRawHostport - URI.getPort; -1 = no portpath - URI.getRawPathquery - URI.getRawQueryfragment - URI.getRawFragment
public static String getQueryParamsStr(Map<String,String[]> queryParams,
boolean escapeKeyParam)
queryParams - Map of query parametersescapeKeyParam - indicates if to escape the parameter's name and
value
public static String appendQueryParamsToPath(String uri,
Map<String,String[]> queryParams,
boolean escapeKeyParam)
uri - queryParams - Map of query parametersescapeKeyParam - indicates if to escape the parameter's name and
value
public static List<javax.ws.rs.core.PathSegment> parsePath(String path)
path - the path to parse
public static javax.ws.rs.core.MultivaluedMap<String,String> parseQuery(String queryStr)
queryStr - the query strin to parse
public static String normalize(String uri)
string -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||