WARNING: JSF1091: mime file type not found for dynamiccontent file

The following warning appears in eclipse:

WARNING: JSF1091: No mime type could be found for file dynamiccontent. To resolve this, add a mime-type mapping to the applications web.xml 

This error occurs when sending an image.

lower linkage:

 <p:graphicImage value="#{bean.image}"/> 

Java Bean:

 private StreamedContent image; // Getter public StreamedContent getImage() { try { JFreeChart jfreechart = ChartFactory.createPieChart3D("", createDataset(), true, true, false); PiePlot3D plot = (PiePlot3D) jfreechart.getPlot(); File chartFile = new File("dynamichart"); ChartUtilities.saveChartAsPNG(chartFile, jfreechart, 375, 300); chartImage = new DefaultStreamedContent(new FileInputStream( chartFile), "image/png"); return chartImage; } catch (Exception e) { e.printStackTrace(); return new DefaultStreamedContent(); } } // generate data for image public static PieDataset createDataset() { DefaultPieDataset dataset = new DefaultPieDataset(); dataset.setValue("A",10); dataset.setValue("B", 11); dataset.setValue("C", 80); dataset.setValue("D", 12); return dataset; } 
+6
source share
6 answers

I found one solution.

using the latest version of performances (3.5).

 <dependency> <groupId>org.primefaces</groupId> <artifactId>primefaces</artifactId> <version>3.5</version> </dependency> 

but there will be unpleasant changes in IHM

+4
source

Try adding the following to your web.xml file:

 <mime-mapping> <extension>jsp <!--{or the extension of file}--></extension> <mime-type>text/html</mime-type> </mime-mapping> 
+5
source

I had a JSF1091 warning for http://example.org and javascript:; , as well as with Icefaces instead of Primefaces.

The change

 <ice:outputLink onclick="..." value="javascript:;">...</ice:outputLink> 

to

 <ice:outputLink onclick="..." value="/some/url">...</ice:outputLink> 

disabled javascript:; warning javascript:; .

The change

 <ice:outputLink value="http://example.org"/> 

to

 <a href="http://example.org"/> 

fixed it for url.

+1
source

Although I am posting this answer after a while, it will probably be useful to other developers who are facing this problem.

To avoid this annoying warning from above, add the following code to your web.xml:

 <mime-mapping> <extension>png</extension> <mime-type>image/png</mime-type> </mime-mapping> 

For more information, please check:

http://blog.eisele.net/2011/01/weblogic-10340-oepe-maven-primefaces.html

+1
source

I just want to share my experience with a similar problem, I use maven , netbeans and payara . As soon as I received this warning:

WARNING Cannot find mime type for file fontawesome-webfont.woff registered

The decision to remove this warning added the following code to web.xml :

 <mime-mapping> <extension>woff</extension> <mime-type>application/font-woff</mime-type> </mime-mapping> 

Note. I had the same warning with different files, these files had different extensions ( woff, eot, woff2 and ttf ). The solution to this was to replace woff with <extension> one of the previously mentioned extensions.

I hope my answer someday helps someone.

PS: I found a solution on this page.

0
source

if you have spring, you can also have (I added most fa-icons):

 @Configuration public class JsfConfigurationMimeMapper implements EmbeddedServletContainerCustomizer { @Override public void customize(ConfigurableEmbeddedServletContainer container) { MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT); mappings.add("xsd", "text/xml; charset=utf-8"); mappings.add("otf", "font/opentype"); mappings.add("ico", "image/x-icon"); mappings.add("svg", "image/svg+xml"); mappings.add("eot", "application/vnd.ms-fontobject"); mappings.add("ttf", "application/x-font-ttf"); mappings.add("woff", "application/x-font-woff"); mappings.add("woff2", "application/x-font-woff2"); mappings.add("xhtml", "application/xml"); container.setMimeMappings(mappings); } } 
0
source

All Articles