1 Reply Latest reply on Apr 14, 2009 1:37 PM by Ales Justin

    from vfsfile to file

    Luca Stancapiano Expert

      I have this code in my servlet:

      protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
       // TODO Auto-generated method stub
       URL url = Thread.currentThread().getContextClassLoader().getResource("resource/");
       if (!"file".equals(url.getProtocol())) {
       throw new FileNotFoundException(
       " cannot be resolved to absolute file path " +
       "because it does not reside in the file system: " + url);
       File file = new File(URLDecoder.decode(url.getFile()));

      I've seen jboss-vfs returns "vfsfile://...../resource" as path. My condition throws an Exception if the protocol is not equals to "file". The question is: what is the better work to do to avoid throw of this exception supposing I cannot to modify this code? Can I disable vfs inside jboss 5.0? if yes how this choice is considered?