我试图覆盖Primeface的7.0 MediaRenderer,我用Primeface的8.0方法创建了自己的MyMediaRenderer:
public class MyMediaRenderer extends org.primefaces.component.media.MediaRenderer {
@Override
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
...
if (value instanceof StreamedContent && PDFPlayer.MIME_TYPE.equals(player.getType())) {
...
}
...
}
}
我还在src/main/webapp/WEB-INF/faces-config的末尾添加了.xml:
<render-kit>
<renderer>
<component-family>org.primefaces.component.media</component-family>
<renderer-type>org.primefaces.component.media.MediaRenderer</renderer-type>
<renderer-class>redacted.MyMediaRenderer</renderer-class>
</renderer>
</render-kit>
</faces-config>
我在这里错过了什么?该方法仍然从org.primefaces.component.media.MediaRenderer调用
您的渲染套件不正确,请使用以下内容:
<renderer>
<component-family>org.primefaces.component</component-family>
<renderer-type>org.primefaces.component.MediaRenderer</renderer-type>
<renderer-class>redacted.MyMediaRenderer</renderer-class>
</renderer>