×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    25

    problem in getting the image through URL

    hi all,
    I facing the problem,Inwhich i am unable find the solution...I am using the following code to display the image

    public void doGet(HttpServletRequest request,HttpServletResponse response)
    throws IOException, ServletException {
    int data=0;
    response.setContentType("image/png");
    ServletOutputStream out = response.getOutputStream();
    String file = request.getContextPath()+imageNames[0];
    //String file = "C:/Program Files/Apache Group/Tomcat 4.1/webapps/ImageComm/WEB-INF/images"+imageNames[index];
    BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));
    System.out.println("the size of the inputStream is..."+in.available());
    System.out.println("the context path is..."+request.getContextPath());
    while ((data = in.read()) != -1) {
    out.write(data);
    }
    with the above i am not getting any error at the compile time but it was giving exception like FileNotFoundException.
    but the same thing(URL address) when i am copying on the browser it was displayig the image.
    (what might be the reason)
    one more thing when i commented on the url address and try to use the actual realpath address it was displaying the image with out any problem
    can anybody give me the solution like where to keep my images by which i can able to get the images through url address
    thanks in advance
    lakshman

  2. #2
    Registered User
    Join Date
    Aug 2005
    Posts
    25

    Re: problem in getting the image through URL

    hi all,
    I am getting the image from the server,but i am getting the Exception(ArrayOutOfBoundException),can anybody give me way to fix that
    thanks in advance
    lakshman

Similar Threads

  1. saving jpeg image on grid list
    By flicker82 in forum Symbian
    Replies: 0
    Last Post: 2005-01-21, 04:22
  2. 7650 Image Uploader strange problem
    By kamlesh_in in forum Symbian
    Replies: 1
    Last Post: 2003-08-25, 15:06

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×