Skip to content

Commit

Permalink
Merge pull request #5276 from eclipse-ee4j/mojarra_issue_5272
Browse files Browse the repository at this point in the history
  • Loading branch information
arjantijms authored Jul 21, 2023
2 parents 7902f2b + b590ed4 commit 36bf2a0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
8 changes: 8 additions & 0 deletions impl/src/main/java/com/sun/faces/config/WebConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ public class WebConfiguration {
private FaceletsConfiguration faceletsConfig;

private boolean hasFlows;

private String specificationVersion;

// ------------------------------------------------------------ Constructors

Expand All @@ -134,6 +136,8 @@ private WebConfiguration(ServletContext servletContext) {
getOptionValue(WebContextInitParameter.ResourceExcludes, " ");
getOptionValue(WebContextInitParameter.FaceletsViewMappings, ";");
getOptionValue(WebContextInitParameter.FaceletsSuffix, " ");

specificationVersion = getClass().getPackage().getSpecificationVersion();
}

// ---------------------------------------------------------- Public Methods
Expand Down Expand Up @@ -200,6 +204,10 @@ public void setHasFlows(boolean hasFlows) {
this.hasFlows = hasFlows;
}

public String getSpecificationVersion() {
return specificationVersion;
}

/**
* Obtain the value of the specified boolean parameter
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import java.util.logging.Logger;

import com.sun.faces.RIConstants;
import com.sun.faces.config.WebConfiguration;
import com.sun.faces.context.flash.ELFlash;
import com.sun.faces.renderkit.html_basic.ScriptRenderer;
import com.sun.faces.renderkit.html_basic.StylesheetRenderer;
Expand Down Expand Up @@ -130,7 +131,12 @@ public ExternalContextImpl(ServletContext sc, ServletRequest request, ServletRes

boolean enabled = ContextParamUtils.getValue(servletContext, SendPoweredByHeader, Boolean.class);
if (enabled) {
((HttpServletResponse) response).addHeader("X-Powered-By", "Faces/3.0");
String poweredBy = "Faces";
String specificationVersion = WebConfiguration.getInstance(sc).getSpecificationVersion();
if (specificationVersion != null) {
poweredBy += "/" + specificationVersion;
}
((HttpServletResponse) response).addHeader("X-Powered-By", poweredBy);
}

distributable = ContextParamUtils.getValue(servletContext, ContextParam.EnableDistributable, Boolean.class);
Expand Down

0 comments on commit 36bf2a0

Please sign in to comment.