| java.lang.Object org.dspace.app.util.Util
All known Subclasses: org.dspace.app.webui.util.UIUtil,
Util | public class Util (Code) | | Miscellaneous utility methods
author: Robert Tansley author: Mark Diggory version: $Revision: $ |
encodeBitstreamName | public static String encodeBitstreamName(String stringIn, String encoding) throws java.io.UnsupportedEncodingException(Code) | | Encode a bitstream name for inclusion in a URL in an HTML document. This
differs from the usual URL-encoding, since we want pathname separators to
be passed through verbatim; this is required so that relative paths in
bitstream names and HTML references work correctly.
If the link to a bitstream is generated with the pathname separators
escaped (e.g. "%2F" instead of "/") then the Web user agent perceives it
to be one pathname element, and relative URI paths within that document
containing ".." elements will be handled incorrectly.
Parameters: stringIn - input string to encode Parameters: encoding - character encoding, e.g. UTF-8 the encoded string |
formatFileSize | public static String formatFileSize(double in)(Code) | | Formats the file size. Examples:
- 50 = 50B
- 1024 = 1KB
- 1,024,000 = 1MB etc
The numbers are formatted using java Locales
Parameters: in - The number to covnert the file size as a String |
getBoolParameter | public static boolean getBoolParameter(HttpServletRequest request, String param)(Code) | | Obtain a parameter from the given request as a boolean.
false is returned if the parameter is garbled or does not
exist.
Parameters: request - the HTTP request Parameters: param - the name of the parameter the integer value of the parameter, or -1 |
getIntParameter | public static int getIntParameter(HttpServletRequest request, String param)(Code) | | Obtain a parameter from the given request as an int. -1 is
returned if the parameter is garbled or does not exist.
Parameters: request - the HTTP request Parameters: param - the name of the parameter the integer value of the parameter, or -1 |
getIntParameters | public static int[] getIntParameters(HttpServletRequest request, String param)(Code) | | Obtain an array of int parameters from the given request as an int. null
is returned if parameter doesn't exist. -1 is returned in
array locations if that particular value is garbled.
Parameters: request - the HTTP request Parameters: param - the name of the parameter array of integers or null |
getSubmitButton | public static String getSubmitButton(HttpServletRequest request, String def)(Code) | | Get the button the user pressed on a submitted form. All buttons should
start with the text submit for this to work. A default
should be supplied, since often the browser will submit a form with no
submit button pressed if the user presses enter.
Parameters: request - the HTTP request Parameters: def - the default button the button pressed |
nonBreakSpace | public static String nonBreakSpace(String s)(Code) | | Utility method to convert spaces in a string to HTML non-break space
elements.
Parameters: s - string to change spaces in the string passed in with spaces converted to HTML non-breakspaces |
|
|