Agreed, but use care with the something. While, the servlet spec specifies a return value of null for getRealPath() in a war deployment, it is my understanding that at one time all of the containers did not implement this consistently. I haven't looked recently, but I would suggest checking the major container vendors to ensure they are compliant with that rule before using an if statement on that null.
In the J2EE environment, while you can't have the threads, could you use the new timer stuff to accomplish checking to see if the file has changed?? LES -----Original Message----- From: Anthony Eden [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 11, 2003 9:30 PM To: [EMAIL PROTECTED] Subject: Re: [OS-webwork] Configuration in /WEB-INF Read my original message again: this is a problem which exists for loading resources through both classloaders and the servlet context. If you want something which will always work then you must use interval reloading. However this means that you have to have a thread which is running to load the resource at a regular basis and this too can be a problem if you are running in a J2EE container. There is no good solution at this time, i.e. nothing provided by the APIs, but you should probably use something (or at least give users the option to use something). Sincerely, Anthony Eden Pat Lightbody wrote: >Sounds to me like this is not a good plan then. > > >----- Original Message ----- >From: <[EMAIL PROTECTED]> >To: <[EMAIL PROTECTED]> >Sent: Wednesday, June 11, 2003 3:48 PM >Subject: RE: [OS-webwork] Configuration in /WEB-INF > > > > >>According to the servlet spec getRealPath() will always return null if >>the web application is executing in an non-unpacked war. So, in general >>this is not an option for a servlet or any j2ee application. >> >>LES >> >> >>-----Original Message----- >>From: Pat Lightbody [mailto:[EMAIL PROTECTED] >>Sent: Wednesday, June 11, 2003 5:19 PM >>To: [EMAIL PROTECTED] >>Subject: Re: [OS-webwork] Configuration in /WEB-INF >> >>Isn't getRealPath() deprecated though? >> >>-Pat >> >>----- Original Message ----- >>From: "Mathias Bogaert" <[EMAIL PROTECTED]> >>To: <[EMAIL PROTECTED]> >>Sent: Wednesday, June 11, 2003 2:06 PM >>Subject: Re: [OS-webwork] Configuration in /WEB-INF >> >> >> >> >>>This is exactly the way SiteMesh does it. Have a look at the >>> >>> >>ConfigLoader. >> >> >>>Cheers, >>>Mathias >>> >>>----- Original Message ----- >>>From: "Anthony Eden" <[EMAIL PROTECTED]> >>>To: <[EMAIL PROTECTED]> >>>Sent: Wednesday, June 11, 2003 10:44 PM >>>Subject: Re: [OS-webwork] Configuration in /WEB-INF >>> >>> >>> >>> >>>>There is an interesting problem with using the ClassLoader or the >>>>ServletContext for getting resource data: there is no way using the >>>> >>>> >>APIs >> >> >>>>to determine if the resource has been modified. >>>> >>>>One workaround is to check the getRealPath() method to see if it is >>>>available and use it if it is to build a real file object which you >>>> >>>> >>can >> >> >>>>use to determine the last modified date. Another possibility is to >>>>specify a reload interval for the resource. >>>> >>>>Does XWork (and/or WW2) provide either of these methods for >>>> >>>> >>reloading >> >> >>>>configuration resources? >>>> >>>>-Anthony >>>> >>>>[EMAIL PROTECTED] wrote: >>>> >>>> >>>>>Ah, I see. That makes sense. So, you are doing it based on the >>>>> >>>>> >>servlet >> >> >>>>>context class loader. Kewl, glad to learn that. >>>>> >>>>>LES >>>>> >>>>>-----Original Message----- >>>>>From: Anthony Eden [mailto:[EMAIL PROTECTED] >>>>>Sent: Wednesday, June 11, 2003 2:54 PM >>>>>To: [EMAIL PROTECTED] >>>>>Subject: Re: [OS-webwork] Configuration in /WEB-INF >>>>> >>>>>You don't need to open an HTTP connection, rather you can get the >>>>>InputStream directly from the servlet context: >>>>> >>>>>InputStream in = >>>>>servletContext.getResourceAsStream("/WEB-INF/xwork.xml"); >>>>> >>>>>Sincerely, >>>>>Anthony Eden >>>>> >>>>>[EMAIL PROTECTED] wrote: >>>>> >>>>> >>>>> >>>>>>I may just be confused or have missed something, but does >>>>>> >>>>>> >>getResource >> >> >>>>>>not just give you the path relative to the doc root? Will you >>>>>> >>>>>> >>then >> >> >>>>>open >>>>> >>>>> >>>>> >>>>>>it using http? Normally, would you not secure your web-inf from >>>>>> >>>>>> >>url >> >> >>>>>>access(for security reasons)? Or is there another method that >>>>>> >>>>>> >>would >> >> >>>>>>allow you to actually use File (by getting the servlets >>>>>> >>>>>> >>"realpath")? >> >> >>>>>>LES >>>>>> >>>>>>-----Original Message----- >>>>>>From: Hani Suleiman [mailto:[EMAIL PROTECTED] >>>>>>Sent: Tuesday, June 10, 2003 9:44 PM >>>>>>To: [EMAIL PROTECTED] >>>>>>Subject: Re: [OS-webwork] Configuration in /WEB-INF >>>>>> >>>>>>getRealPath is very bad, what's so wrong with >>>>>>servletContext.getResource() though? >>>>>> >>>>>>On Tuesday, June 10, 2003, at 06:59 PM, [EMAIL PROTECTED] >>>>>> >>>>>> >>>>>wrote: >>>>> >>>>> >>>>> >>>>>>>The hardest problem with that is that you can't use >>>>>>>context.getRealPath() to get the location of WEB-INF in an >>>>>>> >>>>>>> >>unpacked >> >> >>>>>>war >>>>>> >>>>>> >>>>>> >>>>>> >>>>>>>config (per servlet spec). Honestly, classpath is usually the >>>>>>> >>>>>>> >>best >> >> >>>>>>>solution. >>>>>>> >>>>>>>-----Original Message----- >>>>>>>From: Mathias Bogaert [mailto:[EMAIL PROTECTED] >>>>>>>Sent: Tuesday, June 10, 2003 6:55 PM >>>>>>>To: [EMAIL PROTECTED] >>>>>>>Subject: [OS-webwork] Configuration in /WEB-INF >>>>>>> >>>>>>>Guys, >>>>>>> >>>>>>>It seems like we are having a lot of problems with finding >>>>>>>configuration >>>>>>>files in the classpath etc. Also, I dislike putting configuration >>>>>>> >>>>>>> >>>>>>files >>>>>> >>>>>> >>>>>> >>>>>> >>>>>>>other than .properties on the classpath. That's why I propose >>>>>>> >>>>>>> >>putting >> >> >>>>>>>it >>>>>>>all >>>>>>>(components.xml, xwork.xml etc)under /WEB-INF directly (same as >>>>>>>SiteMesh >>>>>>>for >>>>>>>example). >>>>>>> >>>>>>>+1 from me >>>>>>> >>>>>>>Mathias >>>>>>> >>>>>>> >>>>>>> >>>>>>>------------------------------------------------------- >>>>>>>This SF.net email is sponsored by: Etnus, makers of TotalView, >>>>>>> >>>>>>> >>The >> >> >>>>>>>best >>>>>>>thread debugger on the planet. Designed with thread debugging >>>>>>> >>>>>>> >>features >> >> >>>>>>>you've never dreamed of, try TotalView 6 free at www.etnus.com. >>>>>>>_______________________________________________ >>>>>>>Opensymphony-webwork mailing list >>>>>>>[EMAIL PROTECTED] >>>>>>>https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork >>>>>>> >>>>>>> >>>>>>>------------------------------------------------------- >>>>>>>This SF.net email is sponsored by: Etnus, makers of TotalView, >>>>>>> >>>>>>> >>The >> >> >>>>>>>best >>>>>>>thread debugger on the planet. Designed with thread debugging >>>>>>> >>>>>>> >>features >> >> >>>>>>>you've never dreamed of, try TotalView 6 free at www.etnus.com. >>>>>>>_______________________________________________ >>>>>>>Opensymphony-webwork mailing list >>>>>>>[EMAIL PROTECTED] >>>>>>>https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>>------------------------------------------------------- >>>>>>This SF.NET email is sponsored by: eBay >>>>>>Great deals on office technology -- on eBay now! Click here: >>>>>>http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5 >>>>>>_______________________________________________ >>>>>>Opensymphony-webwork mailing list >>>>>>[EMAIL PROTECTED] >>>>>>https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork >>>>>> >>>>>> >>>>>>------------------------------------------------------- >>>>>>This SF.NET email is sponsored by: eBay >>>>>>Great deals on office technology -- on eBay now! Click here: >>>>>>http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5 >>>>>>_______________________________________________ >>>>>>Opensymphony-webwork mailing list >>>>>>[EMAIL PROTECTED] >>>>>>https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork >>>>>> >>>>>> >>>>> >>>>> >>>>>------------------------------------------------------- >>>>>This SF.NET email is sponsored by: eBay >>>>>Great deals on office technology -- on eBay now! Click here: >>>>>http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5 >>>>>_______________________________________________ >>>>>Opensymphony-webwork mailing list >>>>>[EMAIL PROTECTED] >>>>>https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork >>>>> >>>>> >>>>>------------------------------------------------------- >>>>>This SF.NET email is sponsored by: eBay >>>>>Great deals on office technology -- on eBay now! Click here: >>>>>http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5 >>>>>_______________________________________________ >>>>>Opensymphony-webwork mailing list >>>>>[EMAIL PROTECTED] >>>>>https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork >>>>> >>>>> >>>> >>>>------------------------------------------------------- >>>>This SF.NET email is sponsored by: eBay >>>>Great deals on office technology -- on eBay now! Click here: >>>>http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5 >>>>_______________________________________________ >>>>Opensymphony-webwork mailing list >>>>[EMAIL PROTECTED] >>>>https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork >>>> >>>> >>>> >>>> >>> >>>------------------------------------------------------- >>>This SF.NET email is sponsored by: eBay >>>Great deals on office technology -- on eBay now! Click here: >>>http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5 >>>_______________________________________________ >>>Opensymphony-webwork mailing list >>>[EMAIL PROTECTED] >>>https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork >>> >>> >> >>------------------------------------------------------- >>This SF.NET email is sponsored by: eBay >>Great deals on office technology -- on eBay now! Click here: >>http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5 >>_______________________________________________ >>Opensymphony-webwork mailing list >>[EMAIL PROTECTED] >>https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork >> >> >>------------------------------------------------------- >>This SF.NET email is sponsored by: eBay >>Great deals on office technology -- on eBay now! Click here: >>http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5 >>_______________________________________________ >>Opensymphony-webwork mailing list >>[EMAIL PROTECTED] >>https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork >> >> > > > >------------------------------------------------------- >This SF.NET email is sponsored by: eBay >Great deals on office technology -- on eBay now! Click here: >http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5 >_______________________________________________ >Opensymphony-webwork mailing list >[EMAIL PROTECTED] >https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork > > ------------------------------------------------------- This SF.NET email is sponsored by: eBay Great deals on office technology -- on eBay now! Click here: http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5 _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork ------------------------------------------------------- This SF.NET email is sponsored by: eBay Great deals on office technology -- on eBay now! Click here: http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5 _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork