1 Reply Latest reply on Nov 29, 2011 6:36 PM by mechtatel

    a:mediaOutput and PAGE scope

      Hi,
           I'm having trouble setting up an a:mediaOutput tag to play a sound with a PAGE scoped bean to back it up. The sound plays fine but the bean is created multiple times, which is incompatible with the page logic since values are not being persisted beyond the request.


      I've seen related topics regarding the CONVERSATION SCOPE but none using PAGE. Is it possible to use a:mediaOutput with a PAGE scoped bean?


      Here is the source for the files involved (only related logic to improve readability).


      Page.xhtml:


      ...
      <a:mediaOutput id="sound" rendered="true" session="true" element="object" mimeType="audio/x-wav"
                     createContent="#{bean.play}" value="#{bean.filename}" cacheable="false" 
                     style="width:0px;height:0px;" >
           <s:conversationId  value="#{conversation.id}"/> 
      </a:mediaOutput>
      ...



      Bean.java:




      ...
      @Name("bean")
      @Scope(ScopeType.PAGE)
      public class Bean implements Serializable {
      
           @Logger
           private Log log;
      
           @Create
           public void start() {
              log.info("Start");
                 // <other stuff>
           }
      
              ...
              
              public synchronized void play(OutputStream stream, Object object) throws IOException {
                  ...
              }
      }



      The

      <s:conversationId/>

      tag is there because of this blog post but it doesn't seem to help.


      Any help? Thanks.


      Yoel