Re: Render an Image
Hi, i had to change my sandbox.taglib.xml to: --snip- tag tag-namegraphicImageDynamic/tag-name component component-typeorg.apache.myfaces.custom.graphicimagedynamic.GraphicImageDynamic/component-type renderer-typeorg.apache.myfaces.custom.graphicimagedynamic.GraphicImageDynamicRenderer/renderer-type handler-classfacelets.GraphicImageDynamicComponentHandler/handler-class /component /tag --snap- Then i had to put the jar with the GraphicImageDynamicComponentHandler.class into my WEB-INF-lib folder of my WAR. Then i I looked into the current release of myfaces in the svn and created a jar with all required GraphicImageDynamic-classes. I put this jar into the classpath of my tomcat (jboss)-folder. Now i have this exception. The exception is right: there isn't such a method. Can somebody help me? Thanx! Regards, Udo 17:27:37,048 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception java.lang.NoSuchMethodError: org.apache.myfaces.renderkit.html.util.DummyFormUtils.getDummyFormResponseWriter(Ljavax/faces/context/FacesContext;)Lorg/apache/myfaces/renderkit/html/util/DummyFormResponseWriter; at org.apache.myfaces.renderkit.html.HtmlLinkRendererBase.renderJavaScriptAnchorStart(HtmlLinkRendererBase.java:208) at org.apache.myfaces.renderkit.html.HtmlLinkRendererBase.renderCommandLinkStart(HtmlLinkRendererBase.java:157) at org.apache.myfaces.renderkit.html.HtmlLinkRendererBase.encodeBegin(HtmlLinkRendererBase.java:87) at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:307) at org.apache.myfaces.renderkit.RendererUtils.renderChild(RendererUtils.java:441) at org.apache.myfaces.renderkit.html.HtmlGridRendererBase.renderChildren(HtmlGridRendererBase.java:203) at org.apache.myfaces.renderkit.html.HtmlGridRendererBase.encodeEnd(HtmlGridRendererBase.java:85) at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:331) at org.apache.myfaces.renderkit.RendererUtils.renderChild(RendererUtils.java:450) at org.apache.myfaces.renderkit.html.HtmlGridRendererBase.renderChildren(HtmlGridRendererBase.java:203) at org.apache.myfaces.renderkit.html.HtmlGridRendererBase.encodeEnd(HtmlGridRendererBase.java:85) at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:331) at org.apache.myfaces.renderkit.RendererUtils.renderChild(RendererUtils.java:450) at org.apache.myfaces.renderkit.html.HtmlGridRendererBase.renderChildren(HtmlGridRendererBase.java:203) at org.apache.myfaces.renderkit.html.HtmlGridRendererBase.encodeEnd(HtmlGridRendererBase.java:85) at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:331) at com.sun.facelets.FaceletViewHandler.encodeRecursive(FaceletViewHandler.java:521) at com.sun.facelets.FaceletViewHandler.encodeRecursive(FaceletViewHandler.java:518) at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:447) at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:23) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74) at
RE: Render an Image
Hi, i will give a feedback how i tried to implement the graphicImageDynamic tag from the sandbox with facelets. It doesn't work for me and i don't know why. But i think it would be useful if this tag works, so i post my experiences with that tag: 1.) I implemented the tag: s:graphicImageDynamic rendered=#{graphicImageDynamicBean.uploaded} id=imageDisplay imageRendererClass=#{graphicImageDynamicBean.imageRenderer}/ 2.) I searched for the facelets definitions and found it. I implemented it in my web.xml. http://wiki.java.net/bin/view/Projects/FaceletsTaglibsMyfacesSandbox 3.) I copied the GraphicImageDynamicComponentHandler-class and implemented it in my project. 4.) I donwloaded the latest release from CVS and looked how the tag was implemented in the examples. So i copied following classes into my project and changed them (see at the end of this message) GraphicImageDynamicBean, UploadedImageRenderer I want to use just a static image, because i want to know how it works. I have an image only as a Hex-String and i want to render that. Length=4066, Content-Type=image/jpeg. I think i have implemented all well, but at deployment it nerves me with a class not found - exception. BUT THE COMPILED CLASS IS IN MY WAR! So that will be one of my problems. Then i wondered myself about the sandbox-taglib: component-typeorg.apache.myfaces.GraphicImageAjax/component-type Is this an AJAX component??? What am i doing wrong?? Thanx in Advance, Udo my exception: SCHWERWIEGEND: Error Loading Library: /WEB-INF/sandbox.taglib.xml java.io.IOException: Error parsing [jndi:/localhost/seam-booking/WEB-INF/sandbox.taglib.xml]: at com.sun.facelets.compiler.TagLibraryConfig.create(TagLibraryConfig.java:395) at com.sun.facelets.FaceletViewHandler.initializeCompiler(FaceletViewHandler.java:279) at com.sun.facelets.FaceletViewHandler.initialize(FaceletViewHandler.java:179) at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:413) at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:23) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112) at java.lang.Thread.run(Thread.java:595) Caused by: org.xml.sax.SAXException: Error Handling [jndi:/localhost/seam-booking/WEB-INF/[EMAIL PROTECTED],87] handler-class at com.sun.facelets.compiler.TagLibraryConfig$LibraryHandler.endElement(TagLibraryConfig.java:258) at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
Re: Render an Image
On 4/8/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: component-typeorg.apache.myfaces.GraphicImageAjax/component-type Is this an AJAX component??? The class was renamed from graphicImageAjax to graphicImageDynamic at some point. Your taglib entry probably needs to be updated for component-type and renderer-type.
Re: Render an Image
Hi, thanks for that hint. i changed that - also in the myfaces-wiki. But the same null pointer exception occurs. In which path i had to put handler classes? I have it in a JAR. The JAR and the WAR are in the same EAR. Normally that is ok for the classpath. I try to put the handler-class in the WEB-INF folder... There is no tomahawk-tag that needs a handler class, so i haven't an example where the handler class must be... Regards, Udo Ihr Traumpartner ist nur einen Klick entfernt. 1 Million Singles warten auf Sie in Deutschlands beliebteste Partnerboerse: http://singles.freenet.de/index.html?pid=11512
Re: Render an Image
Hi, i tried to implement a renderer with the PhaseListener. The sandbox tag doesn't work for me. I don't know why, but an image wouldn't be rendered. I think that is a problem with facelets and the sandbox tags. I implemented all properly what i've found in the wikis, but it doesn't work for me. So a Listener is my last hope... The Listener works fine, but the image will not be rendered. The problem is, that the hex-string is appended on the end of the UIViewRoot. Have you any ideas what i am doing wrong? It would be very, very , very nice. My Tag: h:graphicImage src=imagephaselistener / My Listener: public class ImagePhaseListener implements PhaseListener { private static final Logger log = Logger .getLogger(ImagePhaseListener.class); public void setPhase(String newValue) { } public PhaseId getPhaseId() { return PhaseId.UPDATE_MODEL_VALUES; } public void beforePhase(PhaseEvent e) { log.info(BEFORE + e.getPhaseId()); } public void afterPhase(PhaseEvent e) { log.info(AFTER + e.getPhaseId()); FacesContext context = null; log.info(!Image will be rendered!!!); byte[] bytes = FFD8FFE000104A .getBytes(); context = e.getFacesContext(); HttpServletResponse response = (HttpServletResponse) context .getExternalContext().getResponse(); response.setContentType(image/jpeg); response.setContentLength(bytes.length); ServletOutputStream out = null; try { out = response.getOutputStream(); } catch (IOException e2) { log.error(Error at stream creation + e2); e2.printStackTrace(); } try { out.write(bytes, 0, bytes.length); } catch (IOException e1) { log.error(Error at image creation + e1); e1.printStackTrace(); } context.responseComplete(); } }
Re: Render an Image
On 4/7/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: The sandbox tag doesn't work for me. I don't know why, but an image wouldn't be rendered. This often happens for me as well. That's the bug in the component -- if the page state gets too big, the image doesn't render. I think that is a problem with facelets and the sandbox tags. You can find a ComponentHandler for graphicImageDynamic that I wrote for facelets here: http://wiki.java.net/bin/view/Projects/FaceletsTaglibsMyfacesSandbox It may be out of date, though.
Re: Render an Image
Hi Udo,I saw your comment to my blog entry and see this thread just now,Well, I have created an image using your hex code, a phaselistener and h:graphicImage. Hex to byte[] code is an example from java forums. Anyway, the output of your hex code is a picture of flowers right, seems it is working:) Here is the PhaseListener;package somepackage;import java.math.BigInteger;import javax.faces.context.FacesContext;import javax.faces.event.PhaseEvent;import javax.faces.event.PhaseId ;import javax.faces.event.PhaseListener;import javax.servlet.http.HttpServletResponse;import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;public class ImagePhaseListener implements PhaseListener { public final static String IMAGE_VIEW_ID = hex_image; private Log log = LogFactory.getLog(ImagePhaseListener.class); public void afterPhase(PhaseEvent event) { FacesContext context = event.getFacesContext(); String viewId = context.getViewRoot().getViewId(); if (viewId.indexOf(IMAGE_VIEW_ID) != -1) { log.debug(Handling image request); handleImageRequest(context); } } public void beforePhase(PhaseEvent event) { //Do nothing here... } public PhaseId getPhaseId() { return PhaseId.RESTORE_VIEW; } private void handleImageRequest(FacesContext context) { HttpServletResponse response = (HttpServletResponse) context.getExternalContext().getResponse(); response.setContentType(image/jpeg); response.setContentLength(4066); try { String hex =
RE: Render an Image
Hi Cagatay Civici, THANK YOU VERY, VERY MUCH! It works very well! You are the best. Regards, Udo Jetzt Handykosten senken mit klarmobil - 14 Ct./Min.! Hier klicken http://www.klarmobil.de/index.html?pid=73025
Re: Render an Image
It works very well! You are the best. buy him a ticket for the world championship, since he is interested in football (soccer) ;-) cheers, Matthias
Re: Render an Image
Hi,Udo, I'm glad that it worked out,I would not say no to a world cup ticket :)Cagatay,On 4/8/06, Matthias Wessendorf [EMAIL PROTECTED] wrote: It works very well! You are the best. buy him a ticket for the world championship, since he is interested infootball (soccer) ;-)cheers,Matthias
Re: Render an Image
I think h:graphicImage should support byte[] binding as a value... Mert On 4/4/06, Matthias Wessendorf [EMAIL PROTECTED] wrote: Udo, when you are *generating* you image, you may take a look atCagatay's blog ([1])[1] http://tinyurl.com/q7yff
Re: Render an Image
That doesn't make any sense. h:graphicImage renders a tag not an image. img src=... / Images are not actually in HTML pages, just tags that insert images. Then the browser uses an HTTP request to get the images from the server to insert into the page when the page is rendered. If there was a byte[] array in the JSF graphicImage component, what would JSF do with it? It cannot render those bytes in the response as a browser would not know what to do with them. If you want a dynamic image, best thing to do is create a servlet then have the tag just point to that servlet with path query strings configured as you need them. On 4/5/06, Mert Çalışkan [EMAIL PROTECTED] wrote: I think h:graphicImage should support byte[] binding as a value... Mert On 4/4/06, Matthias Wessendorf [EMAIL PROTECTED] wrote: Udo, when you are *generating* you image, you may take a look at Cagatay's blog ([1]) [1] http://tinyurl.com/q7yff
Re: Render an Image
On 4/5/06, Andrew Robinson [EMAIL PROTECTED] wrote: If you want a dynamic image, best thing to do is create a servlet then have the tag just point to that servlet with path query strings configured as you need them. There's a sandbox component that does this. s:graphicImageDynamic However, I don't know if all of the bugs are worked out of it yet -- it tries to do it without a servlet which makes it very difficult.