3 Replies Latest reply on Aug 13, 2002 2:07 PM by null_pointer

    Images created on the fly

    n_ton

      Hi,

      I have a web application that shows a list of products.
      When a user selects an option in that list, a new
      window pops up that displays a barcode image that is
      created for them on the fly.

      The application is deployed in Tomcat today, so the
      application creates the image in a particular
      directory and the page in the popped-up window just
      references that newly created image. It all works
      because Tomcat expands the war in a predictable
      directory structure.

      My question is, how would I accomplish this within
      a JBoss deployment? It looks as though JBoss also
      does some sort of war expansion. Can I write to
      that directory structure?

      Even so, it appears the expanded war directory is
      dynamic because I see references to web001, web002,
      etc. Is there another/better way to accomplish what
      I'm after?

      I can't use a servlet to create the image and direct
      the byte stream back to the web application because
      I actually need to create two different image formats.
      One is for display, and the other is for the user to
      be able to download for use in their applications.

      The image they are downloading is actually the clincher
      because I need to put it somewhere where I can put
      a link to it for the user to download.

      Suggestions?

      Thanx in advance.

      Norton

        • 1. Re: Images created on the fly

          From 2.4.4 you can create an unpacked war.
          This is a directory structure that looks like a war,
          make the directory something like myapp.war

          JBoss just deploys it without copying.

          Regards,
          Adrian

          • 2. Re: Images created on the fly
            jules_gosnell


            IMHO, you should not be writing back into the unpacked app

            1. The webcontainer may not even unpack, but run packed.
            2. You may not have perms to write there.
            3. what does it gain you ? (garbage collection I assume)

            use File.createTempFile()
            use File.deleteOnExit() (garbage collection)

            Jules

            • 3. Re: Images created on the fly
              null_pointer

              I have a similar problem, In my case users can upload images, which is getting stored in the
              "C:\JBoss-2.4.1_Tomcat-3.2.3\jboss\tmp\deploy\Default\app.ear\web1001\images" Dir.
              But if i stop the server all the data is lost.
              The other way round if i store the data outside the temp deploy dir. How to i give a link to the image.