@Component
public class Utility
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.util.function.Predicate<java.util.Date> |
isDateInFuture |
static java.util.function.Predicate<java.util.Date> |
isDateInFutureOrNull |
static java.util.function.Predicate<java.util.Date> |
isDateInPast |
static org.apache.commons.dbutils.ResultSetHandler<java.lang.Boolean> |
SINGLE_BOOLEAN_HANDLER |
static org.apache.commons.dbutils.ResultSetHandler<java.lang.String> |
SINGLE_STRING_HANDLER |
static org.apache.commons.dbutils.ResultSetHandler<java.lang.String[][]> |
STRING_ARRAY_ARRAY_HANDLER |
static org.apache.commons.dbutils.ResultSetHandler<java.lang.String[]> |
STRING_ARRAY_HANDLER |
| Constructor and Description |
|---|
Utility(TextContentFilter textContentFilter,
ImcmsServices services) |
| Modifier and Type | Method and Description |
|---|---|
static java.util.Date |
addDate(java.util.Date date,
int i) |
static boolean |
classIsSignedByCertificatesInKeyStore(java.lang.Class clazz,
java.security.KeyStore keyStore) |
static void |
clearActiveSessionsData() |
static java.util.Collection |
collectImageDirectories() |
static boolean |
containsAny(java.lang.String amIContainsAny,
java.util.Collection<java.lang.String> elementsToCheck)
Method checks is interested string contains any element of collection.
|
static int[] |
convertStringArrayToIntArray(java.lang.String[] strings)
Also this method is using by clients
|
static java.lang.String |
createQueryStringFromParameterMultiMap(org.apache.commons.collections.MultiMap requestParameters) |
static java.lang.String |
encodeUrl(java.lang.String value) |
static java.lang.String |
escapeUrl(java.lang.String imageUrl) |
static java.lang.String |
fallbackUrlDecode(java.lang.String input,
FallbackDecoder fallbackDecoder) |
static java.lang.String |
firstElementOfSetByOrderOf(java.util.Set<java.lang.String> set,
java.util.Comparator<java.lang.String> comparator) |
static java.lang.String |
formatDate(java.util.Date oneWeekAgo) |
static java.lang.String |
formatDateTime(java.util.Date dateTime) |
static java.lang.String |
formatHtmlDatetime(java.util.Date datetime) |
static void |
forwardToLogin(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
static void |
forwardToLogin(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
int responseStatus) |
static void |
forwardToLogin(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
int responseStatus,
java.lang.StringBuffer loginTarget) |
static java.lang.String |
getAbsolutePathToDocument(javax.servlet.http.HttpServletRequest request,
DocumentDomainObject document) |
static java.util.List<SessionInfoDTO> |
getActiveSessions() |
static java.lang.String |
getAdminContents(java.lang.String templateName,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
static ContentManagementSystem |
getCMS(javax.servlet.jsp.PageContext context) |
static ContentManagementSystem |
getCMS(javax.servlet.ServletRequest request) |
static java.util.Map<java.lang.String,java.lang.Object> |
getConstants(java.lang.Class<?> klass) |
static ContentManagementSystem |
getContentManagementSystemFromRequest(javax.servlet.ServletRequest request) |
static java.lang.String |
getContents(java.lang.String path,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
static java.lang.String |
getContextRelativePathToDocument(DocumentDomainObject document) |
static java.lang.String |
getContextRelativePathToDocumentWithName(java.lang.String name) |
static UserDomainObject |
getLoggedOnUser(javax.servlet.http.HttpServletRequest req) |
static UserDomainObject |
getLoggedOnUser(javax.servlet.http.HttpSession session) |
static int[] |
getParameterInts(javax.servlet.http.HttpServletRequest request,
java.lang.String parameterName) |
static java.lang.String[] |
getParameterValues(javax.servlet.http.HttpServletRequest request,
java.lang.String parameterName) |
static java.lang.String |
getRequestURLWithoutPath(javax.servlet.http.HttpServletRequest request) |
static java.util.ResourceBundle |
getResourceBundle(javax.servlet.http.HttpServletRequest request) |
static TextContentFilter |
getTextContentFilter() |
static ContentManagementSystem |
initRequestWithApi(javax.servlet.ServletRequest request,
UserDomainObject currentUser) |
static java.lang.String |
ipLongToString(long ip)
Deprecated.
|
static long |
ipStringToLong(java.lang.String ip)
Deprecated.
|
static boolean |
isTextDocument(DocumentDomainObject document) |
static boolean |
isValidEmail(java.lang.String email) |
static java.lang.String |
makeSqlStringFromDate(java.util.Date date) |
static void |
makeUserLoggedIn(javax.servlet.http.HttpServletRequest req,
UserDomainObject user) |
static void |
makeUserLoggedOut(javax.servlet.http.HttpServletRequest req) |
static java.lang.String |
normalizeString(java.lang.String normalizeMe)
String normalize, escapes special characters and whitespace.
|
static void |
outputXmlDocument(javax.servlet.http.HttpServletResponse response,
org.w3c.dom.Document xmlDocument) |
static boolean |
parameterIsSet(javax.servlet.http.HttpServletRequest request,
java.lang.String parameter) |
static void |
redirectToStartDocument(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res) |
static void |
removeRememberCdCookie(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
static void |
setDefaultHtmlContentType(javax.servlet.http.HttpServletResponse res) |
static void |
setNoCache(javax.servlet.http.HttpServletResponse res)
Make a HttpServletResponse non-cacheable
|
static boolean |
throwableContainsMessageContaining(java.lang.Throwable t,
java.lang.String s) |
static java.util.Date |
truncateDateToMinutePrecision(java.util.Date fieldValue) |
static void |
writeXmlDocument(org.w3c.dom.Document xmlDocument,
javax.xml.transform.stream.StreamResult streamResult) |
public static final org.apache.commons.dbutils.ResultSetHandler<java.lang.String> SINGLE_STRING_HANDLER
public static final org.apache.commons.dbutils.ResultSetHandler<java.lang.Boolean> SINGLE_BOOLEAN_HANDLER
public static final org.apache.commons.dbutils.ResultSetHandler<java.lang.String[]> STRING_ARRAY_HANDLER
public static final org.apache.commons.dbutils.ResultSetHandler<java.lang.String[][]> STRING_ARRAY_ARRAY_HANDLER
public static final java.util.function.Predicate<java.util.Date> isDateInFutureOrNull
public static final java.util.function.Predicate<java.util.Date> isDateInFuture
public static final java.util.function.Predicate<java.util.Date> isDateInPast
public Utility(TextContentFilter textContentFilter, ImcmsServices services)
public static TextContentFilter getTextContentFilter()
public static java.lang.String normalizeString(java.lang.String normalizeMe)
normalizeMe - string to normalizepublic static boolean containsAny(java.lang.String amIContainsAny,
java.util.Collection<java.lang.String> elementsToCheck)
amIContainsAny - - string to be checked on containingelementsToCheck - - collection of elements for check@Deprecated public static java.lang.String ipLongToString(long ip)
@Deprecated
public static long ipStringToLong(java.lang.String ip)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException - if the input is not a valid IPv4 address.public static void setNoCache(javax.servlet.http.HttpServletResponse res)
public static boolean isTextDocument(DocumentDomainObject document)
public static UserDomainObject getLoggedOnUser(javax.servlet.http.HttpServletRequest req)
public static UserDomainObject getLoggedOnUser(javax.servlet.http.HttpSession session)
public static void setDefaultHtmlContentType(javax.servlet.http.HttpServletResponse res)
public static void redirectToStartDocument(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
throws java.io.IOException
java.io.IOExceptionpublic static boolean isValidEmail(java.lang.String email)
public static java.util.Collection collectImageDirectories()
public static java.lang.String firstElementOfSetByOrderOf(java.util.Set<java.lang.String> set,
java.util.Comparator<java.lang.String> comparator)
public static boolean parameterIsSet(javax.servlet.http.HttpServletRequest request,
java.lang.String parameter)
public static int[] getParameterInts(javax.servlet.http.HttpServletRequest request,
java.lang.String parameterName)
public static int[] convertStringArrayToIntArray(java.lang.String[] strings)
public static java.lang.String getAdminContents(java.lang.String templateName,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException,
java.io.IOException
javax.servlet.ServletExceptionjava.io.IOExceptionpublic static java.lang.String getContents(java.lang.String path,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException,
java.io.IOException
javax.servlet.ServletExceptionjava.io.IOExceptionpublic static java.lang.String formatDate(java.util.Date oneWeekAgo)
public static java.lang.String getAbsolutePathToDocument(javax.servlet.http.HttpServletRequest request,
DocumentDomainObject document)
public static java.lang.String getContextRelativePathToDocument(DocumentDomainObject document)
public static java.lang.String getContextRelativePathToDocumentWithName(java.lang.String name)
public static java.lang.String formatHtmlDatetime(java.util.Date datetime)
public static java.lang.String formatDateTime(java.util.Date dateTime)
public static void forwardToLogin(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException,
java.io.IOException
javax.servlet.ServletExceptionjava.io.IOExceptionpublic static void forwardToLogin(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
int responseStatus)
throws javax.servlet.ServletException,
java.io.IOException
javax.servlet.ServletExceptionjava.io.IOExceptionpublic static void forwardToLogin(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
int responseStatus,
java.lang.StringBuffer loginTarget)
throws java.io.IOException,
javax.servlet.ServletException
java.io.IOExceptionjavax.servlet.ServletExceptionpublic static java.lang.String[] getParameterValues(javax.servlet.http.HttpServletRequest request,
java.lang.String parameterName)
public static java.util.Date truncateDateToMinutePrecision(java.util.Date fieldValue)
public static java.lang.String getRequestURLWithoutPath(javax.servlet.http.HttpServletRequest request)
public static boolean throwableContainsMessageContaining(java.lang.Throwable t,
java.lang.String s)
public static boolean classIsSignedByCertificatesInKeyStore(java.lang.Class clazz,
java.security.KeyStore keyStore)
public static java.lang.String makeSqlStringFromDate(java.util.Date date)
public static java.lang.String escapeUrl(java.lang.String imageUrl)
public static java.util.Date addDate(java.util.Date date,
int i)
public static void outputXmlDocument(javax.servlet.http.HttpServletResponse response,
org.w3c.dom.Document xmlDocument)
throws java.io.IOException
java.io.IOExceptionpublic static void writeXmlDocument(org.w3c.dom.Document xmlDocument,
javax.xml.transform.stream.StreamResult streamResult)
public static void makeUserLoggedIn(javax.servlet.http.HttpServletRequest req,
UserDomainObject user)
public static void makeUserLoggedOut(javax.servlet.http.HttpServletRequest req)
public static java.util.List<SessionInfoDTO> getActiveSessions()
public static void clearActiveSessionsData()
public static ContentManagementSystem initRequestWithApi(javax.servlet.ServletRequest request, UserDomainObject currentUser)
public static ContentManagementSystem getContentManagementSystemFromRequest(javax.servlet.ServletRequest request)
public static ContentManagementSystem getCMS(javax.servlet.ServletRequest request)
public static ContentManagementSystem getCMS(javax.servlet.jsp.PageContext context)
public static java.lang.String fallbackUrlDecode(java.lang.String input,
FallbackDecoder fallbackDecoder)
public static java.util.ResourceBundle getResourceBundle(javax.servlet.http.HttpServletRequest request)
public static void removeRememberCdCookie(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
public static java.util.Map<java.lang.String,java.lang.Object> getConstants(java.lang.Class<?> klass)
public static java.lang.String encodeUrl(java.lang.String value)
public static java.lang.String createQueryStringFromParameterMultiMap(org.apache.commons.collections.MultiMap requestParameters)