This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Servlets and the fly likes sending image from servelt to SVG file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "sending image from servelt to SVG file" Watch "sending image from servelt to SVG file" New topic

sending image from servelt to SVG file

ather idrees

Joined: Apr 04, 2003
Posts: 1
i'm trying to send the image from servlet to SVG file. but file is not transfering correctly. i think there is some encoding problem in the servlet. also the svg does not display the image.
my servelet code is :
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2002</p>
* <p>Company: </p>
* @author unascribed
* @version 1.0
public class testImageSend extends HttpServlet {
private static final String CONTENT_TYPE = "image/jpg";
//Initialize global variables
public void init() throws ServletException {
//Read the default paths for diferent modules from the DBase here
//Process the HTTP Get request
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

PrintWriter out = response.getWriter();
String FilePath = new String("E:/chataan1.jpg");

FileReader reader = new FileReader(FilePath);
Reader htmlFileReader = reader;
BufferedReader in = new BufferedReader(htmlFileReader);
String input = "";
while((input = in.readLine())!= null){
catch(Exception e){

//Clean up resources
public void destroy() {

my svg file code is :
<svg width="680" height="400" zoomAndPan="disable" xmlns="" preserveAspectRatio="xMidYMid meet">

<image id="bg" xlink:href="http://wes09:8001/servlet/testImageSend.class" x="52" y="25" width="126" height="47" fill="blue"/>


well if some one have the solution , plz tell me.
looking for ur reply.
I agree. Here's the link:
subject: sending image from servelt to SVG file
It's not a secret anymore!