public class Util extends Object
| Constructor and Description |
|---|
Util() |
| Modifier and Type | Method and Description |
|---|---|
static String |
encodeBitstreamName(String stringIn)
Version of encodeBitstreamName with one parameter, uses default encoding
|
static String |
encodeBitstreamName(String stringIn,
String encoding)
Encode a bitstream name for inclusion in a URL in an HTML document.
|
static String |
formatFileSize(double in)
Formats the file size.
|
static boolean |
getBoolParameter(javax.servlet.http.HttpServletRequest request,
String param)
Obtain a parameter from the given request as a boolean.
|
static List<String> |
getControlledVocabulariesDisplayValueLocalized(Item item,
DCValue[] values,
String schema,
String element,
String qualifier,
Locale locale)
Get a list of all the respective "displayed-value(s)" from the given
"stored-value(s)" for a specific metadata field of a DSpace Item, by
reading input-forms.xml
|
static int |
getIntParameter(javax.servlet.http.HttpServletRequest request,
String param)
Obtain a parameter from the given request as an int.
|
static int[] |
getIntParameters(javax.servlet.http.HttpServletRequest request,
String param)
Obtain an array of int parameters from the given request as an int.
|
static String |
getSourceVersion()
Gets Maven version string of the source that built this instance.
|
static String |
getSubmitButton(javax.servlet.http.HttpServletRequest request,
String def)
Get the button the user pressed on a submitted form.
|
static String |
nonBreakSpace(String s)
Utility method to convert spaces in a string to HTML non-break space
elements.
|
public static String nonBreakSpace(String s)
s - string to change spaces inpublic static String encodeBitstreamName(String stringIn, String encoding) throws UnsupportedEncodingException
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.
stringIn - input string to encodeencoding - character encoding, e.g. UTF-8UnsupportedEncodingExceptionpublic static String encodeBitstreamName(String stringIn) throws UnsupportedEncodingException
stringIn - input string to encodeUnsupportedEncodingExceptionpublic static String formatFileSize(double in)
in - The number to convertpublic static int getIntParameter(javax.servlet.http.HttpServletRequest request,
String param)
-1 is
returned if the parameter is garbled or does not exist.request - the HTTP requestparam - the name of the parameterpublic static int[] getIntParameters(javax.servlet.http.HttpServletRequest request,
String param)
-1 is returned in
array locations if that particular value is garbled.request - the HTTP requestparam - the name of the parameterpublic static boolean getBoolParameter(javax.servlet.http.HttpServletRequest request,
String param)
false is returned if the parameter is garbled or does not
exist.request - the HTTP requestparam - the name of the parameterpublic static String getSubmitButton(javax.servlet.http.HttpServletRequest request, String def)
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.request - the HTTP requestdef - the default buttonpublic static String getSourceVersion()
public static List<String> getControlledVocabulariesDisplayValueLocalized(Item item, DCValue[] values, String schema, String element, String qualifier, Locale locale) throws SQLException, DCInputsReaderException
item - The Dspace Itemvalues - A DCValue[] array of the specific "stored-value(s)"schema - A String with the schema name of the metadata fieldelement - A String with the element name of the metadata fieldqualifier - A String with the qualifier name of the metadata fieldSQLExceptionDCInputsReaderExceptionCopyright © 2015 DuraSpace. All Rights Reserved.