org.rhq.core.gui.util
Class FacesContextUtility

java.lang.Object
  extended by org.rhq.core.gui.util.FacesContextUtility

public abstract class FacesContextUtility
extends Object

A set of utility methods for working with the current JSF FacesContext.

Author:
Ian Springer

Constructor Summary
FacesContextUtility()
           
 
Method Summary
static void addMessage(javax.faces.application.FacesMessage.Severity severity, String summary)
          Adds a message to the global context so it will be displayed via <h:messages>.
static void addMessage(javax.faces.application.FacesMessage.Severity severity, String summary, String detail)
          Adds a message to the global context so it will be displayed via <h:messages>.
static void addMessage(javax.faces.application.FacesMessage.Severity severity, String summary, Throwable t)
          Adds a message to the global context so it will be displayed via <h:messages>.
static void clearMessages()
           
static void clearMessages(String clientId)
           
static
<T> T
getBean(Class<T> type)
           
static javax.faces.context.FacesContext getFacesContext()
           
static
<T> T
getManagedBean(Class<T> type)
           
static String getOptionalRequestParameter(String paramName)
           
static
<T> T
getOptionalRequestParameter(String paramName, Class<T> type)
           
static
<T> T
getOptionalRequestParameter(String paramName, Class<T> type, T defaultValue)
           
static String getOptionalRequestParameter(String paramName, String defaultValue)
           
static javax.servlet.http.HttpServletRequest getRequest()
          Return the current request.
static String getRequiredRequestParameter(String paramName)
           
static
<T> T
getRequiredRequestParameter(String paramName, Class<T> type)
           
static javax.servlet.http.HttpServletResponse getResponse()
           
static String getViewId()
           
static
<T> void
removeSessionScopedBean(Class<T> type)
           
static void setBean(Object object)
           
static void setManagedBean(Object managedBean)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FacesContextUtility

public FacesContextUtility()
Method Detail

getOptionalRequestParameter

@Nullable
public static String getOptionalRequestParameter(@NotNull
                                                          String paramName)

getOptionalRequestParameter

@Nullable
public static <T> T getOptionalRequestParameter(@NotNull
                                                         String paramName,
                                                         Class<T> type)

getOptionalRequestParameter

@Nullable
public static String getOptionalRequestParameter(@NotNull
                                                          String paramName,
                                                          String defaultValue)

getOptionalRequestParameter

@Nullable
public static <T> T getOptionalRequestParameter(@NotNull
                                                         String paramName,
                                                         Class<T> type,
                                                         T defaultValue)

getRequiredRequestParameter

@NotNull
public static String getRequiredRequestParameter(@NotNull
                                                         String paramName)

getRequiredRequestParameter

@NotNull
public static <T> T getRequiredRequestParameter(@NotNull
                                                        String paramName,
                                                        Class<T> type)

getRequest

public static javax.servlet.http.HttpServletRequest getRequest()
Return the current request.

Returns:
the current request

getResponse

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

addMessage

public static void addMessage(@NotNull
                              javax.faces.application.FacesMessage.Severity severity,
                              @NotNull
                              String summary)
Adds a message to the global context so it will be displayed via <h:messages>. The message will have no detail.

Parameters:
severity - the FacesMessage severity (FacesMessage.SEVERITY_WARN, etc.)
summary - localized summary message text

addMessage

public static void addMessage(@NotNull
                              javax.faces.application.FacesMessage.Severity severity,
                              @NotNull
                              String summary,
                              @Nullable
                              Throwable t)
Adds a message to the global context so it will be displayed via <h:messages>.

Parameters:
severity - the FacesMessage severity (FacesMessage.SEVERITY_WARN, etc.)
summary - localized summary message text
t - an exception that will be used to construct the detail portion of the message; if null, no detail will be included in the message

addMessage

public static void addMessage(@NotNull
                              javax.faces.application.FacesMessage.Severity severity,
                              @NotNull
                              String summary,
                              @Nullable
                              String detail)
Adds a message to the global context so it will be displayed via <h:messages>.

Parameters:
severity - the FacesMessage severity (FacesMessage.SEVERITY_WARN, etc.)
summary - localized summary message text
detail - localized detail message text; if null, no detail will be included in the message

getFacesContext

@NotNull
public static javax.faces.context.FacesContext getFacesContext()

getViewId

public static String getViewId()

getBean

public static <T> T getBean(Class<T> type)

removeSessionScopedBean

public static <T> void removeSessionScopedBean(Class<T> type)

getManagedBean

public static <T> T getManagedBean(Class<T> type)

setManagedBean

public static void setManagedBean(Object managedBean)

setBean

public static void setBean(Object object)

clearMessages

public static void clearMessages()

clearMessages

public static void clearMessages(String clientId)


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.