I developed a component of vaadin with GWT and ReCaptcha service. In the Client-Side load the captcha
script and execute a method using JSNI for display at runtime the Captcha, Into Server-Side valid the captcha via POST. Currently this component is implemented as an application of vaadin and as a maven project and it works perfectly well.
The problem is when i use this component in a portlet that use Liferay. The component (or ReCaptcha) is displayed when init the application portlet sometimes, when i do a restartApplication or refresh the browser showing the captcha sometimes, but is unpredictable. The Widgetset that load the script is:
And to watch the Captcha in browser using the following JSNI:
public static native void create(String key, String div, String theme, String lang, int tabIndex) /*-{
$wnd.Recaptcha.create(key, 'captchaDiv',{
theme:theme,lang:lang,tabindex:tabIndex
});
This function is execute into the updateFromUIDL the first time that this is calling. The component is functional into vaadin application, but as a portlet application not show the captcha.
I’ve done some testing where i can see that this behavior is related with the time that the script takes to load the ReCaptcha. I don’t know how reduce the load time for the script. I don’t know what to do and how to handle this problem. If you need more information just ask i will try to give you as much information as you need.
The result is similar in both cases. I think that this problem is because JavaScript use AJAX request after load the vaadin components and the time for wait the response via Recaptcha service is enough.