BufferedImage image = generateCaptchaImage(engine, cycle, output, height, width, fontSize, noOfBoxesToBeDrawn, noOfLinesToBeDrawn, alphabetCount, letterWidth, background, text); HttpServletResponse response = cycle.getRequestContext().getResponse(); response.setContentType("image/jpeg"); JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(response.getOutputStream()); encoder.encode(image);
replaced above code with below, but my image is not getring rendered on htmp page
BufferedImage image = generateCaptchaImage(engine, cycle, output, height, width, fontSize, noOfBoxesToBeDrawn, noOfLinesToBeDrawn, alphabetCount, letterWidth, background, text); HttpServletResponse response = cycle.getRequestContext().getResponse(); response.setContentType("image/jpeg"); ImageIO.write(image,"jpg",response.getOutputStream());
upgraded jdk from 1.6 to 1.8 and and changed some existing java code with ImageIO codeafter that captcha image is not getting shown.