2 Replies Latest reply on Aug 8, 2008 3:16 AM by sterligovak

    a4j:mediaOutput doesn't work with cacheable="true"

    sterligovak

      I have a strange problem. I saw some topics in forum about that but it doesn't solve my problem. I'm trying to use mediaOutput to output images from database.

      My jsf is

      <ui:repeat value="#{map.coordinates}" var="coord">
       <a:mediaOutput element="img" cacheable="true" createContent="#{map.paint}" value="#{coord}" mimeType="image/gif" />
       </ui:repeat>


      And my bean is
      public List<Node.Coorinates> getCoordinates(){
       List<Node.Coorinates> result = new LinkedList<Node.Coorinates>();
       result.add( new Node.Coorinates( 1, 1 ) );
       result.add( new Node.Coorinates( 1, 2 ) );
       result.add( new Node.Coorinates( 1, 3 ) );
       return result;
       }


      the paint code
      public void paint(OutputStream out, Object data) throws IOException {
       log.info("start of paint");
       if ( data instanceof Node.Coorinates ){
       Node.Coorinates coords = (Node.Coorinates)data;
      
       Node node = nodeDAO.findNodeByCoordinates( coords );
       MapImage mapImage = (MapImage)node.getImage();
      
       out.write(mapImage.getImage());
       }
       }


      Node.Coordinates is a very simple object just with 2 feilds. it implements Serializable.

      When cacheable="true" cache doesn't work - I get red squares (empty reply from server). Without cache everything is ok. Maybe I should use paint2d for that?