Programming Jakarta Struts, 2nd Edition [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Programming Jakarta Struts, 2nd Edition [Electronic resources] - نسخه متنی

Chuck Cavaness

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید








4.9 Reloading the Configuration Files


The web
deployment descriptor is loaded and parsed when the web container is
first started. By default, changes to the descriptor are not detected
and reloaded while the container is running. In fact, not many
containers even provide this functionality
it's typically not a wanted feature, due to the
possible security issues involved. The Struts configuration files
also are loaded and parsed when the container is launched, and
changes to these configuration files also are not automatically
detected; the same security issues are present.

Some applications might require the ability to reload the Struts
configuration files without restarting the web container. If your
application is one of them, there are ways you can do this. One
approach is to create a Struts action that will reinitialize the
ActionServlet (you may want to restrict which
users can call this action). Once the
ActionServlet is reinitialized, everything will be
new and the application can again service requests, just like before.

A second strategy is to create a thread that monitors the
lastModifiedTime of the configuration file. It can
sleep for a few seconds and, upon awakening, compare the
lastModifiedTime of the file against the one
stored in a variable. If they are different, the file has changed and
it's time to reload the application. This approach
is nice because you don't have to worry about an
unwelcome user reloading your application. However, the time that it
gets reloaded is entirely up to the thread.


    / 181