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!

Author:
Gerhard Petracek

Method Summary
static String addRequestParameter(javax.faces.context.ExternalContext externalContext, String url)
          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> getRequestParameters(javax.faces.context.ExternalContext externalContext, boolean filterViewState)
          Exposes all request-parameters (including or excluding the view-state)
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
 

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

addRequestParameter

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

Parameters:
externalContext - current external-context
url - current url
Returns:
url with request-parameters

getRequestParameters

public static Set<RequestParameter> getRequestParameters(javax.faces.context.ExternalContext externalContext,
                                                         boolean filterViewState)
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
Returns:
current request-parameters


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