I seem to be having an issue with implementing a reCaptcha test on my page which I developed using Adobe's CQ5.
I have a reCaptcha component set up which consists of 2 .jsp files, one for displaying the captcha form and another for verification.
Here's what they look like
reCaptcha.jsp:
`
<%@include file="/libs/foundation/global.jsp"%>
<%
%>
<%@ page import="net.tanesha.recaptcha.ReCaptcha"%>
<%@ page import="net.tanesha.recaptcha.ReCaptchaFactory"%>
<html>
<body>
<form action="reCaptchaValidation.POST.jsp" method="post"><script
type="text/javascript"
src="http://www.google.com/recaptcha/api/challenge?k=public_key">
</script>
<noscript><iframe
src="http://www.google.com/recaptcha/api/noscript?k=public key"
height="300" width="500" frameborder="0"></iframe><br>
<textarea name="recaptcha_challenge_field" rows="3" cols="40">
</textarea> <input type="hidden" name="recaptcha_response_field"
value="manual_challenge"></noscript>
</body>
</html>
`
and here's my validation file reCaptcha.POST.jsp
<%@include file="/libs/foundation/global.jsp"%>
<%
%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page import="net.tanesha.recaptcha.ReCaptchaImpl"%>
<%@ page import="net.tanesha.recaptcha.ReCaptchaResponse"%>
<html>
<body>
<%
String remoteAddr = request.getRemoteAddr();
ReCaptchaImpl reCaptcha = new ReCaptchaImpl();
reCaptcha.setPrivateKey("PRIVATE_KEY");
String challenge = request.getParameter("recaptcha_challenge_field");
String uresponse = request.getParameter("recaptcha_response_field");
ReCaptchaResponse reCaptchaResponse = reCaptcha.checkAnswer(remoteAddr, challenge, uresponse);
if (reCaptchaResponse.isValid()) {
out.print("is good");
} else {
out.print("is bad");
}
%>
</body>
</html>
When I include the component, the reCaptcha form shows up just fine. However, when I input values into the fields and hit return to submit the browser throws up an error like so:
Status
500
Message
javax.jcr.nodetype.ConstraintViolationException: no matching property definition found for {}recaptcha_challenge_field
Location invalid link: /content/Main/reCaptchaValidation.POST.jsp/content/Main/reCaptchaValidation.POST.jsp
Parent Location /content/Main
Path
/content/Main/reCaptchaValidation.POST.jsp
Referer http://localhost:4502/content/Main/Flash.html
ChangeLog
<pre></pre>
I suspect that the issue lies in the way I'm handling my post call, but I have no idea what exactly is going wrong, and hence have no clue as to how to fix this.
Any pointers on this would be much appreciated.. Thanks in advance :)