Class Captcha

All Implemented Interfaces:
Serializable, overit.geocall.marks.MethodExposer, overit.geocall.marks.NameExposer, Arrangeable, Badgeable, Identified, Tool, overit.geocall.ux.configurability.UIConfigurable, overit.geocall.ux.edm.ModelConfigurable

@Component public class Captcha extends Control implements Arrangeable
This class implements the graphic user interface element that is used to display the captcha test, where the user is asked to write down the letters or numbers in a sequence, which appears distorted or blurred on the screen.
The use of this component is suited to those situations in which there is a need to ensure that the data entered in the form have been inserted by a real person, thus preventing the automatic compilation by any bots. Eventually, the user has the possibility to generate a new verification code by clicking on the current image.
The verification of the captcha can be done via code, following the submit of the form, using the validate(java.lang.String) method.
See Also:
GCApi:
component
  • Field Details

    • _captcha

      protected com.octo.captcha.image.ImageCaptcha _captcha
    • _raw

      protected Captcha.Raw _raw
    • _type

      protected String _type
  • Constructor Details

    • Captcha

      public Captcha()
  • Method Details

    • setTYPE

      public void setTYPE(String s)
      Sets the algorithm used to generate the captcha image
      Parameters:
      s - Accepted values are: "Bafflelist", "Deformedbafflelist", "Basic", "Doublerandomlist", "Nonlineartext", "Simplelist"
    • setup

      public void setup()
      Description copied from class: Component
      Setup the Component
      Overrides:
      setup in class Component
    • createCaptcha

      protected void createCaptcha()
    • getLocale

      protected Locale getLocale()
    • validate

      public Boolean validate(String text)
      Checks if the value corresponds to the one requested by the Captcha
      Parameters:
      text - The text inserted by the user
      Returns:
      true if the value corresponds and the validation is passed, false otherwise
    • getHiddenHtml

      public org.apache.ecs.Element getHiddenHtml(Object generationhandle, EntitySet es)
      Description copied from interface: Arrangeable
      Returns the hidden but active html part of an hidden component
      Specified by:
      getHiddenHtml in interface Arrangeable
      Parameters:
      generationhandle - the unique generatin handle
      es - the page entity set
      Returns:
      The html code of the hidden part of the component
    • getHtml

      public org.apache.ecs.Element getHtml(EntitySet es)
      Description copied from class: Component
      Abstract method that must be extended and returns the html code of the Component
      Specified by:
      getHtml in class Component
      Parameters:
      es - The EntitySet to which the element belongs
      Returns:
      The html of the Component
    • getGenerationHandle

      public Object getGenerationHandle()
      Description copied from interface: Arrangeable
      Returns the object to generate when the Arrangeable element is composed by more than one element
      Specified by:
      getGenerationHandle in interface Arrangeable
      Returns:
      The Object to generate
    • getDescriptionHtml

      public org.apache.ecs.Element getDescriptionHtml(Object generationhandle, EntitySet es)
      Description copied from interface: Arrangeable
      Returns the html code that represents the component description i.e. the formatted label of the field
      Specified by:
      getDescriptionHtml in interface Arrangeable
      Parameters:
      generationhandle - the unique generatin handle
      es - the page entity set
      Returns:
      The html code of the label of the field
    • getContentHtml

      public org.apache.ecs.Element getContentHtml(Object generationhandle, EntitySet es)
      Description copied from interface: Arrangeable
      Returns the html code that represents the active part of the component, i.e. the field and the validation scripts
      Specified by:
      getContentHtml in interface Arrangeable
      Parameters:
      generationhandle - the unique generatin handle
      es - the page entity set
      Returns:
      The html code of the component
    • ajaxQuery

      public void ajaxQuery(HttpServletRequest request, HttpServletResponse response)
      Description copied from class: Component
      Method that must be extended to implements the Ajax interaction request / response logic for the Component
      Overrides:
      ajaxQuery in class Component
      Parameters:
      request - HttpServletRequest
      response - HttpServletResponse