1 Reply Latest reply on Apr 8, 2007 5:28 AM by tomarenz

    a4j:mediaOutput non working with Trinidad on pdf objects

    tomarenz

      Hi, I tried this simple page while using Trinidad + Facelets + Ajax4jsf:

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <tr:document
       xmlns:tr="http://myfaces.apache.org/trinidad"
       xmlns:a4j="https://ajax4jsf.dev.java.net/ajax">
      
       <a4j:mediaOutput element="object" cacheable="false" session="true"
       value="logo-simple.pdf" createContent="#{testBean.paint}"
       mimeType="application/pdf"/>
      </tr:document>
      

      where testBean is a session-scoped bean like this:

      public class TestBean {
       public void paint(OutputStream out, Object data)
       throws IOException {
       if (data instanceof String) {
       InputStream file =
       FacesContext.getCurrentInstance().
       getExternalContext().
       getResourceAsStream((String)data);
       int size = file.available();
       byte[] pdf = new byte[size];
       file.read(pdf);
       file.close();
       out.write(pdf);
       }
       }
      }
      

      there are no errors and a proper object tag is rendered together with its data uri attribute, but:
      - in IE 6/7 method "paint" is never called. Even using an unexisting method gives no error and no contents.
      - in FF 2.0, method "paint" is called twice, but contents are not rendered on the page and the Adobe plugin does not appear.
      Any idea ?