添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
problem:
WARNING: JSF1091: No mime type could be found for the file dynamiccontent. To resolve this, add a mapping to web.xml mime-type application
my code:
package com.teste;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import javax.imageio.ImageIO;
import javax.inject.Named;
import org.primefaces.model.DefaultStreamedContent;
import org.primefaces.model.StreamedContent;
@Named
public class DynamicImageController implements java.io.Serializable {
private StreamedContent graphicText;
public DynamicImageController() {
try {
//Graphic Text
BufferedImage bufferedImg = new BufferedImage(100, 25, BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = bufferedImg.createGraphics();
g2.drawString("This is a text", 0, 10);
ByteArrayOutputStream os = new ByteArrayOutputStream();
ImageIO.write(bufferedImg, "png", os);
graphicText = new DefaultStreamedContent(new ByteArrayInputStream(os.toByteArray()), "image/png");
} catch (Exception e) {
public StreamedContent getGraphicText() {
return graphicText;
XHTML
<h:form>
<p:graphicImage value="#{dynamicImageController.graphicText}"/><br/>
</h:form>
Question
Anyone know a way to remove these warnings? or solve the problem?
Have you read the actual error? And did you try to use google or one of its friends?
Oh, and read the PLEASE PLEASE PLEASE... topic in this forum, it's almost the first one/top one
Cheers,
Ronald
kevinpauli wrote: I have been googling on this exact same topic for hours now, trying many of the various proffered solutions to no avail. Due to the number of people with the problem it is obviously not an easy fix, as your response seems to imply. If there is such a simple solution, would you mind sharing a link?
Have you found a solution for this? I have the same problem. I've read all topics about it on this forum:
viewtopic.php?f=3&t=20323
viewtopic.php?f=3&t=16639
viewtopic.php?f=3&t=16145
viewtopic.php?f=3&t=24403&start=10
viewtopic.php?f=3&t=15271
And still no solution.
The image shows up the first time, but if I refresh the page I get the same error you mentioned.
Rinaldo wrote: The image shows up the first time, but if I refresh the page I get the same error you mentioned.
Hmmm, interesting. Shows up first time? This is similar to the fileDownload behavior/issue that has been discussed many times in this forum. I solved this issue/behavior in my JSF/PrimeFaces web app months ago; solution is to re-call the same code that populates the streamed content (on page refresh requests). See below.
viewtopic.php?f=3&t=8845&p=61892#p61892
viewtopic.php?f=3&t=19923&p=61891#p61891
Howard
PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome
Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache
kevinpauli wrote: I have been googling on this exact same topic for hours now, trying many of the various proffered solutions to no avail. Due to the number of people with the problem it is obviously not an easy fix, as your response seems to imply. If there is such a simple solution, would you mind sharing a link?
I searched google for the following:
stackoverflow WARNING: JSF1091: No mime type could be found for the file dynamiccontent
Found the following:
http://stackoverflow.com/questions/9525 ... primefaces
I did this BEFORE my previous post/response above. :)
Howard
PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome
Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache
smithh032772 wrote:
Rinaldo wrote: The image shows up the first time, but if I refresh the page I get the same error you mentioned.
Hmmm, interesting. Shows up first time? This is similar to the fileDownload behavior/issue that has been discussed many times in this forum. I solved this issue/behavior in my JSF/PrimeFaces web app months ago; solution is to re-call the same code that populates the streamed content (on page refresh requests). See below.
viewtopic.php?f=3&t=8845&p=61892#p61892
viewtopic.php?f=3&t=19923&p=61891#p61891
YES! You are right! It works now!
Thank you very very very much. :D
And.. It actually makes sense, since it's a stream, it's going to be empty the second time. :P
  • ↳   PrimeFaces Theme Designer API
  • ↳   PrimeNG Theme Designer API
  • ↳   PrimeReact Theme Designer API
  • ↳   PrimeVue Theme Designer API
  • UI Kit
  • ↳   Figma
  • Add-Ons
  • ↳   PrimeFlex
  • ↳   PrimeIcons
  • PrimeUI
  • ↳   PrimeUI
  • ↳   Made with Prime
  • ↳   Spanish
  • Premium Layouts and Themes
  • ↳   Freya
  • ↳   Freya - PrimeFaces
  • ↳   Freya - PrimeNG
  • ↳   Freya - PrimeVue
  • ↳   Freya - PrimeReact
  • ↳   Rain
  • ↳   Rain - PrimeFaces
  • ↳   Diamond
  • ↳   Diamond - PrimeFaces
  • ↳   Diamond - PrimeNG
  • ↳   Diamond - PrimeVue
  • ↳   Diamond - PrimeReact
  • ↳   Pandora
  • ↳   Pandora - PrimeFaces
  • ↳   Siberia
  • ↳   Siberia - PrimeFaces
  • ↳   Mirage
  • ↳   Mirage - PrimeFaces
  • ↳   Mirage - PrimeNG
  • ↳   Prestige
  • ↳   Prestige - PrimeFaces
  • ↳   Prestige - PrimeNG
  • ↳   Prestige - PrimeVue
  • ↳   Sapphire
  • ↳   Sapphire - PrimeFaces
  • ↳   Sapphire - PrimeNG
  • ↳   Sapphire - PrimeReact
  • ↳   Sapphire - PrimeVue
  • ↳   Roma
  • ↳   Roma - PrimeFaces
  • ↳   Roma - PrimeNG
  • ↳   Roma - PrimeReact
  • ↳   Roma - PrimeVue
  • ↳   Babylon
  • ↳   Babylon - PrimeFaces
  • ↳   Babylon - PrimeNG
  • ↳   Babylon - PrimeReact
  • ↳   Babylon - PrimeVue
  • ↳   Olympia
  • ↳   Olympia - PrimeFaces
  • ↳   Olympia - PrimeNG
  • ↳   Ecuador
  • ↳   Ecuador - PrimeFaces
  • ↳   Ecuador - PrimeNG
  • ↳   Harmony
  • ↳   Harmony - PrimeFaces
  • ↳   Harmony - PrimeNG
  • ↳   California
  • ↳   California - PrimeFaces
  • ↳   California - PrimeNG
  • ↳   Serenity
  • ↳   Serenity - PrimeFaces
  • ↳   Serenity - PrimeNG
  • ↳   Serenity - PrimeReact
  • ↳   Serenity - PrimeVue
  • ↳   Avalon
  • ↳   Avalon - PrimeFaces
  • ↳   Avalon - PrimeNG
  • ↳   Avalon - PrimeReact
  • ↳   Avalon - PrimeVue
  • ↳   Apollo
  • ↳   Apollo - PrimeFaces
  • ↳   Apollo - PrimeNG
  • ↳   Apollo - PrimeReact
  • ↳   Apollo - PrimeVue
  • ↳   Manhattan
  • ↳   Manhattan - PrimeFaces
  • ↳   Manhattan - PrimeNG
  • ↳   Paradise
  • ↳   Paradise - PrimeFaces
  • ↳   Paradise - PrimeNG
  • ↳   Barcelona
  • ↳   Barcelona - PrimeFaces
  • ↳   Barcelona - PrimeNG
  • ↳   Atlantis
  • ↳   Atlantis - PrimeFaces
  • ↳   Atlantis - PrimeNG
  • ↳   Atlantis - PrimeReact
  • ↳   Atlantis - PrimeVue
  • ↳   Morpheus
  • ↳   Morpheus - PrimeFaces
  • ↳   Morpheus - PrimeNG
  • ↳   Verona
  • ↳   Verona - PrimeFaces
  • ↳   Verona - PrimeNG
  • ↳   Verona - PrimeVue
  • ↳   Poseidon
  • ↳   Poseidon - PrimeFaces
  • ↳   Poseidon - PrimeNG
  • ↳   Poseidon - PrimeVue
  • ↳   Ultima
  • ↳   Ultima - PrimeFaces
  • ↳   Ultima - PrimeNG
  • ↳   Ultima - PrimeReact
  • ↳   Ultima - PrimeVue
  • ↳   Omega
  • ↳   Omega - PrimeFaces
  • ↳   Omega - PrimeNG
  • ↳   Icarus
  • ↳   Legacy
  • ↳   Venture
  • ↳   Olympos
  • ↳   Atlas
  • ↳   Titan
  • ↳   Volt
  • ↳   Adamantium
  • ↳   Rio
  • ↳   Ronin
  • ↳   Spark
  • ↳   Sentinel
  • ↳   Modena
  •