Package io.milton.common
Class Utils
java.lang.Object
io.milton.common.Utils
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DateaddSeconds(Date dt, int seconds) static DateaddSeconds(Date dt, long seconds) static StringdecodePath(String href) does percentage decoding on a path portion of a url E.g.static StringThis method has been provided by Andr� Kunert - looks a bit better then my shabby implementation! BMstatic Stringstatic Resourcestatic io.milton.http.webdav.DestgetDecodedDestination(String destinationHeader) static StringgetProtocol(String url) static DatemostRecent(Date... dates) static Datenow()static Stringthis 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 slashesstatic StringstripServer(String href) static StringsuffixSlash(String parentHref) Add a slash if not presentstatic StringtoCsv(Collection<String> list) Convert the list of strings to a comma separated stringstatic StringtoCsv(Collection<String> list, boolean addSpace) static StringtruncateFileName(String agent, String s) Used for parsing uploaded file names.static longwithMax(long n, long max) If n is > max, returns max.
-
Field Details
-
UTF8
-
-
Constructor Details
-
Utils
public Utils()
-
-
Method Details
-
findChild
public static Resource findChild(Resource parent, Path path) throws io.milton.http.exceptions.NotAuthorizedException, io.milton.http.exceptions.BadRequestException - Throws:
io.milton.http.exceptions.NotAuthorizedExceptionio.milton.http.exceptions.BadRequestException
-
decodePath
does percentage decoding on a path portion of a url E.g. /foo > /foo /with%20space -> /with space- Parameters:
href-
-
now
-
addSeconds
-
addSeconds
-
getProtocol
-
escapeXml
-
percentEncode
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- Parameters:
s-
-
encodeURL
This method has been provided by Andr� Kunert - looks a bit better then my shabby implementation! BM- Parameters:
str-charset-- Returns:
-
mostRecent
-
toCsv
Convert the list of strings to a comma separated string- Parameters:
list-- Returns:
- - a comma seperated list of values
-
toCsv
-
stripServer
-
truncateFileName
Used for parsing uploaded file names. MS web browsers tend to transmit the complete path for an uploaded file, but we generally only want to know the last part of the path. TODO: move this into milton- Parameters:
s-- Returns:
-
withMax
public static long withMax(long n, long max) If n is > max, returns max. Otherwise n- Parameters:
n-max-- Returns:
-
suffixSlash
Add a slash if not present- Parameters:
parentHref-- Returns:
-
getDecodedDestination
-