5 Replies Latest reply on Jan 9, 2009 8:25 PM by nbelaevski

    a4j:mediaOutput, multiple db-connections

    maxmustang

      Hello,

      Problem is my browser-session generates sometimes more than 1 db connection when i use (multiple?) a4j:mediaOutput, but not always. Could it be that this component makes a new thread(session)? Or is my code wrong? I prepare 2 logos as first elements on my pages as byteArray (sess.prepareLogos) before i call kind of getters to them (sess.getLogoLeft, sess.getLogoRight), so when getting the Logos i not go to the database.

      Thanks very much for ideas/thougts.

      <h:outputText value="#{sess.prepareLogos}"></h:outputText>
      <a4j:mediaOutput align="left" element="img" cacheable="false" session="true" createContent="${sess.getLogoLeft}" value="null" mimeType="image" id="wrwrwerw"/>
      <a4j:mediaOutput align="right" element="img" cacheable="false" session="true" createContent="${sess.getLogoRight}" value="null" mimeType="image" id="werwerr"/>

        • 1. Re: a4j:mediaOutput, multiple db-connections
          ilya_shaikovsky

          Yes a4j:mediaoutput requests the resources assynchronously.

          • 2. Re: a4j:mediaOutput, multiple db-connections
            maxmustang

            Thank you very much! Greetings from Zürich.

            • 3. Re: a4j:mediaOutput, multiple db-connections
              maxmustang

               

              "ilya_shaikovsky" wrote:
              Yes a4j:mediaoutput requests the resources assynchronously.


              Is Paint2DTag also assynchronously, and if not, could you think i can use this component to show an already generated image (bytearray)??.. :-) If so this would solve my problem with the connections. Thanks again for your help.

              • 4. Re: a4j:mediaOutput, multiple db-connections
                ilya_shaikovsky

                paint2D - is the specific mediaOutput implementation. there is the only difference between the components paint2D outputs generated images, and media output outputs any binary resources (video, imgs, sounds and so on) ..

                • 5. Re: a4j:mediaOutput, multiple db-connections
                  nbelaevski

                   

                  "maxmustang" wrote:
                  "ilya_shaikovsky" wrote:
                  Yes a4j:mediaoutput requests the resources assynchronously.


                  Is Paint2DTag also assynchronously, and if not, could you think i can use this component to show an already generated image (bytearray)??.. :-) If so this would solve my problem with the connections. Thanks again for your help.


                  paint2D/mediaOutput itself are rendered as IMG (or another one) tags with a special URI that has been created by Richfaces resource framework. These components have "data" attribute that allows you to specify a piece of information to be encoded in URI that will be available in time when resource content (e.g. image bytes) are output to the client. If you use big objects, URIs can become very big and not useful. You can cope with the problem by creating application cache and store image bytes there. In this case "data" will be cache object key that is lightweight by nature.