[opencms-dev] Best way to determine existence of file in VFS

Alexander Kandzior alex at opencms.org
Sat Mar 13 08:22:02 CET 2004


Andrew,

your solution is exactly right, reading the file header and catching the
Exception if it dosen't exist is the way to find out if a file exists or
not.

Best Regards,
Alex.

Alexander Kandzior
Alkacon Software - The OpenCms Experts
http://www.alkacon.com

> -----Original Message-----
> From: opencms-dev-admin at opencms.org 
> [mailto:opencms-dev-admin at opencms.org] On Behalf Of Andrew Kerr
> Sent: Friday, March 12, 2004 10:11 PM
> To: opencms-dev at opencms.org
> Subject: [opencms-dev] Best way to determine existence of file in VFS
> 
> 
> Hi there,
> 
> I am writing a JSP that needs to show a link to a file only 
> if it exists 
> in the VFS.  There don't seem to be any JSP tags that handle this.
> 
> I'm thinking of using a line of code such as:
> 
> CmsResource resource = getCmsObject().readFileHeader(target);
> 
> ...to determine if the file exists (it'll throw an exception 
> if it doesn't).
> 
> Is there any other preferred way of doing this?
> 
> Thanks,
> Andrew Kerr
> 
> 
> 
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, 
> please visit http://mail.opencms.org/mailman/listinfo/opencms-dev
> 
> 




More information about the opencms-dev mailing list