public class UIUtil extends Util
| Modifier and Type | Field and Description |
|---|---|
static org.apache.log4j.Logger |
log
log4j category
|
| Constructor and Description |
|---|
UIUtil() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
displayDate(DCDate d,
boolean time,
boolean localTime,
javax.servlet.http.HttpServletRequest request)
Write a human-readable version of a DCDate.
|
static Collection |
getCollectionLocation(javax.servlet.http.HttpServletRequest request)
Get the current collection location, that is, where the user "is".
|
static Community |
getCommunityLocation(javax.servlet.http.HttpServletRequest request)
Get the current community location, that is, where the user "is".
|
static java.lang.String |
getMarkingMarkup(javax.servlet.http.HttpServletRequest hrq,
DSpaceObject dso,
java.lang.String markType)
Generate the (X)HTML required to show the item marking.
|
static java.lang.String |
getOriginalURL(javax.servlet.http.HttpServletRequest request)
Get the original request URL.
|
static java.lang.String |
getRequestLogInfo(javax.servlet.http.HttpServletRequest request)
Return a string for logging, containing useful information about the
current request - the URL, the method and parameters.
|
static java.util.Locale |
getSessionLocale(javax.servlet.http.HttpServletRequest request)
Get the Locale for a session according to the user's language selection or language preferences.
|
static Context |
obtainContext(javax.servlet.http.HttpServletRequest request)
Obtain a new context object.
|
static void |
sendAlert(javax.servlet.http.HttpServletRequest request,
java.lang.Exception exception)
Send an alert to the designated "alert recipient" - that is, when a
database error or internal error occurs, this person is sent an e-mail
with details.
|
static void |
setBitstreamDisposition(java.lang.String filename,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Evaluate filename and client and encode appropriate disposition
|
static void |
storeOriginalURL(javax.servlet.http.HttpServletRequest request)
Put the original request URL into the request object as an attribute for
later use.
|
encodeBitstreamName, encodeBitstreamName, formatFileSize, getBoolParameter, getControlledVocabulariesDisplayValueLocalized, getIntParameter, getIntParameters, getSourceVersion, getSubmitButton, nonBreakSpacepublic static Context obtainContext(javax.servlet.http.HttpServletRequest request) throws java.sql.SQLException
request - the HTTP requestjava.sql.SQLExceptionpublic static Community getCommunityLocation(javax.servlet.http.HttpServletRequest request)
null if there is no location, i.e. "all of DSpace"
is the location.request - current HTTP requestpublic static Collection getCollectionLocation(javax.servlet.http.HttpServletRequest request)
request - current HTTP requestpublic static void storeOriginalURL(javax.servlet.http.HttpServletRequest request)
request - the HTTP requestpublic static java.lang.String getOriginalURL(javax.servlet.http.HttpServletRequest request)
request - the HTTP requestpublic static java.lang.String displayDate(DCDate d, boolean time, boolean localTime, javax.servlet.http.HttpServletRequest request)
d - the datetime - if true, display the time with the datelocalTime - if true, adjust for local timezone, otherwise GMTrequest - the servlet requestpublic static java.lang.String getRequestLogInfo(javax.servlet.http.HttpServletRequest request)
request - the request object.public static java.util.Locale getSessionLocale(javax.servlet.http.HttpServletRequest request)
request - the request Objectpublic static void sendAlert(javax.servlet.http.HttpServletRequest request,
java.lang.Exception exception)
The recipient is configured via the "alert.recipient" property in
dspace.cfg. If this property is omitted, no alerts are
sent.
This method "swallows" any exception that might occur - it will just be logged. This is because this method will usually be invoked as part of an error handling routine anyway.
request - the HTTP request leading to the errorexception - the exception causing the error, or nullpublic static void setBitstreamDisposition(java.lang.String filename,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
filename - request - response - java.io.UnsupportedEncodingExceptionpublic static java.lang.String getMarkingMarkup(javax.servlet.http.HttpServletRequest hrq,
DSpaceObject dso,
java.lang.String markType)
throws javax.servlet.jsp.JspException
hrq - The servlet requestdso - The DSpaceObject to mark (it can be a BrowseItem or an Item)markType - the type of the mark.javax.servlet.jsp.JspExceptionCopyright © 2018 DuraSpace. All Rights Reserved.