file upload using EJB and Swing Client


EJB programming & troubleshooting: file upload using EJB and Swing Client

  1. file upload using EJB and Swing Client (3 messages)

        Does anybody used EJB at server side and thick client Swing to Upload any type of file from client and store it either to server side or directly into the database.
        plz reply on this issue.


    Threaded Messages (3)

  2. I have the same issue. I've searched for such functionality some time ago. (I guess in this forum as well). Just my conclusion after searching is that:
    EJB was not initially planned for such operations and in most cases developers use HTTP or FTP protocols directly.

    Hovewer it is possible to create a Stateful Session Bean and put your files as portions of bytes to server. In this case you will have to write your own code for managing file upload/download process and it may not be very effective.

    FTP/HTTP server may use advanced stream buffering mechanisms for traffic optimizations depending on network bandwidth. In case of Statelss Session Bean you will have to implement this yourself hovewer I'm not sure if it is so easy task.

    On my opinion it is big lack of EJB or J2EE specification to not have streaming in a standard. According to EJB specs I sould use JNDI (InitialContext) make authentication and obtain EJB instances. To use both EJB and stream transfer through FTP/HTTP I have to make authentication twice. J2EE/EJB specification could define a kind of Stream Transfer Bean similar to Message Drive Bean or JMS topic and implementation could use any underlaying file transfer protocol for data transfer.
  3. Image streaming[ Go to top ]

    Well, i've done streaming of images to be saved in blob in Oracle before. The images were displayed in a swing app and whenever the user edits and save it, i'd stream the image back to the db. Basically my swing app would use HTTP to post to a servlet which in turn looks up a SLSB which connects to the DB and retrieve a Blob handle with its OutputStream. I'd wrap this OutputStream into a remotable outputstream (since i/o streams are non serializable and my requirements was that the SLSB and the servlets must be packed in separate ears, i can't do local lookups hence no pass by reference). Once the servlet gets the ouputstream from the ejb, it just reads blocks of bytes from the http inputstream and writes to the output stream. This way, i dont store the entire image in memory at all. I've tested this on weblogic, jboss and websphere so far and it works. The only part which is slightly less forward here was to make the i/o streams remotable.
  4. Re: Image streaming[ Go to top ]

    Hi, Can u send source code For File Upload from Swing client to EJB. Thanks in Advance, Krishna.