|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.blojsom.util.BlojsomUtils
BlojsomUtils
Field Summary | |
static java.util.Comparator |
FILE_NAME_COMPARATOR
Return a comparator to sort by name |
static java.util.Comparator |
FILE_TIME_ASCENDING_COMPARATOR
Return a comparator that uses a file's last modified time to order the files in ascending order. |
static java.util.Comparator |
FILE_TIME_COMPARATOR
Return a comparator that uses a file's last modified time to order the files. |
Method Summary | |
static java.lang.String |
addSlashes(java.lang.String input)
Add preceeding and trailing slashes to an input string. |
static java.util.Map |
arrayOfStringsToMap(java.lang.String[] array)
Turn an array of strings into a Map where the keys and values are the input strings. |
static java.lang.String |
arrayOfStringsToString(java.lang.String[] array)
Turn an array of strings into a single string separated by commas. |
static java.lang.String |
arrayOfStringsToString(java.lang.String[] array,
java.lang.String separator)
Turn an array of strings into a single string separated by a given delimeter. |
static java.util.List |
arrayToList(java.lang.String[] input)
Convert a String[] to a List |
static java.util.Map |
blojsomPropertiesToMap(java.util.Properties properties)
Convert a BlojsomProperties object to a Map . |
static boolean |
checkMapForKey(java.util.Map map,
java.lang.String key)
Check to see if a given map contains a particular key. |
static boolean |
checkNullOrBlank(java.lang.String input)
Checks to see if the string is null or blank (after trimming) |
static java.lang.String |
checkStartingAndEndingSlash(java.lang.String input)
Add a '/' at the beginning and end of the input string if necessary. |
static java.lang.String |
constructBaseURL(javax.servlet.http.HttpServletRequest httpServletRequest)
Construct a blog base URL from the request |
static java.lang.String |
constructBlogURL(javax.servlet.http.HttpServletRequest httpServletRequest,
java.lang.String blogID)
Construct a blog URL from the request |
static java.lang.String |
convertRequestParams(javax.servlet.http.HttpServletRequest request)
Convert the request parameters to a string |
static java.lang.String |
convertRequestParams(javax.servlet.http.HttpServletRequest request,
java.util.Map ignoreParams)
Convert the request parameters to a string |
static void |
copyDirectory(java.io.File sourceDirectory,
java.io.File targetDirectory)
Recursively copy a directory from a source to a target |
static java.util.List |
csvToList(java.lang.String valuesAsString)
Return a comma-separated list of Strings as a List ; trims space around value |
static int |
daysBetweenDates(java.util.Date startDate,
java.util.Date endDate)
Return the number of days between two dates |
static boolean |
deleteDirectory(java.io.File directoryOrFile)
Delete a directory (or file) and any sub-directories underneath the directory |
static boolean |
deleteDirectory(java.io.File directoryOrFile,
boolean removeDirectoryOrFile)
Delete a directory (or file) and any sub-directories underneath the directory |
static java.lang.String |
digestString(java.lang.String data)
Performs an MD5 Digest onthe given String content |
static java.lang.String |
digestString(java.lang.String data,
java.lang.String algorithm)
Performs an Digest onthe given String content for the given algorithm |
static java.lang.String |
escapeMetaAndLink(java.lang.String input)
Return an escaped string where <meta, <link tags are escaped |
static java.lang.String |
escapeString(java.lang.String input)
Return an escaped string where &, <, >, ", and ' are converted to their HTML equivalents |
static java.lang.String |
escapeStringSimple(java.lang.String input)
Return an escaped string where &, <, > are converted to their HTML equivalents |
static BlogEntry |
fetchEntry(BlojsomFetcher fetcher,
BlogUser blogUser,
java.lang.String category,
java.lang.String permalink)
Fetch an BlogEntry given a category and permalink |
static java.lang.String |
getBlogCategory(java.lang.String blogHome,
java.lang.String requestedCategory)
Strip off the blog home directory for a requested blog category |
static java.lang.String |
getBlogEntryFilename(java.lang.String title,
java.lang.String content)
Return a filename appropriate for the blog entry content |
static java.lang.String |
getBlogSiteURL(java.lang.String blogURL,
java.lang.String servletPath)
Return a URL to the main blog site without the servlet path requested |
static java.lang.String |
getCalendarNavigationUrl(java.lang.String prefix,
int month,
int day,
int year)
Create a Calendar Navigatation URL |
static java.lang.String |
getCategoryFromPath(java.lang.String pathInfo)
Returns category information from the path provided to the method where the path provided is assumed to be everything after the servlet instance with a user id at the very beginning of the path. |
static java.lang.String[] |
getCountriesForSystem(java.util.Locale locale)
Return of a list of locale countries supported on this system (JVM) |
static java.lang.String |
getDateKey(java.util.Date date)
Return a string of "YYYYMMDD" |
static java.io.FileFilter |
getDirectoryFilter()
Return a file filter which only returns directories |
static java.io.FileFilter |
getDirectoryFilter(java.lang.String[] excludedDirectories)
Return a file filter which only returns directories that are not one of a list of excluded directories |
static java.io.FileFilter |
getExtensionFilter(java.lang.String extension)
Return a file filter which takes a single file extension to look for |
static java.io.FileFilter |
getExtensionsFilter(java.lang.String[] extensions)
Return a file filter which takes a list of file extensions to look for |
static java.io.FileFilter |
getExtensionsFilter(java.lang.String[] extensions,
java.lang.String[] excludedDirectories,
boolean returnDirectories)
Return a file filter which takes a list of file extensions to look for |
static java.lang.String |
getFileExtension(java.lang.String filename)
Return the file extension for a given filename or null if no file extension
is present |
static java.lang.String |
getFilename(java.lang.String filename)
Return the filename without extension for a given filename |
static java.io.File |
getFilenameForDate(java.lang.String filename)
Return a filename with the date as a long value before the file extension. |
static java.lang.String |
getFilenameForPermalink(java.lang.String permalink,
java.lang.String[] blogEntryExtensions)
Return only the filename of a permalink request |
static java.lang.String |
getFilenameFromPath(java.lang.String filenameWithPath)
Returns the base file name from the supplied file path. |
static java.lang.String |
getFirstLine(java.lang.String input,
int length)
Extracts the first line in a given string, otherwise returns the first n bytes |
static java.lang.String |
getFormattedDate(java.util.Date date,
java.lang.String format,
java.util.Locale locale)
Return a date formatted date |
static java.lang.String |
getHashableContent(java.lang.String content)
Return a digested string of some content |
static java.lang.String |
getISO8601Date(java.util.Date date)
Return a date in ISO 8601 style http://www.w3.org/TR/NOTE-datetime |
static java.lang.String |
getKeysAsStringList(java.util.Map input)
Return the keys of a map as a comma-separated list |
static java.lang.String[] |
getLanguagesForSystem(java.util.Locale locale)
Return of a list of locale languages supported on this system (JVM) |
static java.util.Locale |
getLocaleFromString(java.lang.String locale)
Create a Locale object from a string of form language_country_variant |
static java.io.FileFilter |
getRegularExpressionFilter(java.lang.String[] expressions)
Return a file filter which takes a list of regular expressions to look for |
static java.lang.String |
getRequestValue(java.lang.String key,
javax.servlet.http.HttpServletRequest httpServletRequest)
Tries to retrieve a given key using getParameter(key) and if not available, will use getAttribute(key) from the servlet request |
static java.lang.String |
getRequestValue(java.lang.String key,
javax.servlet.http.HttpServletRequest httpServletRequest,
boolean preferAttributes)
Tries to retrieve a given key using getParameter(key) and if not available, will use getAttribute(key) from the servlet request |
static java.lang.String |
getRFC822Date(java.util.Date date)
Return a date in RFC 822 style |
static java.lang.String |
getTemplateForPage(java.lang.String flavorTemplate,
java.lang.String page)
Return the template name for a particular page |
static java.lang.String[] |
getTimeZonesForSystem(java.util.Locale locale)
Return of a list of time zone IDs supported on this system (JVM) |
static java.lang.String |
getUserFromPath(java.lang.String pathInfo)
Returns user id information from the path provided to the method where the path provided is assumed to be everything after the servlet instance with a user id at the very beginning of the path. |
static java.lang.String |
getUTCDate(java.util.Date date)
Return a date in UTC style |
static void |
listDirectoriesInSubdirectories(java.io.File directory,
java.lang.String parentDirectory,
java.util.List directories)
List the sub-directories in a sub-directory of a given directory and strip the parent directory from the path of the directories added to the list. |
static void |
listFilesInSubdirectories(java.io.File directory,
java.lang.String parentDirectory,
java.util.List files)
List the files in a sub-directory of a given directory and strip the parent directory from the path of the files added to the list. |
static java.lang.String |
listToCSV(java.util.List values)
Convert a list to a comma-separated string. |
static java.util.Map |
listToMap(java.util.List values)
Convert a list of values to a Map . |
static java.util.Properties |
loadProperties(javax.servlet.ServletConfig servletConfig,
java.lang.String configurationFile)
Try to load a properties file from disk. |
static java.util.Properties |
loadProperties(javax.servlet.ServletConfig servletConfig,
java.lang.String configurationIP,
boolean required)
Try to load a properties file from disk |
static java.util.Properties |
loadProperties(javax.servlet.ServletConfig servletConfig,
java.lang.String configurationIP,
boolean required,
boolean allowMultipleValues)
Try to load a properties file from disk |
static java.util.Properties |
mapToBlojsomProperties(java.util.Map map)
Convert a Map to a BlojsomProperties . |
static java.util.Properties |
mapToProperties(java.util.Map map)
Convert a Map to a set of BlojsomProperties . |
static java.util.Properties |
mapToProperties(java.util.Map map,
java.lang.String encoding)
Convert a Map to a set of BlojsomProperties |
static java.lang.String |
normalize(java.lang.String path)
Normalize a path to remove all ./, ../, .../, //, etc. |
static java.lang.String |
nullToBlank(java.lang.String input)
Check to see if the given input string is null and if so, return a blank string instead |
static java.lang.String[] |
parseCommaList(java.lang.String commaList)
Parse a comma-separated list of values; also parses over internal spaces |
static java.lang.String[] |
parseDelimitedList(java.lang.String delimitedList,
java.lang.String delimiter)
Parse a delimited list of values |
static java.lang.String[] |
parseDelimitedList(java.lang.String delimitedList,
java.lang.String delimiter,
boolean trim)
Parse a delimited list of values |
static java.lang.String[] |
parseLastComma(java.lang.String value)
Parse a string into two separate strings based on the last comma in the input value |
static java.lang.String[] |
parseOnlyCommaList(java.lang.String commaList)
Parse a comma-separated list of values |
static java.lang.String[] |
parseOnlyCommaList(java.lang.String commaList,
boolean trim)
Parse a comma-separated list of values |
static java.util.Map |
propertiesToMap(java.util.Properties properties)
Convert a set of Properties to a Map |
static java.lang.String |
removeInitialSlash(java.lang.String input)
Remove the initial "/" from a string |
static java.util.List |
removeNullValues(java.util.List input)
Remove null values from a given list |
static java.lang.String |
removeSlashes(java.lang.String input)
Remove the "/" from the beginning and end of a string |
static java.lang.String |
removeTrailingSlash(java.lang.String input)
Remove the trailing "/" from a string |
static java.lang.String |
replace(java.lang.String str,
java.lang.String pattern,
java.lang.String replace)
Replace any occurances of a string pattern within a string with a different string. |
static void |
resolveDynamicBaseAndBlogURL(javax.servlet.http.HttpServletRequest httpServletRequest,
Blog blog,
java.lang.String blogID)
Check to see if the blog base URL or blog URL are present. |
static void |
setNoCacheControlHeaders(javax.servlet.http.HttpServletResponse httpServletResponse)
Set various cache control HTTP headers so that the browser does not try and cache the page |
static java.lang.String |
stripHTML(java.lang.String text)
Strip all HTML from a given piece of text |
static java.lang.String |
stripLineTerminators(java.lang.String input)
Strip line terminator characters from an input string |
static java.lang.String |
stripLineTerminators(java.lang.String input,
java.lang.String replacement)
Strip line terminator characters from an input string |
static java.lang.String |
toHexString(byte[] buf,
int offset,
int length)
Convert a byte array to a hex string |
static java.lang.String |
urlDecode(java.lang.String input)
Return a URL decoded string |
static java.lang.String |
urlEncode(java.lang.String input)
Return an input string URL encoded |
static java.lang.String |
urlEncodeForLink(java.lang.String input)
Return an input string URL encoded for a URL link where '/' show as '/' |
static void |
visitFilesAndDirectories(java.util.Date today,
java.lang.String[] extensions,
java.lang.String[] excludedDirectories,
java.io.File directoryOrFile,
java.util.List items)
Visit a set of directories and add items to a list matching a list of extensions |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.util.Comparator FILE_TIME_COMPARATOR
public static final java.util.Comparator FILE_TIME_ASCENDING_COMPARATOR
public static final java.util.Comparator FILE_NAME_COMPARATOR
Method Detail |
public static java.io.FileFilter getDirectoryFilter()
public static java.io.FileFilter getDirectoryFilter(java.lang.String[] excludedDirectories)
excludedDirectories
- List of directories to exclude
public static java.lang.String getRFC822Date(java.util.Date date)
date
- Date
public static java.lang.String getFormattedDate(java.util.Date date, java.lang.String format, java.util.Locale locale)
date
- Dateformat
- Date Format Stringlocale
- Locale Locale for retrieving proper date symbols
public static java.lang.String getISO8601Date(java.util.Date date)
date
- Date
public static java.lang.String getUTCDate(java.util.Date date)
date
- Date
public static java.io.FileFilter getRegularExpressionFilter(java.lang.String[] expressions)
expressions
- List of regular expressions for files to retrieve
public static java.io.FileFilter getExtensionsFilter(java.lang.String[] extensions)
extensions
- List of file extensions
public static java.io.FileFilter getExtensionsFilter(java.lang.String[] extensions, java.lang.String[] excludedDirectories, boolean returnDirectories)
extensions
- List of file extensionsreturnDirectories
- Whether or not to return
public static java.io.FileFilter getExtensionFilter(java.lang.String extension)
extension
- File extension
public static void visitFilesAndDirectories(java.util.Date today, java.lang.String[] extensions, java.lang.String[] excludedDirectories, java.io.File directoryOrFile, java.util.List items)
extensions
- Extensions to matchexcludedDirectories
- Directories to excludedirectoryOrFile
- Starting directoryitems
- List of itemspublic static java.lang.String[] parseCommaList(java.lang.String commaList)
commaList
- Comma-separated list
public static java.lang.String[] parseOnlyCommaList(java.lang.String commaList)
commaList
- Comma-separated list
public static java.lang.String[] parseOnlyCommaList(java.lang.String commaList, boolean trim)
commaList
- Comma-separated listtrim
- If the contents of the array should be trimmed
public static java.lang.String[] parseLastComma(java.lang.String value)
value
- Input
public static java.lang.String[] parseDelimitedList(java.lang.String delimitedList, java.lang.String delimiter)
delimitedList
- Delimited listdelimiter
- Field Delimiter
public static java.lang.String[] parseDelimitedList(java.lang.String delimitedList, java.lang.String delimiter, boolean trim)
delimitedList
- Delimited listdelimiter
- Field Delimitertrim
- If the contents of the array should be trimmed
public static java.lang.String convertRequestParams(javax.servlet.http.HttpServletRequest request)
request
- Servlet request
public static java.lang.String convertRequestParams(javax.servlet.http.HttpServletRequest request, java.util.Map ignoreParams)
request
- Servlet requestignoreParams
- Parameters to ignore when converting the request
public static java.lang.String getBlogCategory(java.lang.String blogHome, java.lang.String requestedCategory)
blogHome
- Blog home valuerequestedCategory
- Requested blog category
public static java.lang.String getBlogSiteURL(java.lang.String blogURL, java.lang.String servletPath)
blogURL
- URL for the blogservletPath
- Servlet path under which the blog is placed
public static java.lang.String escapeString(java.lang.String input)
input
- Unescaped string
public static java.lang.String escapeStringSimple(java.lang.String input)
input
- Unescaped string
public static java.lang.String escapeMetaAndLink(java.lang.String input)
input
- Unescaped string
public static java.lang.String replace(java.lang.String str, java.lang.String pattern, java.lang.String replace)
str
- The source string. This is the string that will be searched and have the replacementspattern
- The pattern to look for in strreplace
- The string to insert in the place of pattern
public static java.lang.String getFileExtension(java.lang.String filename)
null
if no file extension
is present
filename
- Filename
null
if no file extension is presentpublic static java.lang.String getFilename(java.lang.String filename)
filename
- Filename
public static java.lang.String getFilenameFromPath(java.lang.String filenameWithPath)
File.getName()
correctly for Windows
paths, so we attempt to take care of that here.
filenameWithPath
- The full path to the file.
public static java.lang.String getDateKey(java.util.Date date)
date
- Date from which to extract "key"
public static java.lang.String removeInitialSlash(java.lang.String input)
input
- Input string
null
if the input was nullpublic static java.lang.String removeTrailingSlash(java.lang.String input)
input
- Input string
null
if the input was nullpublic static final java.lang.String removeSlashes(java.lang.String input)
input
- Input string
null
if the input was nullpublic static java.lang.String getFirstLine(java.lang.String input, int length)
input
- String from which to extract the first linelength
- Number of bytes to return if line seperator isnot found
public static final java.lang.String getTemplateForPage(java.lang.String flavorTemplate, java.lang.String page)
flavorTemplate
- Flavor template filenamepage
- Requested page
public static final java.lang.String getRequestValue(java.lang.String key, javax.servlet.http.HttpServletRequest httpServletRequest)
key
- Parameter to retrievehttpServletRequest
- Request
null
if there is no parameter/attributepublic static final java.lang.String getRequestValue(java.lang.String key, javax.servlet.http.HttpServletRequest httpServletRequest, boolean preferAttributes)
key
- Parameter to retrievehttpServletRequest
- RequestpreferAttributes
- If request attributes should be checked before request parameters
null
if there is no parameter/attributepublic static final java.lang.String getFilenameForPermalink(java.lang.String permalink, java.lang.String[] blogEntryExtensions)
permalink
- Permalink requestblogEntryExtensions
- Regex for blog entries so that we only pickup requests for valid blog entries
public static final java.lang.String urlEncode(java.lang.String input)
input
- Input string
null
if the input was null,
or input
unmodified there is an encoding exceptionpublic static final java.lang.String urlEncodeForLink(java.lang.String input)
input
- Input string
null
if the input was null,
or input
unmodified there is an encoding exceptionpublic static final java.lang.String urlDecode(java.lang.String input)
input
- Input string
null
if either the input was null or there is a decoding exceptionpublic static java.lang.String getCalendarNavigationUrl(java.lang.String prefix, int month, int day, int year)
prefix
- Any URL Prefixmonth
- Month of navigationday
- Day of navigationyear
- Year of navigation
public static java.lang.String digestString(java.lang.String data)
data
- Content to digest
public static java.lang.String digestString(java.lang.String data, java.lang.String algorithm)
data
- Content to digestalgorithm
- the algorithm to use (MD5, SHA1)
public static java.lang.String toHexString(byte[] buf, int offset, int length)
buf
- Byte array to convert to hex stringoffset
- Starting offset for conversionlength
- Length to convert
public static java.util.Properties loadProperties(javax.servlet.ServletConfig servletConfig, java.lang.String configurationIP, boolean required) throws BlojsomException
servletConfig
- Servlet configurationconfigurationIP
- Name of the file to load the properties fromrequired
- If the properties file is required
BlojsomException
- If there is an I/O error or if configurationIP is
not set and required == true.public static java.util.Properties loadProperties(javax.servlet.ServletConfig servletConfig, java.lang.String configurationIP, boolean required, boolean allowMultipleValues) throws BlojsomException
servletConfig
- Servlet configurationconfigurationIP
- Name of the file to load the properties fromrequired
- If the properties file is requiredallowMultipleValues
- If the BlojsomProperties
object should allow multiple values
BlojsomException
- If there is an I/O error or if configurationIP is
not set and required == true.public static java.util.Properties loadProperties(javax.servlet.ServletConfig servletConfig, java.lang.String configurationFile) throws BlojsomException
servletConfig
- Servlet configurationconfigurationFile
- Properties file to be loaded from disk (e.g. /WEB-INF/sample.properties)
BlojsomException
- If there is an error loading the properties from diskpublic static java.lang.String normalize(java.lang.String path)
path
- Input path
public static java.lang.String nullToBlank(java.lang.String input)
null
and if so, return a blank string instead
input
- Input string
null
, otherwise just return the input stringpublic static java.util.Map propertiesToMap(java.util.Properties properties)
Properties
to a Map
properties
- Properties to be converted to a Map
public static java.util.Map blojsomPropertiesToMap(java.util.Properties properties)
BlojsomProperties
object to a Map
. If the properties object is null
an emtpy Map
is returned.
properties
- BlojsomProperties
Map
containing keys and values from the propertiespublic static java.lang.String arrayOfStringsToString(java.lang.String[] array, java.lang.String separator)
null
string.
array
- Array of stringsseparator
- Separator between strings
null
if the input was null.public static java.lang.String arrayOfStringsToString(java.lang.String[] array)
null
string.
array
- Array of strings
null
if the input was null.public static java.util.Properties mapToProperties(java.util.Map map, java.lang.String encoding)
Map
to a set of BlojsomProperties
map
- Map to be converted to a BlojsomProperties objectencoding
- Specific encoding to use when writing BlojsomProperties object
public static java.util.Properties mapToBlojsomProperties(java.util.Map map)
Map
to a BlojsomProperties
. If the map is null
an empty
BlojsomProperties
object is returned.
map
- Map
BlojsomProperties
object containing keys and values from the mappublic static java.util.Properties mapToProperties(java.util.Map map)
Map
to a set of BlojsomProperties
. Uses the default encoding.
map
- Map to be converted to a BlojsomProperties object
public static final java.lang.String getCategoryFromPath(java.lang.String pathInfo)
pathInfo
- Path information
public static final java.lang.String getUserFromPath(java.lang.String pathInfo)
pathInfo
- Path information
public static boolean deleteDirectory(java.io.File directoryOrFile)
directoryOrFile
- Directory or file to be deleted
true
if the directory (or file) could be deleted, false
otherwisepublic static boolean deleteDirectory(java.io.File directoryOrFile, boolean removeDirectoryOrFile)
directoryOrFile
- Directory or file to be deletedremoveDirectoryOrFile
- If the directory of file should be deleted in addition to the sub-directories
true
if the directory (or file) could be deleted, false
otherwisepublic static void copyDirectory(java.io.File sourceDirectory, java.io.File targetDirectory) throws java.io.IOException
sourceDirectory
- Source directorytargetDirectory
- Destination directory
java.io.IOException
- If there is an error copying the files and directoriespublic static java.util.Map arrayOfStringsToMap(java.lang.String[] array)
array
- Array of strings
public static java.lang.String checkStartingAndEndingSlash(java.lang.String input)
input
- Input string
null
if the input was null
public static boolean checkNullOrBlank(java.lang.String input)
input
- Input string
true
if the string is null or blank (after trimming), false
otherwisepublic static void setNoCacheControlHeaders(javax.servlet.http.HttpServletResponse httpServletResponse)
httpServletResponse
- Responsepublic static boolean checkMapForKey(java.util.Map map, java.lang.String key)
true
if and only if the map and
key are not null and the map contains the key.
map
- Map to check for given keykey
- Key to check for in map
true
if and only if the map and key are not null and the map contains the key.public static int daysBetweenDates(java.util.Date startDate, java.util.Date endDate)
startDate
- Start dateendDate
- End date
null
public static java.io.File getFilenameForDate(java.lang.String filename)
filename
- Filename with extension
null
if there was no file extensionpublic static java.lang.String stripLineTerminators(java.lang.String input)
input
- Input string
null
if the input was null
public static java.lang.String stripLineTerminators(java.lang.String input, java.lang.String replacement)
input
- Input stringreplacement
- Replacement string
null
if the input was null
public static java.lang.String getKeysAsStringList(java.util.Map input)
input
- Map
null
or contains no keyspublic static java.lang.String listToCSV(java.util.List values)
null
, a
space is printed. If the input is null or there are no items in the list, an empty
string is returned.
values
- List of values
public static java.util.Map listToMap(java.util.List values)
Map
. null
values are not placed
in the returned Map
.
values
- List of values
Map
where each key and value pair is from the list of valuespublic static java.util.List csvToList(java.lang.String valuesAsString)
List
; trims space around value
valuesAsString
- Comma-separated values
List
public static java.lang.String constructBaseURL(javax.servlet.http.HttpServletRequest httpServletRequest)
httpServletRequest
- Request
http://server:port/context_path
public static java.lang.String constructBlogURL(javax.servlet.http.HttpServletRequest httpServletRequest, java.lang.String blogID)
httpServletRequest
- RequestblogID
- Blog ID
http://server:port/context_path/servlet_path/blog_id/
public static void resolveDynamicBaseAndBlogURL(javax.servlet.http.HttpServletRequest httpServletRequest, Blog blog, java.lang.String blogID)
constructBaseURL(javax.servlet.http.HttpServletRequest)
and constructBlogURL(javax.servlet.http.HttpServletRequest, String)
.
httpServletRequest
- Requestblog
- Blog
blogID
- Blog IDpublic static java.lang.String getHashableContent(java.lang.String content)
content
- Content from which to generate a hashed digest
digestString(String)
public static java.lang.String getBlogEntryFilename(java.lang.String title, java.lang.String content)
title
- Blog entry titlecontent
- Blog entry content
public static java.util.Locale getLocaleFromString(java.lang.String locale)
Locale
object from a string of form language_country_variant
locale
- Locale string of form language_country_variant
Locale
object with language, country, variant settings or Locale.getDefault()
if locale
input is null
or blankpublic static java.lang.String[] getLanguagesForSystem(java.util.Locale locale)
locale
- Locale
used for sorting
public static java.lang.String[] getCountriesForSystem(java.util.Locale locale)
locale
- Locale
used for sorting
public static java.lang.String[] getTimeZonesForSystem(java.util.Locale locale)
locale
- Locale
used for sorting
public static void listFilesInSubdirectories(java.io.File directory, java.lang.String parentDirectory, java.util.List files)
directory
- Sub-directory to start looking for filesparentDirectory
- Parent directory to stripfiles
- List of files to add topublic static void listDirectoriesInSubdirectories(java.io.File directory, java.lang.String parentDirectory, java.util.List directories)
directory
- Sub-directory to start looking for filesparentDirectory
- Parent directory to stripdirectories
- List of directories to add topublic static BlogEntry fetchEntry(BlojsomFetcher fetcher, BlogUser blogUser, java.lang.String category, java.lang.String permalink) throws BlojsomFetcherException
BlogEntry
given a category and permalink
fetcher
- BlojsomFetcher
blogUser
- BlogUser
category
- Categorypermalink
- Entry
BlogEntry
BlojsomFetcherException
- If there is an error loading the entrypublic static java.lang.String stripHTML(java.lang.String text)
text
- Text
null
if input was null or blank if input was blankpublic static java.util.List arrayToList(java.lang.String[] input)
String[]
to a List
input
- String[]
List
from string arraypublic static java.util.List removeNullValues(java.util.List input)
null
values from a given list
input
- List
null
values removedpublic static java.lang.String addSlashes(java.lang.String input)
null
a "/" is returned.
input
- Input
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |