hi!
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.io.*;
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 {
//
//
//PUT SECURITY CHECKS HERE
//
//
response.setContentType(CONTENT_TYPE);
PrintWriter out = response.getWriter();
String FilePath = new String("E:/chataan1.jpg");
try{
FileReader reader = new FileReader(FilePath);
Reader htmlFileReader = reader;
BufferedReader in = new BufferedReader(htmlFileReader);
String input = "";
while((input = in.readLine())!= null){
out.println(input);
}
in.close();
}
catch(Exception e){
e.printStackTrace();
}
}
//Clean up resources
public void destroy() {
}
}
my svg file code is :
<svg width="680" height="400" zoomAndPan="disable" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet">
<image id="bg" xlink:href="http://wes09:8001/servlet/testImageSend.class" x="52" y="25" width="126" height="47" fill="blue"/>
</svg>
well if some one have the solution , plz tell me.
looking for ur reply.
Regards
Ather