Skip to content
Permalink
Browse files

Add Faces#getInitParameterOrDefault()

  • Loading branch information...
BalusC committed Feb 3, 2018
1 parent 3db555c commit 808015176ea5d28af18097a927b35107c17929a1
Showing with 22 additions and 0 deletions.
  1. +15 −0 src/main/java/org/omnifaces/util/Faces.java
  2. +7 −0 src/main/java/org/omnifaces/util/FacesLocal.java
@@ -1947,6 +1947,21 @@ public static String getInitParameter(String name) {
return FacesLocal.getInitParameter(getContext(), name);
}

/**
* Returns the application initialization parameter. This returns the <code>&lt;param-value&gt;</code> of a
* <code>&lt;context-param&gt;</code> in <code>web.xml</code> associated with the given
* <code>&lt;param-name&gt;</code>.
* @param name The application initialization parameter name.
* @param defaultValue The default value if there is no application initialization parameter value associated with the given name.
* @return The application initialization parameter value associated with the given name, or <code>defaultValue</code> if
* there is none.
* @see ExternalContext#getInitParameter(String)
* @since 3.1
*/
public static String getInitParameterOrDefault(String name, String defaultValue) {
return FacesLocal.getInitParameterOrDefault(getContext(), name, defaultValue);
}

/**
* Returns the mime type for the given file name. The mime type is determined based on file extension and
* configureable by <code>&lt;mime-mapping&gt;</code> entries in <code>web.xml</code>. When the mime type is
@@ -1327,6 +1327,13 @@ public static String getInitParameter(FacesContext context, String name) {
return context.getExternalContext().getInitParameter(name);
}

/**
* @see Faces#getInitParameterOrDefault(String)
*/
public static String getInitParameterOrDefault(FacesContext context, String name, String defaultValue) {
return context.getExternalContext().getInitParameterMap().getOrDefault(name, defaultValue);
}

/**
* @see Faces#getMimeType(String)
*/

0 comments on commit 8080151

Please sign in to comment.
You can’t perform that action at this time.