[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How do I retrieve an image via HTTP Get in jsp?

Posted on 2007-08-05
1
Medium Priority
?
186 Views
Last Modified: 2010-04-01
How do I perform an HTTP GET on an image in JSP, and store it to a local file of the same name?


Worth 500 points.

Thanks,
Rick
0
Comment
Question by:richardsimnett
1 Comment
 
LVL 92

Accepted Solution

by:
objects earned 2000 total points
ID: 19635890
       URLConnection conn = url.openConnection();
        InputStream in = conn.getInputStream();
        OutputStream out = new FileOutputStream(filename);
        byte[] buf = new byte[256];
        int n = 0;
        while (-1!=(n=in.read(buf))) {
           out.write(buf, 0, n);
        }
        out.close();
        in.close();
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses
Course of the Month18 days, 3 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question