You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2007/02/20 08:10:51 UTC

DO NOT REPLY [Bug 41658] New: - jpeg image can not show up

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41658>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41658

           Summary: jpeg image can not show up
           Product: Tomcat 5
           Version: 5.5.12
          Platform: PC
        OS/Version: Windows 2000
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Servlets:WebDAV
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: o-soya@seiss.co.jp


Hello

   I made two servlet files and one web.xml as bellow:
ackage jp.wangsuya.testsample;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Sample173 extends HttpServlet {
	public void doGet(HttpServletRequest request, HttpServletResponse 
response)
	
		throws ServletException, IOException{
			response.setContentType("text/html;charset=Shift_JIS");
			PrintWriter out = response.getWriter();
			out.println
("<html<head><title>Sample173</title></head><body>");
			out.println("<h2>�l�p�`�A�h��‚Ԃ�</h2>");
			out.println("<p>");
			out.println("<img src=\"Sample173jpeg\" border=1 
width=300 height=150/>");
			out.println("</body></html>");
			out.close();
	}

}
package jp.wangsuya.testsample;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.OutputStream;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.sun.image.codec.jpeg.JPEGCodec;
import com.sun.image.codec.jpeg.JPEGImageEncoder;

public class Sample173jpeg extends HttpServlet {
	public void doGet(HttpServletRequest request,HttpServletResponse 
response)
		throws ServletException, IOException{
		response.setContentType("image/jpeg");
		OutputStream out = response.getOutputStream();
		BufferedImage img = new BufferedImage
(300,150,BufferedImage.TYPE_INT_RGB);
		Graphics2D g2 = img.createGraphics();
		g2.setRenderingHint
(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
		g2.setBackground(new Color(64,170,191));
		g2.clearRect(0,0,300,150);
		BasicStroke thickLine1=new BasicStroke
(5.0f,BasicStroke.CAP_BUTT,BasicStroke.JOIN_MITER,5.0f);
		g2.setStroke(thickLine1);
		g2.setPaint(Color.gray);
		g2.fill(new Rectangle(30,30,200,80));
		g2.setPaint(Color.red);
		g2.draw(new Rectangle(30,30,200,80));
		
		JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
		encoder.encode(img);
		out.close();
	}

}

<?xml version="1.0" encoding="Shift_JIS"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
	version="2.4">
	
	<servlet>
		<servlet-name>Sample173</servlet-name>
		<servlet-class>jp.wangsuya.testsample.Sample173</servlet-class>
	</servlet>
	
	<servlet-mapping>
		<servlet-name>Sample173</servlet-name>
		<url-pattern>/sample173</url-pattern>
	</servlet-mapping>	
	
	<servlet>
		<servlet-name>Sample173jpeg</servlet-name>
		<servlet-class>jp.wangsuya.testsample.Sample173jpeg</servlet-
class>
	</servlet>
	
	<servlet-mapping>
		<servlet-name>Sample173jpeg</servlet-name>
		<url-pattern>/sample173jpeg</url-pattern>
	</servlet-mapping>

</web-app>

 When I runed servlet/sample173, the img did not show up. But when I runed 
servlet/sample173jpeg, the img showed up. Could tell me why?

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 41658] - jpeg image can not show up

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41658>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41658


funkman@joedog.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
          Component|Servlets:WebDAV             |Servlet & JSP API
         Resolution|                            |INVALID




------- Additional Comments From funkman@joedog.org  2007-02-20 03:44 -------
Please use the tomcat-user list for debugging code. The bug forum is not a 
support group/general help desk.

When running Sample173 - the html printed is asking for an image called 
Sample173jpeg, but the serlvet mapped is sample173jpeg - notice the case 
difference in the beginning 'S'.

Please do not followup to this bug report, if you have more questios - use the 
tomcat user list.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org