1 Reply Latest reply on Mar 13, 2003 9:03 PM by amar

    serving files from c drive/ networked drive :-(((

    amar

      i need 2 write a servlet 2 serve files(doc, excel, txt etc.) that are stored in any of the various drives such as c, d, e on the windows server.
      my current installation is jboss3.0.4_tomcat4.1.12 bundle on the same server in which the files are located.
      I don't have a clue how 2 do this.
      :-(((((((((((((
      Can you please give links 2 examples how 2 do this or any suggestions, comments would be highly appreciated.

      Thank you in advance.

        • 1. Re: serving files from c drive/ networked drive :-(((
          amar

          I have an implementation of jboss3.0.4_tomcat4.1.12 bundle on a windows m/c. I want to write a servlet to serve different types of files such as doc,txt,pdf,txt that could be residing in different folders on the c drive or may be even a network mapped drive, i.e. there are not inside the jboss directory or the war deployment. I'm unable to find resources resoures to do this.

          I also tried doing this:
          // Get the request
          //String cReq = "d:\\tmp\\" + req.getParameter("REQ");
          String cReq = "c:\\" + strLogId;
          out.println(cReq);
          boolean fileReturned = false;
          if (cReq != null) {
          File rFile = new File(cReq);
          if (rFile.exists()) {
          //return the file
          //sendPDF(req, response, cReq);
          //sendFile(response, cReq);
          out.println("file found :-)");
          fileReturned = true;
          }
          }

          if (!fileReturned) {
          out.println("file not found :-(");
          }

          I tried it on a known file testFile.txt, but I get, file not found message.
          http://146.6.159.41:8080/UTWiredArchive/servlet/proto1?filePk=testFile.txt

          Thank You in advance,
          Amar.