tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prad <prad4...@yahoo.co.in>
Subject Re: How send svg content to browser as response
Date Wed, 06 Sep 2006 04:19:09 GMT

Hi ,
Am sorry...Actually i was wrong...While posting i made a mistake
Here it is...
 public void doGet(HttpServletRequest  request,
                      HttpServletResponse response)
			     throws ServletException, IOException
		{
                    response.setContentType("image/svg+xml");
                    ServletOutputStream out = response.getOutputStream()
                    out.println("<?xml version=\"1.0\"?>\n" +
                                            "<svg width=\"100px\"
height=\"20px\" viewBox='0 0 400 400'>\n" +
                                         "  <text x=\"10\" y=\"20\" >SVG
serverside</text>\n" +
                                       "</svg>");	
		
		                               out.close();    
        
                 }
this is workin fine....Here am just writing out only one element as response
.....I need to write whole svg file to browser...Any help

Thanks & Regards
Prad


Markus Schönhaber wrote:
> 
> prad wrote:
>> Am processing some svg files on server side and after processing i need
>> to
>> send the svg as response...I set the mime type as "image/svg+xml"
>> and  tried the below code
> 
> What has this servlet...
>>  public void doGet(HttpServletRequest request,
>>                       HttpServletResponse response)
>> 		    throws ServletException, IOException{
>>
>> 	response.setContentType("text/html");
>> 	PrintWriter out = response.getWriter();
>>
>> 	out.println("<html>");
>> 	out.println("  <head>");
>> 	out.println("    <title>SimpleServlet</title>");
>> 	out.println("  </head>");
>> 	out.println("  <body>");
>> 	out.println("    Hello, World");
>> 	out.println("  </body>");
>> 	out.println("</html>");
>>     }
> ...to do with SVG?
> 
>> when i invoke this servlet .....it's showing download dialog box and if
>> press ok .....servletName.svg file gets downloads
> 
> The above servlet shows the behaviour you describe? I doubt that.
> 
>> Why its not directly displaying the contents in the browser...Any help
>> plz..
> 
> You should first of all clarify what you're doing. I don't see any
> connection 
> between the servlet code above and SVG.
> 
> Second: Is your browser capable of rendering SVG content / has a plugin 
> installed for rendering SVG content?
> Does
> http://localhost:8080/jsp-examples/jsp2/jspx/textRotate.jspx?name=JSPX
> work with your browser (assuming your Tomcat is installed on your local 
> machine and listening on port 8080)?
> 
> Regards
>   mks
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-send-svg-content-to-browser-as-response-tf2219904.html#a6164671
Sent from the Tomcat - User forum at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message