|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectro.isdc.wro.util.WroUtil
public final class WroUtil
Utility class.
| Field Summary | |
|---|---|
static InputStream |
EMPTY_STREAM
|
static Pattern |
EMTPY_LINE_PATTERN
Empty line pattern. |
| Constructor Summary | |
|---|---|
WroUtil()
|
|
| Method Summary | ||
|---|---|---|
static ThreadFactory |
createDaemonThreadFactory(String name)
|
|
static File |
createTempFile()
|
|
static File |
createTempFile(String extension)
Creates a temp file which has a certain extension. |
|
static WroModelFactory |
factoryFor(WroModel model)
A simple way to create a WroModelFactory. |
|
static String |
getImplementationVersion()
|
|
static String |
getPathInfoFromLocation(javax.servlet.http.HttpServletRequest request,
String location)
Retrieve pathInfo from a given location. |
|
static String |
getServletPathFromLocation(javax.servlet.http.HttpServletRequest request,
String location)
Retrieve servletPath from a given location. |
|
static boolean |
isGzipSupported(javax.servlet.http.HttpServletRequest request)
Analyze headers of the request and searches for mangled (by proxy) for "Accept-Encoding" header and its mangled variations and gzip header value and its mangled variations. |
|
static String |
loadRegexpWithKey(String key)
Load the regular expression stored in in regexp.properties resource file. |
|
static boolean |
matchesUrl(javax.servlet.http.HttpServletRequest request,
String path)
Utility used to verify that requestURI matches provided path |
|
static ResourcePostProcessor |
newResourceProcessor(Resource resource,
ResourcePreProcessor preProcessor)
A factory method for creating a ResourceProcessor based on provided ResourcePreProcessor. |
|
static void |
safeCopy(Reader reader,
Writer writer)
Copy and close the reader and writer streams. |
|
static
|
simpleObjectFactory(T object)
|
|
static boolean |
startsWithIgnoreCase(String str,
String prefix)
Case insensitive check if a String starts with a specified prefix. |
|
static String |
toDateAsString(long milliseconds)
Transforms milliseconds into date format for response header of this form: Sat, 10 Apr 2010 17:31:31 GMT. |
|
static String |
toJSMultiLineString(String data)
Transforms a java multi-line string into javascript multi-line string. |
|
static String |
toPackageAsFolder(Class<?> clazz)
Creates a folder like implementation for a class. |
|
static void |
wrapWithWroRuntimeException(Exception e)
Deprecated. use WroRuntimeException.wrap(Exception) |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Pattern EMTPY_LINE_PATTERN
public static final InputStream EMPTY_STREAM
| Constructor Detail |
|---|
public WroUtil()
| Method Detail |
|---|
public static ThreadFactory createDaemonThreadFactory(String name)
ThreadFactory with daemon threads.public static String toDateAsString(long milliseconds)
milliseconds - to transform
public static String getPathInfoFromLocation(javax.servlet.http.HttpServletRequest request,
String location)
request - location - where to search contextPath.
public static boolean startsWithIgnoreCase(String str,
String prefix)
Case insensitive check if a String starts with a specified prefix.
nulls are handled without exceptions. Two null references are considered to be equal. The
comparison is case insensitive.
StringUtils.startsWithIgnoreCase(null, null) = true
StringUtils.startsWithIgnoreCase(null, "abcdef") = false
StringUtils.startsWithIgnoreCase("abc", null) = false
StringUtils.startsWithIgnoreCase("abc", "abcdef") = true
StringUtils.startsWithIgnoreCase("abc", "ABCDEF") = true
str - the String to check, may be nullprefix - the prefix to find, may be null
true if the String starts with the prefix, case insensitive, or both nullString.startsWith(String)public static String toPackageAsFolder(Class<?> clazz)
clazz - used as a base location for determining the package path.
public static String getServletPathFromLocation(javax.servlet.http.HttpServletRequest request,
String location)
location - where to search the servletPath.
public static boolean isGzipSupported(javax.servlet.http.HttpServletRequest request)
public static String toJSMultiLineString(String data)
://stackoverflow.com/questions/805107/multiline-strings-in-javascript/
data - a string containing new lines.
public static boolean matchesUrl(javax.servlet.http.HttpServletRequest request,
String path)
public static ResourcePostProcessor newResourceProcessor(Resource resource,
ResourcePreProcessor preProcessor)
ResourceProcessor based on provided ResourcePreProcessor.
preProcessor - ResourcePreProcessor to use as a ResourceProcessor.
ResourceProcessor.public static WroModelFactory factoryFor(WroModel model)
WroModelFactory.
model - WroModel instance to be returned by the factory.public static <T> ObjectFactory<T> simpleObjectFactory(T object)
@Deprecated public static void wrapWithWroRuntimeException(Exception e)
WroRuntimeException.wrap(Exception)
WroRuntimeException and throw it.
e - the exception to wrap.public static String loadRegexpWithKey(String key)
key - the key of the regexp to load.
public static String getImplementationVersion()
public static void safeCopy(Reader reader,
Writer writer)
throws IOException
reader - The source stream.writer - The destination stream.
IOException - If content cannot be copy.public static File createTempFile()
File with unique name located in temp folder.public static File createTempFile(String extension)
extension - of the created temp file.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||