wood burning stoves 2.0*
The moose likes Servlets and the fly likes searching for *orm.xml files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "searching for *orm.xml files" Watch "searching for *orm.xml files" New topic
Author

searching for *orm.xml files

aydeniz kirmizi
Ranch Hand

Joined: Aug 20, 2009
Posts: 39
Hi,

Could you please give some advice on how to search for all the *orm.xml files in "WEB-INF"?

basically want to find: *\WEB-INF\*orm.xml

any suggestion is appreciated.

thanks
Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3218
    
  49

You can do it with general file manipulation functions on java.io.File class. However, you should take it a note that attempting to do so makes your web application less portable and less deployable. You can't be certain that you will always have the access to the underneath file system. If you application gets WAR'ed, or if the presence of a security manager prevents access to the file system, your search operation is likely to be failed.

A better way is to rethink why you really need to have such operations to be performed. If you are the one who develops your web application, you should already know the exact file names, so you can fetch them through getResourceAsStream(). If those files are something you are designed to be generated and persisted at the run time of the application, you are probably having a bad architecture.


Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: searching for *orm.xml files