Yes, we have extended JSF (actually Oracle ADF) components in order to meet special requirements that could not be done out of the box. You will need to get all of the source files of those renders and do a recursive search for the offending HTML you want removed, the application/xhtml+xml
. This is just to make sure it is in fact inside the HtmlResponseWriter
class. JSF component frameworks can be complex so you never know, there may be other instances where this header is rendered.
Since the HtmlResponseWriter
isn't declared final
like some components are, you can just extend this, and override the method where application/xhtml+xml
is being printed and register it in faces-config.xml
. The only obstacles to this is if there are private variables declared inside of HtmlResponseWriter
being referenced in the method that you need to override. If that is the case you will either not be able to reference them in your reimplementation or you will have to completely re-build a new HtmlResponseWriter
class (by extending the ResponseWriter
and mimicking each method and instance variable). The benefit of extending the HTMLResponseWriter
is that you will pick up any changes (from JSF updates) to it automatically (except in the overridden method of course).
Update:
This is what I did for my faces-config.xml, but it is using Oracle ADF:
<?xml version="1.0" encoding="windows-1252"?>
<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee">
<application>
<default-render-kit-id>oracle.adf.rich</default-render-kit-id>
</application>
<render-kit>
<render-kit-id>oracle.adf.rich</render-kit-id>
<renderer>
<component-family>org.apache.myfaces.trinidad.Input</component-family>
<renderer-type>oracle.adf.rich.Text</renderer-type>
<renderer-class>com.company.jsf.renders.text.CustomRenderer</renderer-class>
</renderer>
</render-kit>
</faces-config>