[jboss-user] [Beginners Corner] - Re: Folder with public access

One_Special_User do-not-reply at jboss.com
Wed Aug 2 17:06:13 EDT 2006


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();
  |         response.setContentType("text/text;charset=UTF-8");
  |  
  |         // create a FileInputStream for filename and pipe the bytes to out
  | 
  |         out.close();
  |     }
  | 
  |     // ...
  | 
  | }
  | 


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

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3962630#3962630

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3962630



More information about the jboss-user mailing list