|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.googlecode.webutilities.util.Utils
public final class Utils
Common Utilities provider class
| Method Summary | |
|---|---|
static String |
addFingerPrint(String fingerPrint,
String url)
|
static String |
buildETagForResource(String relativePath,
javax.servlet.ServletContext context)
|
static String |
buildETagForResources(List<String> resourcesRelativePath,
javax.servlet.ServletContext context)
|
static String |
buildProperPath(String parentPath,
String relativePathFromParent)
|
static String |
detectExtension(String requestURI)
|
static List<String> |
findResourcesToMerge(String contextPath,
String requestURI)
Split multiple resources with comma eg. |
static String |
forHeaderDate(long time)
|
static long |
getLastModifiedFor(List<String> resources,
javax.servlet.ServletContext servletContext)
|
static String |
getParentPath(String path)
Fast get parent directory using substring |
static String |
hexDigestString(byte[] data)
|
static boolean |
isAnyResourceETagModified(List<String> resources,
String requestETag,
String actualETag,
javax.servlet.ServletContext servletContext)
|
static boolean |
isAnyResourceModifiedSince(List<String> resources,
long sinceTime,
javax.servlet.ServletContext servletContext)
|
static boolean |
isProtocolURL(String url)
|
static boolean |
readBoolean(String string,
boolean defaultValue)
|
static Date |
readDateFromHeader(String headerDateString)
|
static int |
readInt(String string,
int defaultValue)
|
static long |
readLong(String string,
long defaultValue)
|
static String |
readString(String string,
String defaultValue)
|
static String |
removeFingerPrint(String url)
|
static String |
selectMimeByFile(String filePath)
|
static String |
selectMimeForExtension(String extensionOrFile)
|
static boolean |
updateReferenceMap(String cssFilePath,
String imgFilePath)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static int readInt(String string,
int defaultValue)
string - string representation of a int which is to be parsed and read fromdefaultValue - in case parsing fails or string is null, returns this default value
public static long readLong(String string,
long defaultValue)
string - string representation of a long which is to be parsed and read fromdefaultValue - in case parsing fails or string is null, returns this default value
public static boolean readBoolean(String string,
boolean defaultValue)
string - string representation of a boolean (true or false) which is to be parsed and read fromdefaultValue - in case string is null or does not contain valid boolean, returns this default value
public static String readString(String string,
String defaultValue)
string - stringdefaultValue - in case string is null or empty
public static String detectExtension(String requestURI)
requestURI - the URL string
public static String selectMimeByFile(String filePath)
filePath - - path of the file, whose mime is to be detected
public static String selectMimeForExtension(String extensionOrFile)
extensionOrFile - - .js or .css etc. of full file path in case of image files
public static String buildProperPath(String parentPath,
String relativePathFromParent)
public static List<String> findResourcesToMerge(String contextPath,
String requestURI)
contextPath - request Context PathrequestURI - requestURI
public static boolean isAnyResourceModifiedSince(List<String> resources,
long sinceTime,
javax.servlet.ServletContext servletContext)
resources - - list of resources pathssinceTime - - long value to compare againstservletContext - - servlet context
public static long getLastModifiedFor(List<String> resources,
javax.servlet.ServletContext servletContext)
resources - - list of resources pathsservletContext - - servlet context
public static boolean isAnyResourceETagModified(List<String> resources,
String requestETag,
String actualETag,
javax.servlet.ServletContext servletContext)
resources - - list of resourcesrequestETag - - request ETag from If-None-Match headeractualETag - - current ETag of a resource (can be null)servletContext - - servlet context
public static String buildETagForResources(List<String> resourcesRelativePath,
javax.servlet.ServletContext context)
resourcesRelativePath - - list of resourcescontext - - servlet context
public static boolean updateReferenceMap(String cssFilePath,
String imgFilePath)
cssFilePath - - css file pathimgFilePath - - img file path
public static boolean isProtocolURL(String url)
public static String buildETagForResource(String relativePath,
javax.servlet.ServletContext context)
relativePath - - relative path of rescontext - - servlet context
public static Date readDateFromHeader(String headerDateString)
headerDateString - - from request header
public static String forHeaderDate(long time)
public static String hexDigestString(byte[] data)
public static String addFingerPrint(String fingerPrint,
String url)
fingerPrint - hex digesturl - original url w/o fingerprint
public static String removeFingerPrint(String url)
url - Finger Printed URL
public static String getParentPath(String path)
path - path whose parent path has to be returned
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||