This worked. However in glassfish this technique returns a true url to a file in the document root. That would be ok but it allows the user to view it from a web browser as well and I want to prevent that. Is there a way I can do this?
filepath = getServletContext().getResource("/cfgfile").getPath(); InputStream is = getClass().getResourceAsStream(filepath);