Re: J2EE and File
From: Christopher Blunck (blunck_at_gst.com)
Date: 10/22/03
- Next message: eeyimaya: "interactive .swf in java application."
- Previous message: rabbits77: "Odd character when retrieving a string from a HashMap"
- In reply to: Murat G.: "J2EE and File"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 22 Oct 2003 00:20:36 -0400
On Sun, 19 Oct 2003 09:35:17 -0700, Murat G. wrote:
> Hello,
> I am not an experienced J2EE developer, so please forgive me if this
> question seems silly...
> Does J2EE spec restrict/prohibit local file operations? Is it possible
> to use java.io package from within a J2EE application, to read/write
> local files on the app server? Is there a standard way of doing it?
> Thanks in advance,
> Murat
Hi Murat-
I'm not sure if J2EE explicitly forbids it, but writing files to the local
machine within a J2EE environment is not a best practice. J2EE is
engineered as an enterprise level distributed component archictecture,
allowing you to easily scale your application to multiple platforms
without making significant code changes. Indeed, that's partially why
EAR/WAR was conceived - the ability to package your application in a
standards compliant fashion frees the developer from the platform specific
limitations of file i/o. It also makes applications more portable, and
easier to deploy in new environments (application servers).
Let's say you take your portable J2EE application and introduce code that
writes configuration information to a local file. What then happens when
you wish to scale your application to two servers? What will you do when
a request arrives at server A that triggers an update to a local file.
How will B know of the update? It won't, at least not unless A tells B
about it. And that architecture does not scale.
A best practice imo is to use the database to store configuration
information, or any type of property that may need to be accessed across
platforms. Alternatively, cluster your J2EE environment. Either way, do
it in a platform independant fashion and make as little use of the
filesystem as possible.
-c
- Next message: eeyimaya: "interactive .swf in java application."
- Previous message: rabbits77: "Odd character when retrieving a string from a HashMap"
- In reply to: Murat G.: "J2EE and File"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|