Examples of generateImage()


Examples of com.andrewtimberlake.captcha.Captcha.generateImage()

    response.addHeader("Pragma", "No-cache");
    response.addHeader("Expires", RFC822_FORMAT.format(Calendar.getInstance().getTime()));
    String resource = request.getRequestURI();
    String extension = resource.substring(resource.lastIndexOf('.') + 1).toLowerCase();
    if (extension.equals("jpg") || extension.equals("png")) {
      BufferedImage image = captcha.generateImage();
      response.setContentType("image/" + extension);
      ImageIO.write(image, extension, response.getOutputStream());
    } else {
      BufferedImage image = captcha.generateImage();
      response.setContentType("image/png");
View Full Code Here

Examples of com.andrewtimberlake.captcha.Captcha.generateImage()

    if (extension.equals("jpg") || extension.equals("png")) {
      BufferedImage image = captcha.generateImage();
      response.setContentType("image/" + extension);
      ImageIO.write(image, extension, response.getOutputStream());
    } else {
      BufferedImage image = captcha.generateImage();
      response.setContentType("image/png");
      ImageIO.write(image, "png", response.getOutputStream());
    }
  }
}
View Full Code Here

Examples of net.sourceforge.plantuml.SourceStringReader.generateImage()

            String text = doc.getStringValue();
            SourceStringReader reader = new SourceStringReader(text);

            FileFormat fmt = "svg".equals(format) ? FileFormat.SVG : FileFormat.PNG;

            String desc = reader.generateImage(baos, new FileFormatOption(fmt));
            if (desc == null) {
                throw new XProcException("PlantUML diagram returned null");
            }
        } catch (XProcException e) {
            throw e;
View Full Code Here

Examples of net.sourceforge.plantuml.SourceStringReader.generateImage()

        outputFile = new File(outputFile, fileName.replace("/", File.separator));
        doclet.printNotice("Generating UML diagram " + outputFile);
        // render
        SourceStringReader reader = new SourceStringReader(new Defines(), source, config);
        try {
            reader.generateImage(outputFile);
        }
        catch ( IOException e ) {
            doclet.printError(tag.position(), "Error generating UML image " + outputFile + ": " + e.getLocalizedMessage());
        }
    }
View Full Code Here

Examples of net.sourceforge.plantuml.SourceStringReader.generateImage()

    private void handleImageProxy(HttpServletResponse response, String num, String source) throws IOException {
        SourceStringReader reader = new SourceStringReader(getSource(source));
        int n = num == null ? 0 : Integer.parseInt(num);

        reader.generateImage(response.getOutputStream(), n, new FileFormatOption(getOutputFormat(), false));
    }

    private String getSource(String uri) throws IOException {
        CookieModule.setCookiePolicyHandler(null);
View Full Code Here

Examples of net.sourceforge.plantuml.SourceStringReader.generateImage()

            // 2009 dec 22 constant date in the past
            response.addHeader("Cache-Control", "public");
        }
        response.setContentType("image/png");
        SourceStringReader reader = new SourceStringReader(uml);
        reader.generateImage(response.getOutputStream(), new FileFormatOption(FileFormat.PNG, false));
    }

}
View Full Code Here

Examples of net.sourceforge.plantuml.SourceStringReader.generateImage()

        if (StringUtils.isDiagramCacheable(uml)) {
            addHeaderForCache();
        }
        response.setContentType(getContentType());
        SourceStringReader reader = new SourceStringReader(uml);
        reader.generateImage(response.getOutputStream(), new FileFormatOption(format, false));
    }

    void sendMap(String uml) throws IOException {
        if (StringUtils.isDiagramCacheable(uml)) {
            addHeaderForCache();
View Full Code Here

Examples of net.sourceforge.plantuml.SourceStringReader.generateImage()

        if (StringUtils.isDiagramCacheable(uml)) {
            addHeaderForCache();
        }
        response.setContentType(getContentType());
        SourceStringReader reader = new SourceStringReader(uml);
        String map = reader.generateImage(new NullOutputStream(), new FileFormatOption(FileFormat.PNG, false));
        String[] mapLines = map.split("[\\r\\n]");
        PrintWriter httpOut = response.getWriter();
        for (int i = 2; (i + 1) < mapLines.length; i++) {
            httpOut.print(mapLines[i]);
        }
View Full Code Here

Examples of org.apache.myfaces.custom.captcha.util.CAPTCHAImageGenerator.generateImage()

       
        // Generate random CAPTCHA text.
        captchaText = CAPTCHATextGenerator.generateRandomText();       
       
        // Generate the image, the BG color is randomized from starting to ending colors.
            captchaImageGenerator.generateImage(response, captchaText,
            startingColor, endingColor);

        // Set the generated text in the user session.
        request.getSession().setAttribute(captchaSessionKeyName,
            captchaText);
View Full Code Here

Examples of org.apache.myfaces.custom.captcha.util.CAPTCHAImageGenerator.generateImage()

                    config.isPrefixCaptchaSessionKey() ?
                    AbstractCAPTCHAComponent.ATTRIBUTE_CAPTCHA_SESSION_KEY_NAME+
                    "_"+captchaSessionKeyName : captchaSessionKeyName, captchaText);

            // Generate the image, the BG color is randomized from starting to ending colors.
            captchaImageGenerator.generateImage(response, captchaText,
                    startingColor, endingColor);
        }
        finally
        {
            out.close();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.