2 Replies Latest reply on Aug 11, 2008 7:47 PM by dhinojosa

    Transmit byte array as raw file

    sducas.sducas1.gmail.com

      Hello!


      I have a byte array property (filled in with the s:fileUpload component) of a managed bean...


      this is not an image, nore PDF..; I would like to transmit it as a raw file so the user can download this when he click on a link...


      How can I perform that...


      The content of the file should only be {clientHome.instance.fileField} and there must be no HTML headers...


      Any idea?


      THX!

        • 1. Re: Transmit byte array as raw file
          blabno

          Check seamspace example ! There is a content servlet that should do for you.

          • 2. Re: Transmit byte array as raw file
            dhinojosa

            I did one using 'AbstractResource'  merely extend it and implement the methods


            public String getResourcePath() {
                    return "/foo";
            }
            



            and


            public void getResource(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            ...
            }
            



            This would cause the resource to appear in /seam/resources/foo.


            Now remember this is ApplicationContext only


            If you need something of small scope, I recommend the DocumentStore.  That one is a little more involved, and so I would refer you to Seam In Action to learn more about that solution.