|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.cocoon.util.NetUtils
public class NetUtils
A collection of File
, URL
and filename
utility methods
Constructor Summary | |
---|---|
NetUtils()
|
Method Summary | |
---|---|
static String |
absolutize(String path,
String resource)
Absolutize a relative resource path on the given absolute base path. |
static SourceParameters |
createParameters(Request request)
Create new SourceParameters with the same
parameters as the current request |
static String |
decode(String s,
String enc)
Pass through to the URLDecoder . |
static String |
decodePath(String path)
Decode a path. |
static String |
deparameterize(String uri,
Map parameters)
Remove parameters from a uri. |
static String |
encode(String s,
String enc)
Pass through to the URLEncoder . |
static String |
encodePath(String path)
Encode a path as required by the URL specification ( RFC 1738). |
static String |
getExtension(String uri)
Remove path and file information from a filename returning only its extension component |
static String |
getPath(String uri)
Returns the path of the given resource. |
static String |
normalize(String uri)
Normalize a uri containing ../ and ./ paths. |
static String |
parameterize(String uri,
Map parameters)
Add parameters stored in the Map to the uri string. |
static String |
relativize(String path,
String absoluteResource)
Relativize an absolute resource on a given absolute path. |
static String |
removeAuthorisation(String uri)
Remove any authorisation details from a URI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NetUtils()
Method Detail |
---|
public static String decodePath(String path)
Interprets %XX (where XX is hexadecimal number) as UTF-8 encoded bytes.
The validity of the input path is not checked (i.e. characters that were not encoded will not be reported as errors).
This method differs from URLDecoder.decode in that it always uses UTF-8 (while URLDecoder uses the platform default encoding, often ISO-8859-1), and doesn't translate + characters to spaces.
path
- the path to decode
public static String encodePath(String path)
java.net.URLEncoder.encode()
which encodes according
to the x-www-form-urlencoded
MIME format.
path
- the path to encode
public static String getPath(String uri)
uri
- The URI of the resource
public static String getExtension(String uri)
uri
- The filename
public static String absolutize(String path, String resource)
path
- The absolute base pathresource
- The relative resource path
public static String relativize(String path, String absoluteResource)
path
- The absolute pathabsoluteResource
- The absolute resource
public static String normalize(String uri)
uri
- The uri path to normalize
public static String deparameterize(String uri, Map parameters)
uri
- The uri path to deparameterize.parameters
- The map that collects parameters.
public static String parameterize(String uri, Map parameters)
uri
- The uri to add parameters intoparameters
- The map containing parameters to be added
public static SourceParameters createParameters(Request request)
SourceParameters
with the same
parameters as the current request
public static String removeAuthorisation(String uri)
public static String encode(String s, String enc) throws UnsupportedEncodingException
URLEncoder
. If running under JDK < 1.4,
default encoding will always be used.
UnsupportedEncodingException
public static String decode(String s, String enc) throws UnsupportedEncodingException
URLDecoder
. If running under JDK < 1.4,
default encoding will always be used.
UnsupportedEncodingException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |