JSP as IMG SRC when chrome bug

Source: Internet
Author: User

Nonsense not to say, directly on the code.

Create a new JSP file, named Img.jsp, with the following code:

1<% @pageImport= "Javax.imageio.ImageIO"%>2<% @pageImport= "Java.awt.*"%>3<% @pageImport= "Java.awt.image.BufferedImage"%>4<%@ page language= "java" contenttype= "Image/png"%>5 6<%7BufferedImage image =NewBufferedImage (300, 400,8 Bufferedimage.type_int_rgb);9Graphics g =image.getgraphics ();TenG.fillrect (0, 0, 400, 400); One  AG.setcolor (NewColor (255, 0, 0)); -G.fillarc (20, 20, 100, 100, 30, 120); -  theG.setcolor (NewColor (0, 255, 0)); -G.fillarc (20, 20, 100, 100, 150, 120); -  -G.setcolor (NewColor (0, 0, 255)); +G.fillarc (20, 20, 100, 100, 270, 120); -  +G.setcolor (NewColor (0, 0, 0)); AG.setfont (NewFont ("Arial Black", Font.plain, 16)); atg.DrawString ("Red:climb", 200, 60); -g.DrawString ("Green:swim", 200, 100); -g.DrawString ("Blue:jump", 200, 140); -  - g.dispose (); -  inImageio.write (Image, "PNG", Response.getoutputstream ()); -%>

Viewing directly in the browser will show a picture, as follows:

However, opening the browser's debugging tool will prompt an error:Failed to load resource:net::err_incomplete_chunked_encoding

In fact, we do this kind of picture, the most time should be the production of verification code, that is, to other pages to call, at this time a new JSP page, the code more only need to increase

Access the JSP file, report the same error, and the page will not show the picture, but the effect flashed through ~ ~

This phenomenon only appears in Chrome (opera also has), IE, Firefox normal display. Reasons for not checking.

Find a similar problem here, said Chrome bug, waiting to be resolved.

JSP as IMG SRC when chrome bug

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.