1 Reply Latest reply on Aug 2, 2006 5:06 PM by one_special_user

    Folder with public access

    orkus9 orkus9 Newbie


      i use jboss 4.0.2.

      I wrote a java-programm thats generating files (generic jpg´s). Users shall be able to download the files (without authentification).
      At the moment i use an apache server, where the users can download the files.
      Is there a way, to use jboss like a apache-server. I need a folder, that can be accessed by any users (from web).

      -- Orkus

        • 1. Re: Folder with public access
          one_special_user Newbie

          You might do it via a Servlet (ok, probably not the best solution *G*):

          public class GetMeTheImagesServlet extends HttpServlet {
           // ...
           public void processRequest(HttpServletRequest req, HttpServletResponse res) {
           String dir = getServletConfig().getInitParameter("ROOT_DIR");
           String file = req.getParameter("FILENAME");
           String filename = dir + "/" + file;
           // create a FileInputStream and
           PrintWriter out = response.getWriter();
           // create a FileInputStream for filename and pipe the bytes to out
           // ...

          Your jpg-generator puts the images to the ROOT_DIR and your servlet handles out the bytes ;)