9 Replies Latest reply on Apr 25, 2007 4:41 AM by henrik.lindberg

    how use <a4j:mediaOutput> for a separate svg file

    mathias°ö°

      hi
      i am not sure which attributes for <a4j:mediaOutput> component i must use for link a separate svg file.

      <a4j:mediaOutput element="object" uriAttribute="data"
       type="image/svg+xml" ?="http://../images/map.svg" cacheable="false" ></a4j:mediaOutput>

      that is not running.

      mathias °ö°

        • 1. Re: how use <a4j:mediaOutput> for a separate svg file

          It looks like you want to show the svg image without additional activities, just point to the static file.

          If so, you need to use just a standard h:graphicImage. I.e.

          <h:graphicImage value="http://../images/map.svg" />


          The mime type might be defined in the web.xml:

          <mime-mapping>
           <extension>svg</extension>
           <mime-type>image/svg+xml</mime-type>
          </mime-mapping>


          <a4j:mediaOutput> has two major parts:

          createContent - Method call expression to send generated resource to OutputStream.

          value - data that is used as a (second) parameter for createContent

          So, if you do not want to process svg file in the createContent, you have no reason to use it.

          • 2. Re: how use <a4j:mediaOutput> for a separate svg file
            arnes

            I have the same problem, and that:

            "SergeySmirnov" wrote:

            If so, you need to use just a standard h:graphicImage. I.e.



            doesn't work, cause most browsers can't show .svg in img tags (although they should :/), the solution is to use tags.

            My problem is, i can't create a working object tag out of a mediaoutput component. ATM i'm using verbatim tags and normal html object tags but its not really convenient, because i want to generate the svg and change it dynamically.


            <f:verbatim>
            <object id="svg" data="test.svg" type="image/svg+xml"
            width="400" height="300">
            </object>
            </f:verbatim>


            What i tried with <a4j:mediaOutput> is


            <a4j:mediaOutput element="object" cacheable="false" session="true"
             createContent="#{testBean.paint}" value="#{testData}" mimeType="image/svg+xml" />
            


            The data created in testBean.paint is legit svg. (tested with some viewers)

            • 3. Re: how use <a4j:mediaOutput> for a separate svg file
              arnes

              editing would be nice :/

              the solution is to use tags.


              object tags

              • 4. Re: how use <a4j:mediaOutput> for a separate svg file
                mathias°ö°

                hi

                yes, the <h:graphicImage> can not use for vector graphics (svg).
                it´s only use for pixel graphics (bmp, jpg, ...).


                but i search a solution for change dynamic url-value (like graphicImage).
                in my application i get back a url (to svg file) from server. this url should be change in form after request.

                with combination and or can i handle only static values.

                Does someone have solution?

                • 5. Re: how use <a4j:mediaOutput> for a separate svg file
                  mathias°ö°

                   

                  "mathias °ö°" wrote:
                  hi

                  yes, the <h:graphicImage> can not use for vector graphics (svg).
                  it´s only use for pixel graphics (bmp, jpg, ...).


                  but i search a solution for change dynamic url-value (like graphicImage).
                  in my application i get back a url (to svg file) from server. this url should be change in form after request.

                  with combination verbatim and object or embed can i handle only static values.

                  Does someone have solution?


                  • 6. Re: how use <a4j:mediaOutput> for a separate svg file

                    As far as I can understand you have a dynamic URL to some SVG data somewhere. You are NOT creating this SVG data. Why just don't use in your case?

                    • 7. Re: how use <a4j:mediaOutput> for a separate svg file
                      mathias°ö°

                      hi ishabalov

                      yes i get back a dynamic SVG-URL, in don´t create this data. Which component do you mean i must using to render this graphic in a frame of result-form?

                      best regards
                      mathias °ö°

                      • 8. Re: how use <a4j:mediaOutput> for a separate svg file
                        mrnice

                        What about displaying a SVG which is wrapped inside a DOM Docoument Object. Could that be possible that way too?

                        • 9. Re: how use <a4j:mediaOutput> for a separate svg file
                          henrik.lindberg

                          I am guessing here, but it seems that what you are trying to do is to output the SVG content that you obtain by reading the content of URL that you have no control over. If that is the case, why not read the URL, and write it on the IO stream obtained by mediaOutput. The data could be the URL.
                          i.e. something like

                          createContent="#{testBean.copyContent}" value="http://somewhere/something.svg" mimeType="image/svg+xml"