org.apache.myfaces.extensions.cdi.jsf.impl.util
Class JsfUtils

java.lang.Object
  extended by org.apache.myfaces.extensions.cdi.jsf.impl.util.JsfUtils

@Typed
public abstract class JsfUtils
extends Object

keep in sync with extval!


Field Summary
static String FACES_CONTEXT_MANUAL_WRAPPER_KEY
           
 
Method Summary
static String addParameters(javax.faces.context.ExternalContext externalContext, String url, boolean addRequestParameter, boolean addPageParameter, boolean encodeValues)
          Adds the current request-parameters to the given url
static String encodeURLParameterValue(String value, javax.faces.context.ExternalContext externalContext)
          Encodes the given value using URLEncoder.encode() with the charset returned from ExternalContext.getResponseCharacterEncoding().
static ResourceBundle getCustomFacesMessageBundle(Locale locale)
          Exposes the (optional) custom message-bundle configured in the faces-config for the given Locale
static ResourceBundle getDefaultFacesMessageBundle(Locale locale)
          Exposes the default message-bundle of jsf for the given Locale
static Set<RequestParameter> getParameters(javax.faces.context.ExternalContext externalContext, boolean filterViewState, boolean addRequestParameter, boolean addPageParameter)
          Exposes all request-parameters (including or excluding the view-state)
static
<T> T
getValueOfExpression(String expression, Class<T> targetType)
           
static String getValueOfExpressionAsString(String expression)
           
static void registerPhaseListener(javax.faces.event.PhaseListener phaseListener)
          Adds the given PhaseListener to the application
static void resetCaches()
          Resets all caches of the current request
static void resetConversationCache()
          Resets the conversation cache of the current request
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FACES_CONTEXT_MANUAL_WRAPPER_KEY

public static final String FACES_CONTEXT_MANUAL_WRAPPER_KEY
See Also:
Constant Field Values
Method Detail

resetConversationCache

public static void resetConversationCache()
Resets the conversation cache of the current request


resetCaches

public static void resetCaches()
Resets all caches of the current request


registerPhaseListener

public static void registerPhaseListener(javax.faces.event.PhaseListener phaseListener)
Adds the given PhaseListener to the application

Parameters:
phaseListener - current phase-listener

getDefaultFacesMessageBundle

public static ResourceBundle getDefaultFacesMessageBundle(Locale locale)
Exposes the default message-bundle of jsf for the given Locale

Parameters:
locale - current local
Returns:
default message-bundle

getCustomFacesMessageBundle

public static ResourceBundle getCustomFacesMessageBundle(Locale locale)
Exposes the (optional) custom message-bundle configured in the faces-config for the given Locale

Parameters:
locale - current local
Returns:
custom message-bundle

encodeURLParameterValue

public static String encodeURLParameterValue(String value,
                                             javax.faces.context.ExternalContext externalContext)
Encodes the given value using URLEncoder.encode() with the charset returned from ExternalContext.getResponseCharacterEncoding(). This is exactly how the ExternalContext impl encodes URL parameter values.

Parameters:
value - value which should be encoded
externalContext - current external-context
Returns:
encoded value

addParameters

public static String addParameters(javax.faces.context.ExternalContext externalContext,
                                   String url,
                                   boolean addRequestParameter,
                                   boolean addPageParameter,
                                   boolean encodeValues)
Adds the current request-parameters to the given url

Parameters:
externalContext - current external-context
url - current url
addRequestParameter - flag which indicates if the request params should be added or not
addPageParameter - flag which indicates if the view params should be added or not ViewParameter
encodeValues - flag which indicates if parameter values should be encoded or not
Returns:
url with request-parameters

getParameters

public static Set<RequestParameter> getParameters(javax.faces.context.ExternalContext externalContext,
                                                  boolean filterViewState,
                                                  boolean addRequestParameter,
                                                  boolean addPageParameter)
Exposes all request-parameters (including or excluding the view-state)

Parameters:
externalContext - current external-context
filterViewState - flag which indicates if the view-state should be added or not
addRequestParameter - flag which indicates if the request params should be added or not
addPageParameter - flag which indicates if the view params should be added or not ViewParameter
Returns:
current request-parameters

getValueOfExpression

public static <T> T getValueOfExpression(String expression,
                                         Class<T> targetType)

getValueOfExpressionAsString

public static String getValueOfExpressionAsString(String expression)


Copyright © 2010-2012 The Apache Software Foundation. All Rights Reserved.