Class BeanUtils

java.lang.Object
io.goobi.viewer.managedbeans.utils.BeanUtils

public final class BeanUtils extends Object
Utility class for methods that use the FacesContext.
  • 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 - a FacesContext object.
      Returns:
      a HttpServletRequest object.
    • getSession

      public static javax.servlet.http.HttpSession getSession()

      getSession.

      Returns:
      HttpSession from current request
    • getServletPathWithHostAsUrlFromJsfContext

      public static String 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.

      Parameters:
      request - a HttpServletRequest object.
      theme - a String object.
      Returns:
      a String object.
    • getServletContext

      public static javax.servlet.ServletContext getServletContext()

      getServletContext.

      Returns:
      a ServletContext object.
    • getInitialLocale

      public static Locale getInitialLocale()

      getInitialLocale.

      Returns:
      Currently selected or default Locale
    • getLocale

      public static Locale getLocale()

      getLocale.

      Returns:
      Current Locale in NavigationHelper; default locale if none found
    • getDefaultLocale

      public static Locale getDefaultLocale()

      getDefaultLocale.

      Returns:
      a Locale object.
    • getBeanByName

      public static Object getBeanByName(String name, Class clazz)

      getBeanByName.

      Parameters:
      name - a String object.
      clazz - a Class object.
      Returns:
      a Object object.
    • getNavigationHelper

      public static NavigationHelper getNavigationHelper()

      getNavigationHelper.

      Returns:
      a NavigationHelper object.
    • getAdminBean

      public static AdminBean getAdminBean()

      getAdminBean.

      Returns:
      a AdminBean object.
    • getCollectionViewBean

      public static CollectionViewBean getCollectionViewBean()

      getCollectionViewBean.

      Returns:
      a CollectionViewBean object
    • getActiveDocumentBean

      public static ActiveDocumentBean getActiveDocumentBean()

      getActiveDocumentBean.

      Returns:
      a ActiveDocumentBean object.
    • getPersistentStorageBean

      public static PersistentStorageBean getPersistentStorageBean()

      getPersistentStorageBean.

      Returns:
      a PersistentStorageBean object
    • getSearchBean

      public static SearchBean getSearchBean()

      getSearchBean.

      Returns:
      a SearchBean object.
    • getBookmarkBean

      public static BookmarkBean getBookmarkBean()

      getBookmarkBean.

      Returns:
      a BookmarkBean object
    • getCreateRecordBean

      public static CreateRecordBean getCreateRecordBean()

      getCreateRecordBean.

      Returns:
      a CreateRecordBean object
    • getCMSCollectionsBean

      public static CmsCollectionsBean getCMSCollectionsBean()

      getCMSCollectionsBean.

      Returns:
      a CmsCollectionsBean object.
    • getMetadataBean

      public static MetadataBean getMetadataBean()

      getMetadataBean.

      Returns:
      a MetadataBean object.
    • getCmsBean

      public static CmsBean getCmsBean()

      getCmsBean.

      Returns:
      a CmsBean object.
    • getCmsMediaBean

      public static CmsMediaBean getCmsMediaBean()

      getCmsMediaBean.

      Returns:
      a CmsMediaBean object.
    • getCalendarBean

      public static CalendarBean getCalendarBean()

      getCalendarBean.

      Returns:
      a CalendarBean object.
    • getCaptchaBean

      public static CaptchaBean getCaptchaBean()

      getCaptchaBean.

      Returns:
      a CaptchaBean object.
    • getUserBean

      public static UserBean getUserBean()

      getUserBean.

      Returns:
      a UserBean object.
    • getSessionBean

      public static SessionBean getSessionBean()

      getSessionBean.

      Returns:
      a SessionBean object
    • getImageDeliveryBean

      public static ImageDeliveryBean getImageDeliveryBean()

      getImageDeliveryBean.

      Returns:
      a ImageDeliveryBean object.
    • getBrowseBean

      public static BrowseBean getBrowseBean()

      getBrowseBean.

      Returns:
      a BrowseBean object.
    • getContentBean

      public static ContentBean getContentBean()

      getUserBean.

      Returns:
      a ContentBean object.
    • getUserBeanFromRequest

      public static UserBean getUserBeanFromRequest(javax.servlet.http.HttpServletRequest request)

      getUserBeanFromRequest.

      Parameters:
      request - a HttpServletRequest object.
      Returns:
      a UserBean object.
    • getBeanFromRequest

      public static <T> Optional<T> getBeanFromRequest(javax.servlet.http.HttpServletRequest request, String beanName, Class<T> clazz)

      getBeanFromRequest.

      Type Parameters:
      T - a T class
      Parameters:
      request - a HttpServletRequest object
      beanName - a String object
      clazz - a Class object
      Returns:
      a Optional object
    • getUserFromRequest

      public static User getUserFromRequest(javax.servlet.http.HttpServletRequest request)

      getUserFromRequest.

      Parameters:
      request - a HttpServletRequest object.
      Returns:
      a User object.
    • escapeCriticalUrlChracters

      public static String escapeCriticalUrlChracters(String value)

      escapeCriticalUrlChracters.

      Parameters:
      value - a String object.
      Returns:
      a String object.
    • findInstanceInSessionAttributes

      public static <T> Optional<T> findInstanceInSessionAttributes(javax.servlet.http.HttpServletRequest request, Class<T> clazz)

      findInstanceInSessionAttributes.

      Type Parameters:
      T - a T class
      Parameters:
      request - a HttpServletRequest object
      clazz - a Class object
      Returns:
      a Optional object
    • getResponse

      public static javax.servlet.http.HttpServletResponse getResponse()

      getResponse.

      Returns:
      a HttpServletResponse object.
    • getManagedBeanValue

      public static Object getManagedBeanValue(String expr)

      getManagedBeanValue.

      Parameters:
      expr - a String object
      Returns:
      a Object object