Java Doc for BlojsomUtils.java in  » Blogger-System » blojsom-3.1 » org » blojsom » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Blogger System » blojsom 3.1 » org.blojsom.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.blojsom.util.BlojsomUtils

BlojsomUtils
public class BlojsomUtils implements BlojsomConstants(Code)
BlojsomUtils
author:
   David Czarnecki
since:
   blojsom 3.0
version:
   $Id: BlojsomUtils.java,v 1.16 2007/01/21 15:42:48 czarneckid Exp $


Field Summary
final public static  ComparatorFILE_NAME_COMPARATOR
    
final static  byte[]HEX_DIGITS
    
public static  ComparatorRESPONSE_COMPARATOR
    


Method Summary
public static  StringaddSlashes(String input)
     Add preceeding and trailing slashes to an input string.
public static  StringaddTrailingSlash(String input)
    
public static  MaparrayOfStringsToMap(String[] array)
     Turn an array of strings into a Map where the keys and values are the input strings.
public static  StringarrayOfStringsToString(String[] array, String separator)
     Turn an array of strings into a single string separated by a given delimeter.
public static  StringarrayOfStringsToString(String[] array)
     Turn an array of strings into a single string separated by commas.
public static  ListarrayToList(String[] input)
    
public static  MapblojsomPropertiesToMap(Properties properties)
     Convert a Properties object to a Map .
public static  booleancheckMapForKey(Map map, String key)
     Check to see if a given map contains a particular key.
public static  booleancheckNullOrBlank(String input)
    
public static  StringcheckStartingAndEndingSlash(String input)
     Add a '/' at the beginning and end of the input string if necessary.
public static  StringconstructBaseURL(HttpServletRequest httpServletRequest)
    
public static  StringconstructBlogURL(HttpServletRequest httpServletRequest, String blogID)
    
public static  StringconstructBlogURL(HttpServletRequest httpServletRequest, String blogID, String servletPath)
    
public static  StringconvertRequestParams(HttpServletRequest request)
    
public static  StringconvertRequestParams(HttpServletRequest request, Map ignoreParams)
    
public static  voidcopyDirectory(File sourceDirectory, File targetDirectory)
    
public static  ListcsvToList(String valuesAsString)
    
public static  intdaysBetweenDates(Date startDate, Date endDate)
    
public static  booleandeleteDirectory(File directoryOrFile)
    
public static  booleandeleteDirectory(File directoryOrFile, boolean removeDirectoryOrFile)
    
public static  StringdigestString(String data)
    
public static  StringdigestString(String data, String algorithm)
    
public static  StringescapeBrackets(String input)
    
public static  StringescapeMetaAndLink(String input)
    
public static  StringescapeString(String input)
    
public static  StringescapeStringSimple(String input)
    
public static  StringgetBlogFromPath(String pathInfo)
     Returns blog 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.
public static  StringgetBlogSiteURL(String blogURL, String servletPath)
    
public static  StringgetCalendarNavigationUrl(String prefix, int month, int day, int year)
    
