Thorbjørn Ravn Andersen wrote:
Ralph Daugherty skrev:
Hi Thorbjørn, I am already doing what you are suggesting. The class I started with is (as I posted back aways) org.apache.myfaces.custom.captcha.util and I am bringing in supporting classes for generating a PNG text image twisted based on this. It is Apache's robust CAPTCHA logic, unmodified.

I am not concerned about the size of unused code in a jar, if I were I would be the only one in IT anymore that was, and I know that ClassNotFound won't happen unless class is invoked.

Keeping from invoking unrelated classes is the trick though. I'm not interested in that approach, but thanks for the suggestion.

There will be one override or modification in the starting class from using HTTPResponseStream to another bytestream output. Other than that, code is generated and twisted based on properties, and there are/will be calls to change the defaults or generate based on passed in parms.

The key class is CAPTCHAImageGenerator in that package.

I agree. I had a quick look inside Tomahawk, and it looks like the major meat you have to rip out is:


// construct the CAPTCHA image generator object.
CAPTCHAImageGenerator captchaImageGenerator = new CAPTCHAImageGenerator();
try
{
String captchaText;
Color endingColor = ColorGenerator.generateRandomColor(null);
Color startingColor = ColorGenerator.generateRandomColor(endingColor);
// 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);


and the CAPTCHAImageGenerator looks to be dependent only on Java2D.

I'll have a closer look after the weekend.


/Thorbjørn

It also is dependent on apache batik PNGEncoder, and therein the batik infrastructure.

Thanks for your insight. I'll see this weekend whether I finish getting all the code together. But this code here is the start of the interface.

rd



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.