| java.lang.Object org.dspace.app.util.Util org.dspace.app.webui.util.UIUtil
UIUtil | public class UIUtil extends Util (Code) | | Miscellaneous UI utility methods
author: Robert Tansley version: $Revision: 2168 $ |
Field Summary | |
public static Logger | log |
Method Summary | |
public static String | displayDate(DCDate d, boolean time, boolean localTime, HttpServletRequest request) Write a human-readable version of a DCDate. | public static Collection | getCollectionLocation(HttpServletRequest request) Get the current collection location, that is, where the user "is". | public static Community | getCommunityLocation(HttpServletRequest request) Get the current community location, that is, where the user "is". | public static String | getOriginalURL(HttpServletRequest request) Get the original request URL. | public static String | getRequestLogInfo(HttpServletRequest request) Return a string for logging, containing useful information about the
current request - the URL, the method and parameters.
Parameters: request - the request object. | public static Locale | getSessionLocale(HttpServletRequest request) Get the Locale for a session according to the user's language selection or language preferences. | public static Context | obtainContext(HttpServletRequest request) Obtain a new context object. | public static void | sendAlert(HttpServletRequest request, 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.
The recipient is configured via the "alert.recipient" property in
dspace.cfg . | public static void | storeOriginalURL(HttpServletRequest request) Put the original request URL into the request object as an attribute for
later use. |
log | public static Logger log(Code) | | log4j category
|
displayDate | public static String displayDate(DCDate d, boolean time, boolean localTime, HttpServletRequest request)(Code) | | Write a human-readable version of a DCDate.
Parameters: d - the date Parameters: time - if true, display the time with the date Parameters: localTime - if true, adjust for local timezone, otherwise GMT Parameters: request - the servlet request the date in a human-readable form. |
getCollectionLocation | public static Collection getCollectionLocation(HttpServletRequest request)(Code) | | Get the current collection location, that is, where the user "is". This
returns null if there is no collection location, i.e. the location is
"all of DSpace" or a community.
Parameters: request - current HTTP request the current collection location, or null |
getCommunityLocation | public static Community getCommunityLocation(HttpServletRequest request)(Code) | | Get the current community location, that is, where the user "is". This
returns null if there is no location, i.e. "all of DSpace"
is the location.
Parameters: request - current HTTP request the current community location, or null |
getOriginalURL | public static String getOriginalURL(HttpServletRequest request)(Code) | | Get the original request URL.
Parameters: request - the HTTP request the original request URL |
getRequestLogInfo | public static String getRequestLogInfo(HttpServletRequest request)(Code) | | Return a string for logging, containing useful information about the
current request - the URL, the method and parameters.
Parameters: request - the request object. a multi-line string containing information about the request. |
getSessionLocale | public static Locale getSessionLocale(HttpServletRequest request)(Code) | | Get the Locale for a session according to the user's language selection or language preferences.
Order of selection
- language selected via UI
- language as set by application
- language browser default
Parameters: request - the request Object supportedLocaleLocale supported by this DSpace Instance for this request |
obtainContext | public static Context obtainContext(HttpServletRequest request) throws SQLException(Code) | | Obtain a new context object. If a context object has already been created
for this HTTP request, it is re-used, otherwise it is created. If a user
has authenticated with the system, the current user of the context is set
appropriately.
Parameters: request - the HTTP request a context object |
sendAlert | public static void sendAlert(HttpServletRequest request, Exception exception)(Code) | | 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.
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.
Parameters: request - the HTTP request leading to the error Parameters: exception - the exception causing the error, or null |
storeOriginalURL | public static void storeOriginalURL(HttpServletRequest request)(Code) | | Put the original request URL into the request object as an attribute for
later use. This is necessary because forwarding a request removes this
information. The attribute is only written if it hasn't been before; thus
it can be called after a forward safely.
Parameters: request - the HTTP request |
|
|