Hi,

the simple way is to write a Servlet to do that static serving.
This is not the most performant way but if you have only a few
files to serve...

Here is some _simple_ servlet code for that:

public void doGet(HttpServletRequest pRequest, HttpServletResponse pResponse)
  throws IOException, ServletException
{
        String tPath = pRequest.getPathInfo();

        try {
            PrintWriter tOutput = pResponse.getWriter();

            String tHttpRoot = "/home/oliver/archives";

            InputStreamReader tInput = new InputStreamReader(
              new FileInputStream(tHttpRoot + tPath));

            char tBuf[] = new char[4096];

            for ( ;; ) {
                int tSize = tInput.read(tBuf);
                if (tSize == -1)
                    break;
                tOutput.write(tBuf, 0, tSize);
            }

            tInput.close();
            tOutput.close();
        } catch (IOException tIOEx) {
            pResponse.sendError(404, "resource not found");
        }
}


-Mario



Olivier Voutat wrote:
Lol, one more question:

I have a directory: /home/oliver/archives/

that I want it to be accessible externally trough webbrowser. How do I need to configure it in Geronimo ?

Best Regards
--
Olivier Voutat
Rua Praia de Muriú, 9188
Cep 59092-390 / Natal - RN
Tel: (84) 3219-0427 Cel: (84) 9977-3917


Reply via email to