You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Matt Raible <ma...@raibledesigns.com> on 2002/09/04 19:45:56 UTC

[Off Topic] File Changed Listener?

I am working on a project where we have two webapps, one is a admin app,
the other is for users.  Both are developed in Struts.  The users app
loads configuration settings from an XML file at startup and puts a bean
into the application's scope.  The admin app has an interface to change
this file and save the XML file.

So is it possible to develop a File Listener that notifies the user app
when this file as changed, so I can reload it?  If not, how would you
experts recommend accomplishing this?  Maybe the admin app calls a
servlet to reload the Configuration servlet?

Thanks,

Matt



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [Off Topic] File Changed Listener?

Posted by Ted Husted <hu...@apache.org>.
Have the admin app send a request to the user app that tells it to 
reload the file. Like the reload command in Struts 1.0.x

For security, you might be a timestamp (version) into the file and 
include that with the request. This would ensure that the file only gets 
loaded once and can't be easily spoofed.

The thing to watch with application-scope critters is threading issues. 
You need to consider what happens if the bean changes on some user in 
the middle of a process.

-Ted.

Matt Raible wrote:

> I am working on a project where we have two webapps, one is a admin app,
> the other is for users.  Both are developed in Struts.  The users app
> loads configuration settings from an XML file at startup and puts a bean
> into the application's scope.  The admin app has an interface to change
> this file and save the XML file.
> 
> So is it possible to develop a File Listener that notifies the user app
> when this file as changed, so I can reload it?  If not, how would you
> experts recommend accomplishing this?  Maybe the admin app calls a
> servlet to reload the Configuration servlet?
> 
> Thanks,
> 
> Matt
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 


-- 
Ted Husted, Husted dot Com, Fairport NY US
co-author, Java Web Development with Struts
Order it today:
<http://husted.com/struts/book.html>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>