Class BeanUtils
java.lang.Object
io.goobi.viewer.managedbeans.utils.BeanUtils
Utility class for methods that use the FacesContext.
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
escapeCriticalUrlChracters
(String value) escapeCriticalUrlChracters.static <T> Optional<T>
findInstanceInSessionAttributes
(javax.servlet.http.HttpServletRequest request, Class<T> clazz) findInstanceInSessionAttributes.static ActiveDocumentBean
getActiveDocumentBean.static AdminBean
getAdminBean.static Object
getBeanByName
(String name, Class clazz) getBeanByName.static <T> Optional<T>
getBeanFromRequest
(javax.servlet.http.HttpServletRequest request, String beanName, Class<T> clazz) getBeanFromRequest.static BookmarkBean
getBookmarkBean.static BrowseBean
getBrowseBean.static CalendarBean
getCalendarBean.static CaptchaBean
getCaptchaBean.static CmsBean
getCmsBean.static CmsCollectionsBean
getCMSCollectionsBean.static CmsMediaBean
getCmsMediaBean.static CollectionViewBean
getCollectionViewBean.static ContentBean
getUserBean.static CreateRecordBean
getCreateRecordBean.static Locale
getDefaultLocale.static ImageDeliveryBean
getImageDeliveryBean.static Locale
getInitialLocale.static Locale
getLocale.static Object
getManagedBeanValue
(String expr) getManagedBeanValue.static MetadataBean
getMetadataBean.static NavigationHelper
getNavigationHelper.static PersistentStorageBean
getPersistentStorageBean.static javax.servlet.http.HttpServletRequest
Gets the current Request from the faces contextstatic javax.servlet.http.HttpServletRequest
getRequest
(javax.faces.context.FacesContext context) getRequest.static javax.servlet.http.HttpServletResponse
getResponse.static SearchBean
getSearchBean.static javax.servlet.ServletContext
getServletContext.static String
getServletImagesPathFromRequest
(javax.servlet.http.HttpServletRequest request, String theme) getServletImagesPathFromRequest.static String
retrieve complete Servlet url from servlet context, including Url, Port, Servletname etc. call this method only from jsf contextstatic javax.servlet.http.HttpSession
getSession.static SessionBean
getSessionBean.static UserBean
getUserBean.static UserBean
getUserBeanFromRequest
(javax.servlet.http.HttpServletRequest request) getUserBeanFromRequest.static User
getUserFromRequest
(javax.servlet.http.HttpServletRequest request) getUserFromRequest.static boolean
hasJsfContext.
-
Method Details
-
getRequest
public static javax.servlet.http.HttpServletRequest getRequest()Gets the current Request from the faces context- Returns:
- a
HttpServletRequest
object.
-
getRequest
public static javax.servlet.http.HttpServletRequest getRequest(javax.faces.context.FacesContext context) getRequest.
- Parameters:
context
- aFacesContext
object.- Returns:
- a
HttpServletRequest
object.
-
getSession
public static javax.servlet.http.HttpSession getSession()getSession.
- Returns:
- HttpSession from current request
-
getServletPathWithHostAsUrlFromJsfContext
retrieve complete Servlet url from servlet context, including Url, Port, Servletname etc. call this method only from jsf context- Returns:
- complete url as string
-
hasJsfContext
public static boolean hasJsfContext()hasJsfContext.
- Returns:
- a boolean.
-
getServletImagesPathFromRequest
public static String getServletImagesPathFromRequest(javax.servlet.http.HttpServletRequest request, String theme) getServletImagesPathFromRequest.
-
getServletContext
public static javax.servlet.ServletContext getServletContext()getServletContext.
- Returns:
- a
ServletContext
object.
-
getInitialLocale
getInitialLocale.
- Returns:
- Currently selected or default
Locale
-
getLocale
getLocale.
- Returns:
- Current Locale in
NavigationHelper
; default locale if none found
-
getDefaultLocale
getDefaultLocale.
- Returns:
- a
Locale
object.
-
getBeanByName
getBeanByName.
-
getAdminBean
getAdminBean.
- Returns:
- a
AdminBean
object.
-
getCollectionViewBean
getCollectionViewBean.
- Returns:
- a
CollectionViewBean
object
-
getActiveDocumentBean
getActiveDocumentBean.
- Returns:
- a
ActiveDocumentBean
object.
-
getPersistentStorageBean
getPersistentStorageBean.
- Returns:
- a
PersistentStorageBean
object
-
getSearchBean
getSearchBean.
- Returns:
- a
SearchBean
object.
-
getBookmarkBean
getBookmarkBean.
- Returns:
- a
BookmarkBean
object
-
getCreateRecordBean
getCreateRecordBean.
- Returns:
- a
CreateRecordBean
object
-
getCMSCollectionsBean
getCMSCollectionsBean.
- Returns:
- a
CmsCollectionsBean
object.
-
getMetadataBean
getMetadataBean.
- Returns:
- a
MetadataBean
object.
-
getCmsBean
getCmsBean.
- Returns:
- a
CmsBean
object.
-
getCmsMediaBean
getCmsMediaBean.
- Returns:
- a
CmsMediaBean
object.
-
getCalendarBean
getCalendarBean.
- Returns:
- a
CalendarBean
object.
-
getCaptchaBean
getCaptchaBean.
- Returns:
- a
CaptchaBean
object.
-
getUserBean
getUserBean.
- Returns:
- a
UserBean
object.
-
getSessionBean
getSessionBean.
- Returns:
- a
SessionBean
object
-
getImageDeliveryBean
getImageDeliveryBean.
- Returns:
- a
ImageDeliveryBean
object.
-
getBrowseBean
getBrowseBean.
- Returns:
- a
BrowseBean
object.
-
getContentBean
getUserBean.
- Returns:
- a
ContentBean
object.
-
getUserBeanFromRequest
getUserBeanFromRequest.
- Parameters:
request
- aHttpServletRequest
object.- Returns:
- a
UserBean
object.
-
getBeanFromRequest
public static <T> Optional<T> getBeanFromRequest(javax.servlet.http.HttpServletRequest request, String beanName, Class<T> clazz) getBeanFromRequest.
-
getUserFromRequest
getUserFromRequest.
- Parameters:
request
- aHttpServletRequest
object.- Returns:
- a
User
object.
-
escapeCriticalUrlChracters
escapeCriticalUrlChracters.
-
findInstanceInSessionAttributes
public static <T> Optional<T> findInstanceInSessionAttributes(javax.servlet.http.HttpServletRequest request, Class<T> clazz) findInstanceInSessionAttributes.
-
getResponse
public static javax.servlet.http.HttpServletResponse getResponse()getResponse.
- Returns:
- a
HttpServletResponse
object.
-
getManagedBeanValue
getManagedBeanValue.
-