aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Return File Content from EJB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Return File Content from EJB" Watch "Return File Content from EJB" New topic
Author

Return File Content from EJB

Chetan Chandarana
Greenhorn

Joined: Mar 04, 2003
Posts: 7
Hi All,

In my application, i have a servlet that call EJB.
EJB creates a file and now servlet has to download this to user
Both EJB and Servlets are on different servers

I have one option that EJB would return the file name to be downloaded
and servlet will do FTP to download file(Considering i do all setting for servlet to download file from the server where EJB are deployed)

Do you have any better solution for this problem?
Would highly appreciate if you could share some ideas

Cheers
Chetan


Regards<br /> <br />Chetan Chandarana<br />SCJP, SCWCD
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

You are remembering that you should not perform any file system IO from an EJB right?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Chetan Chandarana
Greenhorn

Joined: Mar 04, 2003
Posts: 7
Yes, i do remember ... thats why i want to know what is the best way to achieve this?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Well the only safe way to access file systems resources from an EJB is via a JCA adapter. You'll need to write/find one of them.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17260
    
    6

Or you can create the File from your Servlet through a POJO class, and maybe use the FileUpload apis that come with Apache Commons.

Just an idea.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Return File Content from EJB