public class Utils extends Object
| Constructor and Description |
|---|
Utils() |
| Modifier and Type | Method and Description |
|---|---|
static Date |
addSeconds(Date dt,
int seconds) |
static Date |
addSeconds(Date dt,
long seconds) |
static String |
decodePath(String href)
does percentage decoding on a path portion of a url
E.g.
|
static String |
encodeURL(String str,
String charset)
This method has been provided by Andr� Kunert - looks a bit better then
my shabby implementation! BM
|
static String |
escapeXml(String s) |
static Resource |
findChild(Resource parent,
Path path) |
static io.milton.http.webdav.Dest |
getDecodedDestination(String destinationHeader) |
static String |
getProtocol(String url) |
static Date |
mostRecent(Date... dates) |
static Date |
now() |
static String |
percentEncode(String s)
this is a modified verion of java.net.URI.encode(s)
the java.net version only encodes characters over , but this
version also applies encoding to characters below char 48
this method should be applied only to parts of a URL, not the whole URL
as forward slashes, semi-colons etc will be encoded
by "part of url" i mean the bits between slashes
|
static String |
stripServer(String href) |
static String |
suffixSlash(String parentHref)
Add a slash if not present
|
static String |
toCsv(Collection<String> list)
Convert the list of strings to a comma separated string
|
static String |
toCsv(Collection<String> list,
boolean addSpace) |
static String |
truncateFileName(String agent,
String s)
Used for parsing uploaded file names.
|
static long |
withMax(long n,
long max)
If n is > max, returns max.
|
public static final Charset UTF8
public static Resource findChild(Resource parent, Path path) throws io.milton.http.exceptions.NotAuthorizedException, io.milton.http.exceptions.BadRequestException
io.milton.http.exceptions.NotAuthorizedExceptionio.milton.http.exceptions.BadRequestExceptionpublic static String decodePath(String href)
href - public static Date now()
public static String percentEncode(String s)
s - public static String encodeURL(String str, String charset)
str - charset - public static String toCsv(Collection<String> list)
list - public static String toCsv(Collection<String> list, boolean addSpace)
public static String truncateFileName(String agent, String s)
s - public static long withMax(long n,
long max)
n - max - public static String suffixSlash(String parentHref)
parentHref - public static io.milton.http.webdav.Dest getDecodedDestination(String destinationHeader)