Permalink
Browse files

Add Faces#getProjectStage()

  • Loading branch information...
1 parent 0c57bb5 commit 9b0c984e8e3df096f35718ff57d5df9d6a0bc921 @BalusC BalusC committed Nov 28, 2016
Showing with 20 additions and 0 deletions.
  1. +12 −0 src/main/java/org/omnifaces/util/Faces.java
  2. +8 −0 src/main/java/org/omnifaces/util/FacesLocal.java
@@ -37,6 +37,7 @@
import javax.faces.application.Application;
import javax.faces.application.ApplicationFactory;
import javax.faces.application.NavigationHandler;
+import javax.faces.application.ProjectStage;
import javax.faces.application.ViewHandler;
import javax.faces.component.UIViewParameter;
import javax.faces.component.UIViewRoot;
@@ -295,6 +296,17 @@ public static String getServerInfo() {
}
/**
+ * Returns the project stage. This will return the <code>javax.faces.PROJECT_STAGE</code> context parameter in
+ * <code>web.xml</code>.
+ * @return The project stage.
+ * @see Application#getProjectStage()
+ * @since 2.6
+ */
+ public static ProjectStage getProjectStage() {
+ return FacesLocal.getProjectStage(getContext());
+ }
+
+ /**
* Returns whether we're in development stage. This will be the case when the <code>javax.faces.PROJECT_STAGE</code>
* context parameter in <code>web.xml</code> is set to <code>Development</code>.
* <p>
@@ -156,6 +156,14 @@ public static String getServerInfo(FacesContext context) {
/**
* {@inheritDoc}
+ * @see Faces#getProjectStage()
+ */
+ public static ProjectStage getProjectStage(FacesContext context) {
+ return context.getApplication().getProjectStage();
+ }
+
+ /**
+ * {@inheritDoc}
* @see Faces#isDevelopment()
*/
public static boolean isDevelopment(FacesContext context) {

0 comments on commit 9b0c984

Please sign in to comment.