Hi,

>"streaming the content yourself using your own code, or in this case
your
>Struts code."
>Couled more detials please?

<a href="WEB-INF/someFile.txt">Click Here!</a> would lead to a 404 if
the user clicks on it as I previously explained.

Now imagine a servlet:

public class BadServlet extends HttpServlet {
  protected void doGet(HttpServletRequest req, HttpServletResponse res)
    throws IOException, ServletException {
    String requestedFile = req.getParameter("requestedFile");
    InputStream is =
getServletContext().getResourceAsStream(requestedFile);
    BufferedInputStream bis = new BufferedInputStream(is);
    String line = null;

    res.setContentType("text/html");
    PrintWriter out = res.getWriter();

    while((line = bis.readLine()) != null) {
      out.println(line);
    }

    bis.close();
  }
}

Map this servlet in web.xml to /BadServlet, and go to
http://localhost:8080/BadServlet?requestedFile=/WEB-INF/someFile.txt to
see how it's served.  I typed the above from memory without testing, but
it should be close enough to illustrate this point, which is: what
you're doing is bad design.

Yoav Shapira



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to