org.hdpagination.web.jsf.util
Class FacesContextUtil

java.lang.Object
  extended by org.hdpagination.web.jsf.util.FacesContextUtil

public final class FacesContextUtil
extends java.lang.Object

JSF context utility class

Since:
1.1
Author:
Liangfeng Ren

Method Summary
static java.util.Map getCustomScopedMap(javax.faces.context.FacesContext facesContext, java.lang.String scopeMapExpr)
          Get the instance of Map which represents custom scope(only supported since JSF 2).
static javax.servlet.http.HttpServletRequest getHttpRequest(javax.faces.context.FacesContext facesContext)
          Get HttpServletRequest from JSF Context
static java.lang.Object getSessionAttribute(javax.faces.context.FacesContext facesContext, java.lang.String attrName)
          Get value of attribute in session
static void setApplicationAttribute(javax.faces.context.FacesContext facesContext, java.lang.String attrName, java.lang.Object value)
          Set value of attribute in application scope (Servlet Context)
static void setCustomScopedAttribute(javax.faces.context.FacesContext facesContext, java.lang.String scopeMapExpr, java.lang.String attrName, java.lang.Object value)
          Set value of attribute in custom scope (only supported since JSF 2).
static void setRequestAttribute(javax.faces.context.FacesContext facesContext, java.lang.String attrName, java.lang.Object value)
          Set value of attribute in request
static void setSessionAttribute(javax.faces.context.FacesContext facesContext, java.lang.String attrName, java.lang.Object value)
          Set value of attribute in session
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getHttpRequest

public static javax.servlet.http.HttpServletRequest getHttpRequest(javax.faces.context.FacesContext facesContext)
Get HttpServletRequest from JSF Context

Parameters:
facesContext -
Returns:

getSessionAttribute

public static java.lang.Object getSessionAttribute(javax.faces.context.FacesContext facesContext,
                                                   java.lang.String attrName)
Get value of attribute in session

Parameters:
facesContext -
attrName - attribute name
Returns:
value of attribute

setSessionAttribute

public static void setSessionAttribute(javax.faces.context.FacesContext facesContext,
                                       java.lang.String attrName,
                                       java.lang.Object value)
Set value of attribute in session

Parameters:
facesContext -
attrName - attribute name
value - attribute value

setRequestAttribute

public static void setRequestAttribute(javax.faces.context.FacesContext facesContext,
                                       java.lang.String attrName,
                                       java.lang.Object value)
Set value of attribute in request

Parameters:
facesContext -
attrName - attribute name
value - attribute value

setApplicationAttribute

public static void setApplicationAttribute(javax.faces.context.FacesContext facesContext,
                                           java.lang.String attrName,
                                           java.lang.Object value)
Set value of attribute in application scope (Servlet Context)

Parameters:
facesContext -
attrName - attribute name
value - attribute value

setCustomScopedAttribute

public static void setCustomScopedAttribute(javax.faces.context.FacesContext facesContext,
                                            java.lang.String scopeMapExpr,
                                            java.lang.String attrName,
                                            java.lang.Object value)
Set value of attribute in custom scope (only supported since JSF 2). Any EL Expression that resolves to class that implements Map can be used as the custom scope as specified by JSF 2.0

Parameters:
facesContext -
scopeMapExpr - The EL expression to parse (The EL Expression must resolve to class that implements java.util.Map)
attrName - attribute name
value - attribute value

getCustomScopedMap

public static java.util.Map getCustomScopedMap(javax.faces.context.FacesContext facesContext,
                                               java.lang.String scopeMapExpr)
Get the instance of Map which represents custom scope(only supported since JSF 2). Any EL Expression that resolves to class that implements Map can be used as the custom scope as specified by JSF 2

Parameters:
facesContext -
scopeMapExpr - The EL expression to parse (The EL Expression must resolve to class that implements java.util.Map)
Returns:


Copyright © 2008 HDPagination All Rights Reserved.