org.eclipse.jetty.util
类 URIUtil

java.lang.Object
  继承者 org.eclipse.jetty.util.URIUtil
所有已实现的接口:
Cloneable

public class URIUtil
extends Object
implements Cloneable

URI Holder. This class assists with the decoding and encoding or HTTP URI's. It differs from the java.net.URL class as it does not provide communications ability, but it does assist with query string formatting.

UTF-8 encoding is used by default for % encoded characters. This may be overridden with the org.eclipse.jetty.util.URI.charset system property.

另请参见:
UrlEncoded

字段摘要
static String __CHARSET
           
static String HTTP
           
static String HTTP_COLON
           
static String HTTPS
           
static String HTTPS_COLON
           
static String SLASH
           
 
方法摘要
static String addPaths(String p1, String p2)
          Add two URI path segments.
static String canonicalPath(String path)
          Convert a path to a cananonical form.
static String compactPath(String path)
          Convert a path to a compact form.
static String decodePath(byte[] buf, int offset, int length)
           
static String decodePath(String path)
           
static String encodePath(String path)
          Encode a URI path.
static StringBuilder encodePath(StringBuilder buf, String path)
          Encode a URI path.
static StringBuilder encodeString(StringBuilder buf, String path, String encode)
          Encode a URI path.
static boolean hasScheme(String uri)
           
static String parentPath(String p)
          Return the parent Path.
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

SLASH

public static final String SLASH
另请参见:
常量字段值

HTTP

public static final String HTTP
另请参见:
常量字段值

HTTP_COLON

public static final String HTTP_COLON
另请参见:
常量字段值

HTTPS

public static final String HTTPS
另请参见:
常量字段值

HTTPS_COLON

public static final String HTTPS_COLON
另请参见:
常量字段值

__CHARSET

public static final String __CHARSET
方法详细信息

encodePath

public static String encodePath(String path)
Encode a URI path. This is the same encoding offered by URLEncoder, except that the '/' character is not encoded.

参数:
path - The path the encode
返回:
The encoded path

encodePath

public static StringBuilder encodePath(StringBuilder buf,
                                       String path)
Encode a URI path.

参数:
path - The path the encode
buf - StringBuilder to encode path into (or null)
返回:
The StringBuilder or null if no substitutions required.

encodeString

public static StringBuilder encodeString(StringBuilder buf,
                                         String path,
                                         String encode)
Encode a URI path.

参数:
path - The path the encode
buf - StringBuilder to encode path into (or null)
encode - String of characters to encode. % is always encoded.
返回:
The StringBuilder or null if no substitutions required.

decodePath

public static String decodePath(String path)

decodePath

public static String decodePath(byte[] buf,
                                int offset,
                                int length)

addPaths

public static String addPaths(String p1,
                              String p2)
Add two URI path segments. Handles null and empty paths, path and query params (eg ?a=b or ;JSESSIONID=xxx) and avoids duplicate '/'

参数:
p1 - URI path segment (should be encoded)
p2 - URI path segment (should be encoded)
返回:
Legally combined path segments.

parentPath

public static String parentPath(String p)
Return the parent Path. Treat a URI like a directory path and return the parent directory.


canonicalPath

public static String canonicalPath(String path)
Convert a path to a cananonical form. All instances of "." and ".." are factored out. Null is returned if the path tries to .. above its root.

参数:
path -
返回:
path or null.

compactPath

public static String compactPath(String path)
Convert a path to a compact form. All instances of "//" and "///" etc. are factored out to single "/"

参数:
path -
返回:
path

hasScheme

public static boolean hasScheme(String uri)
参数:
uri - URI
返回:
True if the uri has a scheme


Copyright © 2013. All Rights Reserved.