public static  StringgetCategoryFromPath(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.
public static  String[]getCountriesForSystem(Locale locale)
    
public static  StringgetDateKey(Date date)
    
public static  FileFiltergetDirectoryFilter()
    
public static  FileFiltergetDirectoryFilter(String[] excludedDirectories)
    
public static  FileFiltergetExtensionFilter(String extension)
    
public static  FileFiltergetExtensionsFilter(String[] extensions)
    
public static  FileFiltergetExtensionsFilter(String[] extensions, String[] excludedDirectories, boolean returnDirectories)
    
public static  StringgetFileExtension(String filename)
     Return the file extension for a given filename or null if no file extension is present
Parameters:
  filename - Filename File extension without the .
public static  StringgetFilename(String filename)
    
public static  FilegetFilenameForDate(String filename)
     Return a filename with the date as a long value before the file extension.
public static  StringgetFilenameForPermalink(String permalink, String[] blogEntryExtensions)
    
public static  StringgetFilenameFromPath(String filenameWithPath)
     Returns the base file name from the supplied file path.
public static  DategetFirstDateOfYear(Locale locale, int year)
    
public static  DategetFirstDateOfYearMonth(Locale locale, int year, int month)
    
public static  DategetFirstDateOfYearMonthDay(Locale locale, int year, int month, int day)
    
public static  StringgetFirstLine(String input, int length)
    
public static  StringgetFormattedDate(Date date, String format, Locale locale)
    
public static  StringgetHashableContent(String content)
    
public static  StringgetISO8601Date(Date date)
    
public static  StringgetKeysAsStringList(Map input)
    
public static  String[]getLanguagesForSystem(Locale locale)
    
public static  DategetLastDateOfYear(Locale locale, int year)
    
public static  DategetLastDateOfYearMonth(Locale locale, int year, int month)
    
public static  DategetLastDateOfYearMonthDay(Locale locale, int year, int month, int day)
    
public static  LocalegetLocaleFromString(String locale)
    
public static  StringgetPostSlug(String title, String content)
    
public static  StringgetRFC822Date(Date date)
    
public static  FileFiltergetRegularExpressionFilter(String[] expressions)
    
public static  StringgetRequestValue(String key, HttpServletRequest httpServletRequest)
    
public static  StringgetRequestValue(String key, HttpServletRequest httpServletRequest, boolean preferAttributes)
    
public static  String[]getRequestValues(String key, HttpServletRequest httpServletRequest)
    
public static  StringgetTemplateForPage(String flavorTemplate, String page)
    
public static  String[]getTimeZonesForSystem(Locale locale)
    
public static  StringgetUTCDate(Date date)
    
public static  voidlistDirectoriesInSubdirectories(File directory, String parentDirectory, 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.
public static  voidlistFilesInSubdirectories(File directory, String parentDirectory, 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.
public static  StringlistToCSV(List values)
     Convert a list to a comma-separated string.
public static  MaplistToMap(List values)
     Convert a list of values to a Map .
public static  StringlistToString(List values, String separator)
    
public static  Stringnormalize(String path)
     Normalize a path to remove all ./, ../, .../, //, etc.
public static  StringnullToBlank(String input)
    
public static  String[]parseCommaList(String commaList)
    
public static  String[]parseDelimitedList(String delimitedList, String delimiter)
    
public static  String[]parseDelimitedList(String delimitedList, String delimiter, boolean trim)
    
public static  String[]parseLastComma(String value)
    
public static  String[]parseOnlyCommaList(String commaList)
    
public static  String[]parseOnlyCommaList(String commaList, boolean trim)
    
public static  MappropertiesToMap(Properties properties)
     Convert a set of Properties to a Map
Parameters:
  properties - Properties to be converted to a Map Map object containing all the keys and values from the original Properties object.
public static  StringremoveInitialSlash(String input)
    
public static  ListremoveNullValues(List input)
    
public static  StringremoveSlashes(String input)
    
public static  StringremoveTrailingSlash(String input)
    
public static  Stringreplace(String str, String pattern, String replace)
     Replace any occurances of a string pattern within a string with a different string.
Parameters:
  str - The source string.
public static  voidresolveDynamicBaseAndBlogURL(HttpServletRequest httpServletRequest, Blog blog, String blogID)
     Check to see if the blog base URL or blog URL are present.
public static  voidresolveDynamicBaseAndBlogURL(HttpServletRequest httpServletRequest, Blog blog, String blogID, String servletPath)
     Check to see if the blog base URL or blog URL are present.
public static  voidsetNoCacheControlHeaders(HttpServletResponse httpServletResponse)
    
public static  StringstripHTML(String text)
    
public static  StringstripLineTerminators(String input)
    
public static  StringstripLineTerminators(String input, String replacement)
    
public static  StringtoHexString(byte[] buf, int offset, int length)
    
public static  StringurlDecode(String input)
    
public static  StringurlEncode(String input)
    
public static  StringurlEncodeForLink(String input)
    

Field Detail
FILE_NAME_COMPARATOR
final public static Comparator FILE_NAME_COMPARATOR(Code)
Return a comparator to sort by name



HEX_DIGITS
final static byte[] HEX_DIGITS(Code)



RESPONSE_COMPARATOR
public static Comparator RESPONSE_COMPARATOR(Code)





Method Detail
addSlashes
public static String addSlashes(String input)(Code)
Add preceeding and trailing slashes to an input string. If input is null a "/" is returned.
Parameters:
  input - Input Input with preceeding and trailing slashes added



addTrailingSlash
public static String addTrailingSlash(String input)(Code)
Add a trailing slash to the input
Parameters:
  input - Input Input with trailing slash added



arrayOfStringsToMap
public static Map arrayOfStringsToMap(String[] array)(Code)
Turn an array of strings into a Map where the keys and values are the input strings. If the incoming array is null, this method returns an empty map.
Parameters:
  array - Array of strings Map Map containing all the strings from the original array or an empty map if the incoming array is null.



arrayOfStringsToString
public static String arrayOfStringsToString(String[] array, String separator)(Code)
Turn an array of strings into a single string separated by a given delimeter. If the incoming array is null, this method returns the null string.
Parameters:
  array - Array of strings
Parameters:
  separator - Separator between strings Single string containing all the strings from the original array separated by the given delimeter, or null if the input was null.



arrayOfStringsToString
public static String arrayOfStringsToString(String[] array)(Code)
Turn an array of strings into a single string separated by commas. If the incoming array is null, this method returns the null string.
Parameters:
  array - Array of strings Single string containing all the strings from the original array separated by commas, or null if the input was null.



arrayToList
public static List arrayToList(String[] input)(Code)
Convert a String[] to a List
Parameters:
  input - String[] List from string array



blojsomPropertiesToMap
public static Map blojsomPropertiesToMap(Properties properties)(Code)
Convert a Properties object to a Map . If the properties object is null an emtpy Map is returned.
Parameters:
  properties - Properties Map containing keys and values from the properties



checkMapForKey
public static boolean checkMapForKey(Map map, String key)(Code)
Check to see if a given map contains a particular key. Returns true if and only if the map and key are not null and the map contains the key.
Parameters:
  map - Map to check for given key
Parameters:
  key - Key to check for in map Returns true if and only if the map and key are not null and the map contains the key.



checkNullOrBlank
public static boolean checkNullOrBlank(String input)(Code)
Checks to see if the string is null or blank (after trimming)
Parameters:
  input - Input string true if the string is null or blank (after trimming), false otherwise



checkStartingAndEndingSlash
public static String checkStartingAndEndingSlash(String input)(Code)
Add a '/' at the beginning and end of the input string if necessary.
Parameters:
  input - Input string String with a '/' at the beginning and end of the original string, null if the input was null



constructBaseURL
public static String constructBaseURL(HttpServletRequest httpServletRequest)(Code)
Construct a blog base URL from the request
Parameters:
  httpServletRequest - Request URL of the form http://server:port/context_path



constructBlogURL
public static String constructBlogURL(HttpServletRequest httpServletRequest, String blogID)(Code)
Construct a blog URL from the request
Parameters:
  httpServletRequest - Request
Parameters:
  blogID - Blog ID URL of the form http://server:port/context_path/servlet_path/blog_id/



constructBlogURL
public static String constructBlogURL(HttpServletRequest httpServletRequest, String blogID, String servletPath)(Code)
Construct a blog URL from the request
Parameters:
  httpServletRequest - Request
Parameters:
  blogID - Blog ID
Parameters:
  servletPath - Servlet path URL of the form http://server:port/context_path/servlet_path/blog_id/



convertRequestParams
public static String convertRequestParams(HttpServletRequest request)(Code)
Convert the request parameters to a string
Parameters:
  request - Servlet request Request parameters in the form &name=value



convertRequestParams
public static String convertRequestParams(HttpServletRequest request, Map ignoreParams)(Code)
Convert the request parameters to a string
Parameters:
  request - Servlet request
Parameters:
  ignoreParams - Parameters to ignore when converting the request Request parameters in the form &name=value



copyDirectory
public static void copyDirectory(File sourceDirectory, File targetDirectory) throws IOException(Code)
Recursively copy a directory from a source to a target
Parameters:
  sourceDirectory - Source directory
Parameters:
  targetDirectory - Destination directory
throws:
  IOException - If there is an error copying the files and directories



csvToList
public static List csvToList(String valuesAsString)(Code)
Return a comma-separated list of Strings as a List ; trims space around value
Parameters:
  valuesAsString - Comma-separated values Comma-separated list of Strings as a List



daysBetweenDates
public static int daysBetweenDates(Date startDate, Date endDate)(Code)
Return the number of days between two dates
Parameters:
  startDate - Start date
Parameters:
  endDate - End date Number of days between two dates which may be 0 if either of the dates if null



deleteDirectory
public static boolean deleteDirectory(File directoryOrFile)(Code)
Delete a directory (or file) and any sub-directories underneath the directory
Parameters:
  directoryOrFile - Directory or file to be deleted true if the directory (or file) could be deleted, false otherwise



deleteDirectory
public static boolean deleteDirectory(File directoryOrFile, boolean removeDirectoryOrFile)(Code)
Delete a directory (or file) and any sub-directories underneath the directory
Parameters:
  directoryOrFile - Directory or file to be deleted
Parameters:
  removeDirectoryOrFile - If the directory of file should be deleted in addition to the sub-directories true if the directory (or file) could be deleted, false otherwise



digestString
public static String digestString(String data)(Code)
Performs an MD5 Digest onthe given String content
Parameters:
  data - Content to digest The Hash as Hex String



digestString
public static String digestString(String data, String algorithm)(Code)
Performs an Digest onthe given String content for the given algorithm
Parameters:
  data - Content to digest
Parameters:
  algorithm - the algorithm to use (MD5, SHA1) The Hash as Hex String



escapeBrackets
public static String escapeBrackets(String input)(Code)
Return an escaped string where <, > are converted to their HTML equivalents
Parameters:
  input - Unescaped string Escaped string containing HTML equivalents for <, >



escapeMetaAndLink
public static String escapeMetaAndLink(String input)(Code)
Return an escaped string where <meta, <link tags are escaped
Parameters:
  input - Unescaped string Escaped string where <meta, <link tags are escaped



escapeString
public static String escapeString(String input)(Code)
Return an escaped string where &, <, >, ", and ' are converted to their HTML equivalents
Parameters:
  input - Unescaped string Escaped string containing HTML equivalents for &, <, >, ", and '



escapeStringSimple
public static String escapeStringSimple(String input)(Code)
Return an escaped string where &, <, > are converted to their HTML equivalents
Parameters:
  input - Unescaped string Escaped string containing HTML equivalents for &, <, >



getBlogFromPath
public static String getBlogFromPath(String pathInfo)(Code)
Returns blog 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. For example, /david/this/is/the/category
Parameters:
  pathInfo - Path information Everything before the second "/" character in the path



getBlogSiteURL
public static String getBlogSiteURL(String blogURL, String servletPath)(Code)
Return a URL to the main blog site without the servlet path requested
Parameters:
  blogURL - URL for the blog
Parameters:
  servletPath - Servlet path under which the blog is placed URL to the blog up to the servlet path



getCalendarNavigationUrl
public static String getCalendarNavigationUrl(String prefix, int month, int day, int year)(Code)
Create a Calendar Navigatation URL
Parameters:
  prefix - Any URL Prefix
Parameters:
  month - Month of navigation
Parameters:
  day - Day of navigation
Parameters:
  year - Year of navigation Properly formatted calendar navigation url



getCategoryFromPath
public static String getCategoryFromPath(String pathInfo)(Code)
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. For example, /david/this/is/the/category
Parameters:
  pathInfo - Path information Everything after the second "/" character in the path



getCountriesForSystem
public static String[] getCountriesForSystem(Locale locale)(Code)
Return of a list of locale countries supported on this system (JVM)
Parameters:
  locale - Locale used for sorting Return of a list of locale countries supported on this system (JVM)



getDateKey
public static String getDateKey(Date date)(Code)
Return a string of "YYYYMMDD"
Parameters:
  date - Date from which to extract "key" String of "YYYYMMDD"



getDirectoryFilter
public static FileFilter getDirectoryFilter()(Code)
Return a file filter which only returns directories File filter appropriate for filtering only directories



getDirectoryFilter
public static FileFilter getDirectoryFilter(String[] excludedDirectories)(Code)
Return a file filter which only returns directories that are not one of a list of excluded directories
Parameters:
  excludedDirectories - List of directories to exclude File filter appropriate for filtering only directories



getExtensionFilter
public static FileFilter getExtensionFilter(String extension)(Code)
Return a file filter which takes a single file extension to look for
Parameters:
  extension - File extension File filter appropriate for filtering out a single file extension



getExtensionsFilter
public static FileFilter getExtensionsFilter(String[] extensions)(Code)
Return a file filter which takes a list of file extensions to look for
Parameters:
  extensions - List of file extensions File filter appropriate for filtering out a set of file extensions



getExtensionsFilter
public static FileFilter getExtensionsFilter(String[] extensions, String[] excludedDirectories, boolean returnDirectories)(Code)
Return a file filter which takes a list of file extensions to look for
Parameters:
  extensions - List of file extensions
Parameters:
  excludedDirectories - List of excluded directories
Parameters:
  returnDirectories - Whether or not to return File filter appropriate for filtering out a set of file extensions



getFileExtension
public static String getFileExtension(String filename)(Code)
Return the file extension for a given filename or null if no file extension is present
Parameters:
  filename - Filename File extension without the . or null if no file extension is present



getFilename
public static String getFilename(String filename)(Code)
Return the filename without extension for a given filename
Parameters:
  filename - Filename Filename up to the .



getFilenameForDate
public static File getFilenameForDate(String filename)(Code)
Return a filename with the date as a long value before the file extension.
Parameters:
  filename - Filename with extension Filename as {filename}-{date}.{file extension} or null if there was no file extension



getFilenameForPermalink
public static String getFilenameForPermalink(String permalink, String[] blogEntryExtensions)(Code)
Return only the filename of a permalink request
Parameters:
  permalink - Permalink request
Parameters:
  blogEntryExtensions - Regex for blog entries so that we only pickup requests for valid blog entries Filename portion of permalink request



getFilenameFromPath
public static String getFilenameFromPath(String filenameWithPath)(Code)
Returns the base file name from the supplied file path. On the surface, this would appear to be a trivial task. Apparently, however, some Linux JDKs do not implement File.getName() correctly for Windows paths, so we attempt to take care of that here.
Parameters:
  filenameWithPath - The full path to the file. The base file name, from the end of the path.



getFirstDateOfYear
public static Date getFirstDateOfYear(Locale locale, int year)(Code)
Find the first date of a year
Parameters:
  locale - Locale
Parameters:
  year - Year First date of the requested year



getFirstDateOfYearMonth
public static Date getFirstDateOfYearMonth(Locale locale, int year, int month)(Code)
Find the first date of a year/month
Parameters:
  locale - Locale
Parameters:
  year - Year
Parameters:
  month - Month FIrst date of the requested year/month



getFirstDateOfYearMonthDay
public static Date getFirstDateOfYearMonthDay(Locale locale, int year, int month, int day)(Code)
Get the first date of a year/month/day
Parameters:
  locale - Locale
Parameters:
  year - Year
Parameters:
  month - Month
Parameters:
  day - Day First date of the requested year/month/day



getFirstLine
public static String getFirstLine(String input, int length)(Code)
Extracts the first line in a given string, otherwise returns the first n bytes
Parameters:
  input - String from which to extract the first line
Parameters:
  length - Number of bytes to return if line seperator isnot found the first line of the string



getFormattedDate
public static String getFormattedDate(Date date, String format, Locale locale)(Code)
Return a date formatted date
Parameters:
  date - Date
Parameters:
  format - Date Format String
Parameters:
  locale - Locale Locale for retrieving proper date symbols Date formatted date



getHashableContent
public static String getHashableContent(String content)(Code)
Return a digested string of some content
Parameters:
  content - Content from which to generate a hashed digest BlojsomUtils.digestString(String) Digested string



getISO8601Date
public static String getISO8601Date(Date date)(Code)
Return a date in ISO 8601 style http://www.w3.org/TR/NOTE-datetime
Parameters:
  date - Date Date formatted as ISO 8601



getKeysAsStringList
public static String getKeysAsStringList(Map input)(Code)
Return the keys of a map as a comma-separated list
Parameters:
  input - Map Keys as a comma-separated list or an empty string if the input is null or contains no keys



getLanguagesForSystem
public static String[] getLanguagesForSystem(Locale locale)(Code)
Return of a list of locale languages supported on this system (JVM)
Parameters:
  locale - Locale used for sorting List of locale languages supported on this system (JVM)



getLastDateOfYear
public static Date getLastDateOfYear(Locale locale, int year)(Code)
Find the last date of a year
Parameters:
  locale - Locale
Parameters:
  year - Year Last date of the requested year



getLastDateOfYearMonth
public static Date getLastDateOfYearMonth(Locale locale, int year, int month)(Code)
Find the last date of a year/month
Parameters:
  locale - Locale
Parameters:
  year - Year
Parameters:
  month - Month Last date of the requested year/month



getLastDateOfYearMonthDay
public static Date getLastDateOfYearMonthDay(Locale locale, int year, int month, int day)(Code)
Get the last date of a year/month/day
Parameters:
  locale - Locale
Parameters:
  year - Year
Parameters:
  month - Month
Parameters:
  day - Day Last date of the requested year/month/day



getLocaleFromString
public static Locale getLocaleFromString(String locale)(Code)
Create a Locale object from a string of form language_country_variant
Parameters:
  locale - Locale string of form language_country_variant Locale object with language, country, variant settings or java.util.Locale.getDefaultif locale input is null or blank



getPostSlug
public static String getPostSlug(String title, String content)(Code)
Return a filename appropriate for the blog entry content
Parameters:
  title - Blog entry title
Parameters:
  content - Blog entry content Filename for the new blog entry



getRFC822Date
public static String getRFC822Date(Date date)(Code)
Return a date in RFC 822 style
Parameters:
  date - Date Date formatted as RFC 822



getRegularExpressionFilter
public static FileFilter getRegularExpressionFilter(String[] expressions)(Code)
Return a file filter which takes a list of regular expressions to look for
Parameters:
  expressions - List of regular expressions for files to retrieve File filter appropriate for filtering out a set of files based on regular expressions



getRequestValue
public static String getRequestValue(String key, HttpServletRequest httpServletRequest)(Code)
Tries to retrieve a given key using getParameter(key) and if not available, will use getAttribute(key) from the servlet request
Parameters:
  key - Parameter to retrieve
Parameters:
  httpServletRequest - Request Value of the key as a string, or null if there is no parameter/attribute



getRequestValue
public static String getRequestValue(String key, HttpServletRequest httpServletRequest, boolean preferAttributes)(Code)
Tries to retrieve a given key using getParameter(key) and if not available, will use getAttribute(key) from the servlet request
Parameters:
  key - Parameter to retrieve
Parameters:
  httpServletRequest - Request
Parameters:
  preferAttributes - If request attributes should be checked before request parameters Value of the key as a string, or null if there is no parameter/attribute



getRequestValues
public static String[] getRequestValues(String key, HttpServletRequest httpServletRequest)(Code)
Get request values for a given key and if not available, returns and empty String[]
Parameters:
  key - Parameter to retrieve
Parameters:
  httpServletRequest - Request Request values for the key as a String[]



getTemplateForPage
public static String getTemplateForPage(String flavorTemplate, String page)(Code)
Return the template name for a particular page
Parameters:
  flavorTemplate - Flavor template filename
Parameters:
  page - Requested page Return an appropriate template name for the flavor template and page combination



getTimeZonesForSystem
public static String[] getTimeZonesForSystem(Locale locale)(Code)
Return of a list of time zone IDs supported on this system (JVM)
Parameters:
  locale - Locale used for sorting Return of a list of time zone IDs supported on this system (JVM)



getUTCDate
public static String getUTCDate(Date date)(Code)
Return a date in UTC style
Parameters:
  date - Date Date formatted as ISO 8601



listDirectoriesInSubdirectories
public static void listDirectoriesInSubdirectories(File directory, String parentDirectory, List directories)(Code)
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.
Parameters:
  directory - Sub-directory to start looking for files
Parameters:
  parentDirectory - Parent directory to strip
Parameters:
  directories - List of directories to add to



listFilesInSubdirectories
public static void listFilesInSubdirectories(File directory, String parentDirectory, List files)(Code)
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.
Parameters:
  directory - Sub-directory to start looking for files
Parameters:
  parentDirectory - Parent directory to strip
Parameters:
  files - List of files to add to



listToCSV
public static String listToCSV(List values)(Code)
Convert a list to a comma-separated string. If values in the list are null, a space is printed. If the input is null or there are no items in the list, an empty string is returned.
Parameters:
  values - List of values Comma-separated string



listToMap
public static Map listToMap(List values)(Code)
Convert a list of values to a Map . null values are not placed in the returned Map.
Parameters:
  values - List of values Map where each key and value pair is from the list of values



listToString
public static String listToString(List values, String separator)(Code)
Return a List as a string
Parameters:
  values - List of values
Parameters:
  separator - Separator in-between values List as a string where each item is separated by the separator



normalize
public static String normalize(String path)(Code)
Normalize a path to remove all ./, ../, .../, //, etc. type references
Parameters:
  path - Input path Normalized path



nullToBlank
public static String nullToBlank(String input)(Code)
Check to see if the given input string is null and if so, return a blank string instead
Parameters:
  input - Input string Blank string if the input string is null, otherwise just return the input string



parseCommaList
public static String[] parseCommaList(String commaList)(Code)
Parse a comma-separated list of values; also parses over internal spaces
Parameters:
  commaList - Comma-separated list Individual strings from the comma-separated list



parseDelimitedList
public static String[] parseDelimitedList(String delimitedList, String delimiter)(Code)
Parse a delimited list of values
Parameters:
  delimitedList - Delimited list
Parameters:
  delimiter - Field Delimiter Individual strings from the comma-separated list



parseDelimitedList
public static String[] parseDelimitedList(String delimitedList, String delimiter, boolean trim)(Code)
Parse a delimited list of values
Parameters:
  delimitedList - Delimited list
Parameters:
  delimiter - Field Delimiter
Parameters:
  trim - If the contents of the array should be trimmed Individual strings from the comma-separated list



parseLastComma
public static String[] parseLastComma(String value)(Code)
Parse a string into two separate strings based on the last comma in the input value
Parameters:
  value - Input Parsed string



parseOnlyCommaList
public static String[] parseOnlyCommaList(String commaList)(Code)
Parse a comma-separated list of values
Parameters:
  commaList - Comma-separated list Individual strings from the comma-separated list



parseOnlyCommaList
public static String[] parseOnlyCommaList(String commaList, boolean trim)(Code)
Parse a comma-separated list of values
Parameters:
  commaList - Comma-separated list
Parameters:
  trim - If the contents of the array should be trimmed Individual strings from the comma-separated list



propertiesToMap
public static Map propertiesToMap(Properties properties)(Code)
Convert a set of Properties to a Map
Parameters:
  properties - Properties to be converted to a Map Map object containing all the keys and values from the original Properties object. If theProperties object was null, a new Map is returned with no values.



removeInitialSlash
public static String removeInitialSlash(String input)(Code)
Remove the initial "/" from a string
Parameters:
  input - Input string Input string without initial "/" removed or null if the input was null



removeNullValues
public static List removeNullValues(List input)(Code)
Remove null values from a given list
Parameters:
  input - List List with null values removed



removeSlashes
public static String removeSlashes(String input)(Code)
Remove the "/" from the beginning and end of a string
Parameters:
  input - Input string Input string with beginning and ending "/" removed or null if the input was null



removeTrailingSlash
public static String removeTrailingSlash(String input)(Code)
Remove the trailing "/" from a string
Parameters:
  input - Input string Input string with trailing "/" removed or null if the input was null



replace
public static String replace(String str, String pattern, String replace)(Code)
Replace any occurances of a string pattern within a string with a different string.
Parameters:
  str - The source string. This is the string that will be searched and have the replacements
Parameters:
  pattern - The pattern to look for in str
Parameters:
  replace - The string to insert in the place of pattern String with replace occurences



resolveDynamicBaseAndBlogURL
public static void resolveDynamicBaseAndBlogURL(HttpServletRequest httpServletRequest, Blog blog, String blogID)(Code)
Check to see if the blog base URL or blog URL are present. If not, construct them dynamically by calling BlojsomUtils.constructBaseURL(javax.servlet.http.HttpServletRequest) and BlojsomUtils.constructBlogURL(javax.servlet.http.HttpServletRequest,String) .
Parameters:
  httpServletRequest - Request
Parameters:
  blog - org.blojsom.blog.Blog
Parameters:
  blogID - Blog ID



resolveDynamicBaseAndBlogURL
public static void resolveDynamicBaseAndBlogURL(HttpServletRequest httpServletRequest, Blog blog, String blogID, String servletPath)(Code)
Check to see if the blog base URL or blog URL are present. If not, construct them dynamically by calling BlojsomUtils.constructBaseURL(javax.servlet.http.HttpServletRequest) and BlojsomUtils.constructBlogURL(javax.servlet.http.HttpServletRequest,String) .
Parameters:
  httpServletRequest - Request
Parameters:
  blog - org.blojsom.blog.Blog
Parameters:
  blogID - Blog ID
Parameters:
  servletPath - Custom servlet path



setNoCacheControlHeaders
public static void setNoCacheControlHeaders(HttpServletResponse httpServletResponse)(Code)
Set various cache control HTTP headers so that the browser does not try and cache the page
Parameters:
  httpServletResponse - Response



stripHTML
public static String stripHTML(String text)(Code)
Strip all HTML from a given piece of text
Parameters:
  text - Text text stripped of HTML between < and > tags or null if input was null or blank if input was blank



stripLineTerminators
public static String stripLineTerminators(String input)(Code)
Strip line terminator characters from an input string
Parameters:
  input - Input string Input with line terminator characters stripped or null if the input was null



stripLineTerminators
public static String stripLineTerminators(String input, String replacement)(Code)
Strip line terminator characters from an input string
Parameters:
  input - Input string
Parameters:
  replacement - Replacement string Input with line terminator characters stripped or null if the input was null



toHexString
public static String toHexString(byte[] buf, int offset, int length)(Code)
Convert a byte array to a hex string
Parameters:
  buf - Byte array to convert to hex string
Parameters:
  offset - Starting offset for conversion
Parameters:
  length - Length to convert Hex string representing the byte array



urlDecode
public static String urlDecode(String input)(Code)
Return a URL decoded string
Parameters:
  input - Input string URL decoded string or null if either the input was null or there is a decoding exception



urlEncode
public static String urlEncode(String input)(Code)
Return an input string URL encoded
Parameters:
  input - Input string URL encoded string, null if the input was null,or input unmodified there is an encoding exception



urlEncodeForLink
public static String urlEncodeForLink(String input)(Code)
Return an input string URL encoded for a URL link where '/' show as '/'
Parameters:
  input - Input string URL encoded string, null if the input was null,or input unmodified there is an encoding exception



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.