You are on page 1of 60

Space Details

 


 
 
      

      


   !
      
 "#  !

Available Pages
• $ 
• %    
• 
• & ' 
• (   (   
• 
• )
• * )
• +
• ,- -  
• $%.
• / 
•   )
• 0  ) -  ) 
•    1    - 2 34 ) % 30 5 
• 0- 
• 6 
•           
•  7  
• 1 +    - 
•    %,56% )  ++    )
•   )  / $'
• 0     
• /     
• 8 

Document generated by Confluence on mars 27, 2007 00:53 Page 1


Features

5   ) 


 "    

        

9 6   7     
9 & )   -      
 !
9 :  ) $  
9 8      * )  &;
9 0  )-   -    )<  
9 &    )     - 
   !

!    "    

9 6   -   5 )- 


9 & )        )     
9 %     - = = '   ) ) -  -  )-  - : 
%  

Document generated by Confluence on mars 27, 2007 00:53 Page 2


Architecture overview

5   )   >   

# 

5   
  )   *      ) - 

9 +*    )-  )     -    5   )   
)  )     -   )-          -   
9 1              -' 5    ) 
)         )      ))   )  +  )   )
   -   /      )     
9 -        5    )   )  ) 
 7)  $ 
9 -        /  ) )  5    )   
)   )        &?    )  )  
-  -   

$%%&

Document generated by Confluence on mars 27, 2007 00:53 Page 3


Document generated by Confluence on mars 27, 2007 00:53 Page 4
why

5   ) 


 "    

'" ()*+,

5      ' - 454 5      0$, -    )   
    3      @) =      
     
) ))     4  /     

'" 
&-    " ,

A    -'   )) -           B 5
  @              ')       ) %1
 

9 $   -  - 


C 5         )      -)     - ) D - * 
:   '         - ) - 40
C /  -        )--  ) %1         
)    E
C 5
  -' )        )-   
       -  )  ) ) !
9 $ 
    - 
C 5   
 37)           )     '
C 6         )         
C 5
  -' )      7       )

    !
9 $ 
  )    - 
C 5  E        
C 6             )          

     
C 5
  -'         )    -      )
)   
 ! -    )-  )        )  

 !

Document generated by Confluence on mars 27, 2007 00:53 Page 5


Many thanks to

5   ) 


 "    

9 454 5       -  )       F


F D<<  <-<< -F
9 5   5 -   
F D<<   <<  G"-F
9  6*   -
  -  -   -  
F D<<
  <6H-F
9 H 5 - 
  
9 %
   -       ) -)  '
9 2  & -      ) ) 
9 %  -  -    4//F
F D<<  << G G-F
9 @ -  -    4//F
F D<< @ << @G -F
9 ,  ' 7 -      ) ) 

Document generated by Confluence on mars 27, 2007 00:53 Page 6


Developer Documentation

5   )  -I  J  

% 
  

9 
C )
C * )
9 +
C ,- -  
9 $%.
9 / 
C   )

Document generated by Confluence on mars 27, 2007 00:53 Page 7


core

5   ) 


 "J   

1  -' D

9 %               @     )   


 )   

9 %           $   )  )   )   7)  

5
   )  -  )     -  )  )   )  $ 

1   )    )   '  ) )!    )   ) 
)!   )  )  

9 )
9 * )

Document generated by Confluence on mars 27, 2007 00:53 Page 8


design

5   ) 


 "J   

   

5    -  -   '  D

9   D      -  E  E 


C 1      ) -  @     )   )   
9  $  D     )           )  

  


5 )  )-        '       )  -    )
      )    -    )  

Document generated by Confluence on mars 27, 2007 00:53 Page 9


'

) - . 
 /   ! 

   ) 
K):  :  )  ( K): 
  7)     )  
   
)!

!
.

) - . 
 /   ! 

        :   /   '

    ') 


 ')   :   ') $ 0)? '): 


   )- 


)-    %  )-   1(- ?$ 


    *  
*    ,  *   / 5* , 
 '

   -  


-      - 5 )%)/)0)$ :

   ) 


)       -  (-) )K)51
   

0 

) - . 
 /   ! 

   ) )    :  ) /   '


Comments

6
1      5* ,  ) ? '):   -  
 
1       -  ) 
    *  %  5* ,  ) %  ? '):   !  
 '  ) $  )    -    E * )     
      '! )    )
&       '    )   )

5' 4  & 

, )     "  




Document generated by Confluence on mars 27, 2007 00:53 Page 10


extends

5   )  -I >   

&'        5 )  E   D

9 -)   -    - *     


9 &'    '    )     ) ) ) -    -
 !
9 (-       ' D
C &  * )    1  
   )/) 
3 )  -)     -  - !
3      ) 0   )
3      4
 ) )4
  )  )  '   
 7 
C &  $  * )    1 $  
   )/) $ 
3 )        '      )  
3     1    /)   )      
  7)          

Document generated by Confluence on mars 27, 2007 00:53 Page 11


Engine

5   )  -I >   

%        )   )   7)  


5 3 
   )  -  )     -  )  )   
1  
 3  -    )  

Document generated by Confluence on mars 27, 2007 00:53 Page 12


Proof of concept

5   ) 


  " J  

%    %1   '   


 ) )    )   * 
 

K    -)          D 8 %1   %,56% )  
 

1 )  )  - -   -  -' )          
-   )        

 1 % 

9 )      )--  


9 '    )'    ') )   
9  )   -   ') )   
9 )          
9 ) '   )    )   )  )
9     )  
9     )    
9   )--  -     
9     -     )      ) )!

9 )     -  


9 '  *  -        
9  )             
9 ) '    @ 

!

 

H    )   )    )   2 .


     )    @
&   

 . 2 . 





- "  & & 3  "       4 

5      -   )   K): 


5 )       )  
0)K): 

0 0
 !
.  " . '#.    

/ H 1 +  LM

Document generated by Confluence on mars 27, 2007 00:53 Page 13


 
 ( K): 

0  #
. '#.    

(- : +  #

5  ( K):          )        
) )  7     - ) 54(4D-)   )  !


 "    
4

5  )       /  -  0)5* ,       ) 

    &  "  

1)

  
4  "    " 


5      -   )    ')   5* , 
1 )  ) *  ) *   )      '        
    -'         ) )  
      
 )!

0  #
. 2)    

(- : +  L>

- 
 2  . "     ".

5  )    *      -  5* ,  ?-- 5* , 

0  #
. 5 *2)    

(- : +  #L

  
  " "  
       &

5      -    -   $ : 


1   *           -          ) 
*    *   !

5   

Document generated by Confluence on mars 27, 2007 00:53 Page 14


5 )0)$ : 
 
5 )%)/)0)$ : 
5     - 

5          )     )  -  )     )  
)  D

float angle = myRandom.nextFloat() / 3;

" % .  "   % " "   &" "
 

5       )  


   H    )  
%     E * E       (-  -    ))   6H
 -  
8    EE -   -    ) )   (- : + D

  D

Comments

  
  -     )      
  )    '   D
 D<<7< 
 <  <

5'


, )   -I "  




Document generated by Confluence on mars 27, 2007 00:53 Page 15


FAQ

5   ) 


 "# J  

00!5!!*6

            )    


   - 
5      )         
/ D

9 & , D +   - %,56%


9 1    - 2 34 ) % 30 5 
9 N D<< '- <)*  BO  P O:Q
H 77     ) /)           

788

.  D
%F D

    +*  D


 1  +D R   ;"" )  
RDR     -  (1/,H%A  
4

 6) +*  D


= ;"" (1/,H%A   
     -)       @  

% D
A    -)     D  )-   )  ;/  
  

5 '     ) 

$ -  -
     "L   (S     
   D

-Djava.awt.headless=true

 
5  )     
4 
5     -  ! )     ) ))  5 ' $    
1 )    )      -  * 5  '  )  )
 
) 
+*  D

/**
* Description: This Factory is used in order to switch from the
* java.awt.Toolkit component to other implementation like <a

Document generated by Confluence on mars 27, 2007 00:53 Page 16


//www.eteks.com/pja/en/">PJA Toolkit</a>. By default this factory
* return the java.awt.Toolkit object.
But if the the parameter
* <code>toolkit.implementation</code> is fixed as a parameter of the virtual machine with
* the value of the class name of another implementation of Toolkit, this
* factory return an implementation of this class. For exemple if you set to
* your virtual machine <code>-Dtoolkit.implementation=com.eteks.awt.PJAToolkit</code>, the
* factory returns an implementation of com.eteks.awt.PJAToolkit
*/

/   D

9  D<< ) ) <


<3-@<3*3 
9  D<<)   <'<*)3 

)
 

1         D     - ,8 ) 0%&


%            -    )   )    -  
1 )         
   -'    )  ) )    
 ))     )  
5          -  )    * )   <*
K      )    )      )   -
H)     D

9       )  D     ,8<0%&  -        


 
9      ') )  D     ,8<0%&  -      -  
   
9        )  D     ,8<0%&  -      -  
          
5  )           )    )    -  D

jcaptcha.load.test.exclude=**/*LoadTest*.*

 D
 D<<-" @ <<
 <
 < )   BO"" T 

  .
  (7

5
    ) 
* -   
%     ) D

9 0    


9 8 )       
9   ) ?-- 
5      -  &  /   -   &;  )
% )   )  &;                  / 

Document generated by Confluence on mars 27, 2007 00:53 Page 17


  &; 
/ )  )    )
 )  - )  

Document generated by Confluence on mars 27, 2007 00:53 Page 18


Service

5   )  -I >   

%         ) @    )   )     )  )

      )  -  )     -  )  )    

1  
 3     

Document generated by Confluence on mars 27, 2007 00:53 Page 19


service design

5   )  -I >   

    

5   -  -   '    /   -  1 )  )   
  @  )   )      )  @ 1(

1      )   )! 5  ' )    &)    
*   )         )   + )  /  5
%  &  /    )    &?      )   - 
   ) !



Document generated by Confluence on mars 27, 2007 00:53 Page 20


Research and future directions

5   )   L J  

*"  "        " 


 

9    1    - 2 34 ) % 30 5 


9 0- 

4  2    "

/     D


/+8015A ) 0A,54:0%,6A " 3M

Document generated by Confluence on mars 27, 2007 00:53 Page 21


Comments on Inaccessibility of Visually-Oriented Anti-Robot Tests

5   )   "   

K40S1=: (0%$5

! 

%      
   -  ) -  -   5     ) ) 
         ))       
 
=      ' -)  K# K %    1  

4          )   )) )  )       E 1    -
2 34 ) % 30 5  ,  ) %  E    )  = #

K      -     -  

4   " 4


        

K     -     -         -         


 

4    "  "  

1   -          )  3       
-   ) -  '  '      
 

4   %.

K ) )   ) )         5    ' 
   )          '    
/                    

4     "




4              

4 "


!               


      ) ) =


   -) )       =A    -)
     

Document generated by Confluence on mars 27, 2007 00:53 Page 22


5     )--   )   )   )  

0    )   )        *D  ) -)   ' 
))          '    !
5     )--  K          ) -   )
)   -  
%    -     5  !   
     )       -
)    

=  D  )       )    -          )    

4    4  

%   )  ) )        )        )   
 

9 %     ) ))  -    


C  D $) ) 1)   / 
C #D ) 3 )  ) 

K )     -    D

9 %  )    ' %,56%       )      '  


5  
5 ') -     )  - D
C  D )  
5     - )   D
3 1       )   )      )    
? D
3 5   -       - )-  F
3 /          ) ) )      
   -    )     
C J D    '
5           )    
1))    '            -     )
) ) 3     ) -)

9 &      '  5  


5 ') -    )D
C " D  77 
K       & &     K   )  )  77 
      
) )           77  ?       - )
        ) )    
,            - ) )     )  
-  5    -)       

9 C D H )3   


5     -     '

Document generated by Confluence on mars 27, 2007 00:53 Page 23


C L D        
5      D  5   5     -     D )
   -  @    )       *    

0 &"  ,

9 %   
C           @       -       
          ) )  !  )       
      
C ?              - -  

9 %   D             !     77 
%    )  )  )  *   77            )
K           )            ) )
 !
K '       )   77        ))  *  )
  -     %1       !    * %1  
/       D ,  -  %    

Document generated by Confluence on mars 27, 2007 00:53 Page 24


References

5   )   L J  

)*+ *"

9 %,56%

9 6 7    ) %1 ? H  % & ?  )  H-)

9 %,56%D8 6) %1 ,  $ /    H  % & ?  =    6 
)  H-)

9 &    $)  - 8) ) ) (    7 /  7  
4=//! /   & ?  ,1! % ?  3,1! H ?  3,1! /  0) 
3,1!
0  %  D 0 K  H  %

)*+  

9 2-  ,  - 6D5 = %,56%  = 0 K


9 % #(    &  : S 

  4

9 ,  -  %    


9 1    - 2 34 ) % 30 5   & &
9 ( 1  %      &' , 

5 -.

9 ?'  2 %,56%  : & )  ) & '


9 8 %1   %,56% )        
9 , ) KE =  5      6 %   / 64+2%0

0  -

9 8 :  5 5  5   %  ) ((/ %  ' % K /  K  :
& %  /   ( H '
%  ( S  2 & ( 0 

Document generated by Confluence on mars 27, 2007 00:53 Page 25


9 ? 73L3/ D / 47) ((/ %  ' 5 & $  )  /'  S)  (
S  &    %  ?
9 &42+D % +)3 3+) /   5 = ' ( - /   %  /  %  (
S   = 2 & ( 0 

0

9 $  /  & ? + 5 A 5'    ('
9 /  ?E $ ( 3,) 5' ) ?  %      H 
4E:%

Document generated by Confluence on mars 27, 2007 00:53 Page 26


How to

5   ) 


  "# J  

9           


C   
C 1 +    - 
C %) 
9 ) 
C 0     
C /     
C    %,56% )  ++    )

Comments

 ))          -

    B

, )  )' "    "> J




Document generated by Confluence on mars 27, 2007 00:53 Page 27


5 minutes application integration tutorial

5   )   J    

5  )     


       

5      /  )      %    !

   

%))
 3 
  ))  3)  ! ) 3   3"     ))
     !             K+?31=$<  - )

   0#  )-         $ 6&  ) -      
 /  !

!       " 0% 

1
   .

import com.octo.captcha.service.image.ImageCaptchaService;
import com.octo.captcha.service.image.DefaultManageableImageCaptchaService;

public class CaptchaServiceSingleton {

private static ImageCaptchaService instance = new DefaultManageableImageCaptchaService();

public static ImageCaptchaService getInstance(){


return instance;
}
}

  
.  " %

import com.octo.captcha.service.CaptchaServiceException;
import com.sun.image.codec.jpeg.JPEGCodec;
import com.sun.image.codec.jpeg.JPEGImageEncoder;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;

public class ImageCaptchaServlet extends HttpServlet {

Document generated by Confluence on mars 27, 2007 00:53 Page 28


public void init(ServletConfig servletConfig) throws ServletException {

super.init(servletConfig);

protected void doGet(HttpServletRequest httpServletRequest, HttpServletResponse


httpServletResponse) throws ServletException, IOException {

byte[] captchaChallengeAsJpeg = null;


// the output stream to render the captcha image as jpeg into
ByteArrayOutputStream jpegOutputStream = new ByteArrayOutputStream();
try {
// get the session id that will identify the generated captcha.
//the same id must be used to validate the response, the session id is a good
candidate!
String captchaId = httpServletRequest.getSession().getId();
// call the ImageCaptchaService getChallenge method
BufferedImage challenge =
CaptchaServiceSingleton.getInstance().getImageChallengeForID(captchaId,
httpServletRequest.getLocale());

// a jpeg encoder
JPEGImageEncoder jpegEncoder =
JPEGCodec.createJPEGEncoder(jpegOutputStream);
jpegEncoder.encode(challenge);
} catch (IllegalArgumentException e) {
httpServletResponse.sendError(HttpServletResponse.SC_NOT_FOUND);
return;
} catch (CaptchaServiceException e) {
httpServletResponse.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
return;
}

captchaChallengeAsJpeg = jpegOutputStream.toByteArray();

// flush it in the response


httpServletResponse.setHeader("Cache-Control", "no-store");
httpServletResponse.setHeader("Pragma", "no-cache");
httpServletResponse.setDateHeader("Expires", 0);
httpServletResponse.setContentType("image/jpeg");
ServletOutputStream responseOutputStream =
httpServletResponse.getOutputStream();
responseOutputStream.write(captchaChallengeAsJpeg);
responseOutputStream.flush();
responseOutputStream.close();
}
}

     &42


<servlet>
<servlet-name>jcaptcha</servlet-name>
<servlet-class>ImageCaptchaServlet</servlet-class>
<load-on-startup>0</load-on-startup>
</servlet>

%)

<servlet-mapping>
<servlet-name>jcaptcha</servlet-name>
<url-pattern>/jcaptcha</url-pattern>
</servlet-mapping>

Document generated by Confluence on mars 27, 2007 00:53 Page 29


*" 

,)  -          ! )    * -   

<img src="/jcaptcha">
<input type='text' name='j_captcha_response' value=''>

" %    

6)           !


5  )  $1)  )     -      

Boolean isResponseCorrect =Boolean.FALSE;


//remenber that we need an id to validate!
String captchaId = httpServletRequest.getSession().getId();
//retrieve the response
String response = httpServletRequest.getParameter("j_captcha_response");
// Call the Service method
try {
isResponseCorrect =
CaptchaServiceSingleton.getInstance().validateResponseForID(captchaId,
response);
} catch (CaptchaServiceException e) {
//should not happen, may be thrown if the id is not valid
}

//do something according to the result!

'  



6  '   )  ))             -'

Comments

     ))    F

, )       




5'       F < $ H)

, )     >  




U  V 1      /  U<  V

1    BB

, )    #  

Document generated by Confluence on mars 27, 2007 00:53 Page 30




1      /  V            

, )     J  




 

 / /   1  ! ) 0 $1(  1)


 G !W

   

     / +*  D 1 ) 1(  )   ) 

1     '      


*        - 

$  -       )   -


 )       *  

1   )          )   B

1   )   -)    )  )    1 )E     ) B

, )  -       J




6

1E      /,   )  R  -R    )  1   @ D

"D  )     )      -         /    B ( 1
)     -       B 1-      *      - 
) -    '

D  )   R


 R -  R  R  U  OR
 RV    B 1 - '
  )   -     /         )    - 
 B / )         -      'B

#D    R6)           !R )    
  
-    /,      )   B 1E      - 

5'  -   F

, )    


  J J


Document generated by Confluence on mars 27, 2007 00:53 Page 31


1 ' - 

2  ))
5' FF

, )  )' "     J




5     ) )  ') - -   1     )--   -  
    ) )   ! 1   )   / /    - D

     1 /     O   7/ !W

     1 /    7/ !


X
/ H 1 +  O  / H 1 +!W
))$  : $ 
0)K): R%?(+$:61SH&=4,.0/582K;AYR!   )K)51
0)$ :  1 "!  1 "J!!  $'? '): 
1 !  1 "!!  0)5* ,  1 J!  1 "!
 ?H%S!!!!W
   (- & 1 /  $ 6&  / !  "M
"  !W
Q

1       ) ) *      E  ) 5    ) 
*  )   1   ) 0 $1(              !
      () 1 )   B K  )     '    B

, )      -I " 




5       *  1-  /,       )     -) 

    

5 -*        -     /, - D


U  OR
 RV

5D
U  OR<
 RV

, )  *)     




Document generated by Confluence on mars 27, 2007 00:53 Page 32


customize an engine

5   )    J  

%    %1   '   


 ) )    )   * 
 

K    -)          D 8 %1   %,56% )  
 

1 )  )  - -   -  -' )          
-   )        

 1 % 

9 )      )--  


9 '    )'    ') )   
9  )   -   ') )   
9 )          
9 ) '   )    )   )  )
9     )  
9     )    
9   )--  -     
9     -     )      ) )!

9 )     -  


9 '  *  -        
9  )             
9 ) '    @ 

!

 

H    )   )    )   2 .


     )    @
&   

 . 2 . 





- "  & & 3  "       4 

5      -   )   K): 


5 )       )  
0)K): 

0 0
 !
.  " . '#.    

/ H 1 +  LM

Document generated by Confluence on mars 27, 2007 00:53 Page 33


 
 ( K): 

0  #
. '#.    

(- : +  #

5  ( K):          )        
) )  7     - ) 54(4D-)   )  !


 "    
4

5  )       /  -  0)5* ,       ) 

    &  "  

1)

  
4  "    " 


5      -   )    ')   5* , 
1 )  ) *  ) *   )      '        
    -'         ) )  
      
 )!

0  #
. 2)    

(- : +  L>

- 
 2  . "     ".

5  )    *      -  5* ,  ?-- 5* , 

0  #
. 5 *2)    

(- : +  #L

  
  " "  
       &

5      -    -   $ : 


1   *           -          ) 
*    *   !

5   

Document generated by Confluence on mars 27, 2007 00:53 Page 34


5 )0)$ : 
 
5 )%)/)0)$ : 
5     - 

5          )     )  -  )     )  
)  D

float angle = myRandom.nextFloat() / 3;

" % .  "   % " "   &" "
 

5       )  


   H    )  
%     E * E       (-  -    ))   6H
 -  
8    EE -   -    ) )   (- : + D

  D

Document generated by Confluence on mars 27, 2007 00:53 Page 35


ImageCaptchaEngine components reference

5   ) 


  " J  

2
  
 & 

5     -   E     /  * - 
/     @          -  *   /   
  

/   D  7  

9 +*  -    )  )


9 ?   
C $ 
C    
3 /   
3 H -  
3 0 -  
C H  
9 /     
C ? ')
C (- 
9 -  * 
C 1 $ *
C 1 / *

5  


/

<bean id="fontArial" class="java.awt.Font" >


<constructor-arg index="0"><value>Arial</value></constructor-arg>
<constructor-arg index="1"><value>0</value></constructor-arg>
<constructor-arg index="2"><value>10</value></constructor-arg>
</bean>

<bean id="fontTahoma" class="java.awt.Font" >


<constructor-arg index="0"><value>Tahoma</value></constructor-arg>
<constructor-arg index="1"><value>0</value></constructor-arg>
<constructor-arg index="2"><value>10</value></constructor-arg>
</bean>

<bean id="fontVerdana" class="java.awt.Font" >


<constructor-arg index="0"><value>Verdana</value></constructor-arg>
<constructor-arg index="1"><value>0</value></constructor-arg>
<constructor-arg index="2"><value>10</value></constructor-arg>
</bean>

<bean id="fontComic" class="java.awt.Font" >


<constructor-arg index="0"><value>Comic sans
MS</value></constructor-arg>
<constructor-arg index="1"><value>0</value></constructor-arg>

Document generated by Confluence on mars 27, 2007 00:53 Page 36


<constructor-arg index="2"><value>10</value></constructor-arg>
</bean>

<bean id="fontLucida" class="java.awt.Font" >


<constructor-arg index="0"><value>Lucida
console</value></constructor-arg>
<constructor-arg index="1"><value>0</value></constructor-arg>
<constructor-arg index="2"><value>10</value></constructor-arg>
</bean>

 . 

0. 

<bean id="colorGenYellow" class="com.octo.captcha.component.image.color.SingleColorGenerator" >


<constructor-arg index="0"><ref bean="yellow"/></constructor-arg>
</bean>

   

<bean id="colorGenRandomList"
class="com.octo.captcha.component.image.color.RandomListColorGenerator" >
<constructor-arg index="0">
<list>
<ref bean="yellow"/>
<ref bean=" blue "/>
<ref bean=" lightBlue "/>
</list>
</constructor-arg>
</bean>
<bean id="blue" class="java.awt.Color" >
<constructor-arg type="int" index="0"><value>0</value></constructor-arg>
<constructor-arg type="int" index="1"><value>0</value></constructor-arg>
<constructor-arg type="int" index="2"><value>255</value></constructor-arg>
</bean>

<bean id="lightBlue" class="java.awt.Color" >


<constructor-arg type="int" index="0"><value>200</value></constructor-arg>
<constructor-arg type="int" index="1"><value>200</value></constructor-arg>
<constructor-arg type="int" index="2"><value>255</value></constructor-arg>
</bean>

<bean id="yellow" class="java.awt.Color" >


<constructor-arg type="int" index="0"><value>255</value></constructor-arg>
<constructor-arg type="int" index="1"><value>255</value></constructor-arg>
<constructor-arg type="int" index="2"><value>0</value></constructor-arg>
</bean>

9 .  

<bean id="colorGenRandomBlue"
class="com.octo.captcha.component.image.color.RandomRangeColorGenerator" >
<constructor-arg index="0">
<list>
<value>150</value>
<value>255</value>
</list>
</constructor-arg>
<constructor-arg index="1">
<list>

Document generated by Confluence on mars 27, 2007 00:53 Page 37


<value>0</value>
<value>50</value>
</list>
</constructor-arg>
<constructor-arg index="2">
<list>
<value>200</value>
<value>255</value>
</list>
</constructor-arg>
<constructor-arg index="3">
<list>
<value>255</value>
<value>255</value>
</list>
</constructor-arg>
</bean>

 

<bean id="java.util.Locale.FRANCE"
class="org.springframework.beans.factory.config.FieldRetrievingFactoryBean"/>
<bean id="java.util.Locale.US"
class="org.springframework.beans.factory.config.FieldRetrievingFactoryBean"/>

0   


5 -. 

<bean id="backGenUni"
class="com.octo.captcha.component.image.backgroundgenerator.UniColorBackgroundGenerator" >
<constructor-arg index="0"><value>300</value></constructor-arg>
<constructor-arg index="1"><value>100</value></constructor-arg>
</bean>

<bean id="backGenFunky"
class="com.octo.captcha.component.image.backgroundgenerator.FunkyBackgroundGenerator" >
<constructor-arg index="0"><value>300</value></constructor-arg>
<constructor-arg index="1"><value>100</value></constructor-arg>
<constructor-arg type="com.octo.captcha.component.image.color.ColorGenerator"
index="2"><ref bean="colorGenRandomList"/></constructor-arg>
<constructor-arg type="com.octo.captcha.component.image.color.ColorGenerator"
index="3"><ref bean="colorGenRandomList"/></constructor-arg>
<constructor-arg type="com.octo.captcha.component.image.color.ColorGenerator"
index="4"><ref bean="colorGenRandomList"/></constructor-arg>
<constructor-arg type="com.octo.captcha.component.image.color.ColorGenerator"
index="5"><ref bean="colorGenRandomList"/></constructor-arg>
<constructor-arg index="6"><value>0.2f</value></constructor-arg>
</bean>

<bean id="backGenMultiShape"
class="com.octo.captcha.component.image.backgroundgenerator.MultipleShapeBackgroundGenerator" >
<constructor-arg index="0"><value>300</value></constructor-arg>
<constructor-arg index="1"><value>100</value></constructor-arg>
<!--firstEllipseColorGenerator-->
<constructor-arg index="2"><ref bean="lightBlue"/></constructor-arg>
<!--secondEllipseColorGenerator-->
<constructor-arg index="3"><ref bean="lightRed"/></constructor-arg>
<!--spaceBetweenLine-->
<constructor-arg index="4"><value>10</value></constructor-arg>
<!--spaceBetweenCircle-->
<constructor-arg index="5"><value>5</value></constructor-arg>

Document generated by Confluence on mars 27, 2007 00:53 Page 38


<!--ellipseHeight-->
<constructor-arg index="6"><value>10</value></constructor-arg>
<!--ellipseWidth-->
<constructor-arg index="7"><value>6</value></constructor-arg>
<!--firstRectangleColorGenerator-->
<constructor-arg index="8"><ref bean="red"/></constructor-arg>
<!--secondRectangleColorGenerator-->
<constructor-arg index="9"><ref bean="white"/></constructor-arg>
<!--firstRectangleColorGenerator-->
<constructor-arg index="10"><value>3</value></constructor-arg>
</bean>

<bean id="backGenPicture"
class="com.octo.captcha.component.image.backgroundgenerator.FileReaderRandomBackgroundGenerator"
>
<constructor-arg index="0"><value>300</value></constructor-arg>
<constructor-arg index="1"><value>100</value></constructor-arg>
<constructor-arg index="2"><ref bean="path"/></constructor-arg>
</bean>

<bean id="path" class="java.lang.String" >


<constructor-arg><value>\home\jcaptcha\conf\gimpybackgrounds</value></constructor-arg>
</bean>




(-     )   1$  ' H $  ) 


 )  
1(- ?$    

<bean id="sphere" class="com.jhlabs.image.SphereFilter" >


<property name="refractionIndex"><value>1</value></property>
</bean>

<bean id="emboss" class="com.jhlabs.image.EmbossFilter" >


<property name="bumpHeight"><value>1.0</value></property>
</bean>

<bean id="rippleBack" class="com.jhlabs.image.RippleFilter" >


<property name="waveType"><value>3</value></property>
<property name="XAmplitude"><value>10</value></property>
<property name="YAmplitude"><value>3</value></property>
<property name="XWavelength"><value>20</value></property>
<property name="YWavelength"><value>10</value></property>
<property name="edgeAction"><value>1</value></property>
</bean>

<bean id="smear" class="com.jhlabs.image.SmearFilter" >


<property name="shape"><value>0</value></property>
<property name="distance"><value>15</value></property>
<property name="density"><value>0.4</value></property>
<property name="scatter"><value>0.5</value></property>
<property name="angle"><value>0.0</value></property>
<property name="mix"><value>0.6</value></property>
<property name="fadeout"><value>0</value></property>
</bean>

<bean id="ripple" class="com.jhlabs.image.RippleFilter" >


<property name="waveType"><value>1</value></property>
<property name="XAmplitude"><value>2</value></property>
<property name="YAmplitude"><value>2</value></property>
<property name="XWavelength"><value>10</value></property>
<property name="YWavelength"><value>10</value></property>
<property name="edgeAction"><value>1</value></property>
</bean>

<bean id="ripple2" class="com.jhlabs.image.RippleFilter" >


<property name="waveType"><value>2</value></property>
<property name="XAmplitude"><value>2</value></property>
<property name="YAmplitude"><value>2</value></property>
<property name="XWavelength"><value>10</value></property>

Document generated by Confluence on mars 27, 2007 00:53 Page 39


<property name="YWavelength"><value>10</value></property>
<property name="edgeAction"><value>1</value></property>
</bean>

<bean id="ripple3" class="com.jhlabs.image.RippleFilter" >


<property name="waveType"><value>5</value></property>
<property name="XAmplitude"><value>5</value></property>
<property name="YAmplitude"><value>5</value></property>
<property name="XWavelength"><value>10</value></property>
<property name="YWavelength"><value>10</value></property>
<property name="edgeAction"><value>1</value></property>
</bean>

<bean id="twirl" class="com.jhlabs.image.TwirlFilter" >


<property name="angle"><value>0.8</value></property>
</bean>

<bean id="water" class="com.jhlabs.image.WaterFilter" >


<property name="amplitude"><value>2</value></property>
<property name="antialias"><value>true</value></property>
<property name="wavelength"><value>20</value></property>
</bean>

<bean id="weaves" class="com.jhlabs.image.WeaveFilter" >


<property name="useImageColors"><value>true</value></property>
<property name="XGap"><value>2</value></property>
<property name="XWidth"><value>10</value></property>
<property name="YWidth"><value>16</value></property>
<property name="YGap"><value>6</value></property>
</bean>

<bean id="crystal" class="com.jhlabs.image.CrystalizeFilter" >


<property name="scale"><value>0.5</value></property>
<property name="gridType"><value>1</value></property>
<property name="fadeEdges"><value>false</value></property>
<property name="edgeThickness"><value>0.4</value></property>
<property name="randomness"><value>1.0</value></property>
</bean>

<bean id="smearDef"
class="com.octo.captcha.component.image.deformation.ImageDeformationByFilters" >
<constructor-arg index="0">
<list>
<ref bean="smear"/>
</list>
</constructor-arg>
</bean>

<bean id="rippleDef"
class="com.octo.captcha.component.image.deformation.ImageDeformationByFilters" >
<constructor-arg index="0">
<list>
<ref bean="ripple"/>
</list>
</constructor-arg>
</bean>

<bean id="ripple2Def"
class="com.octo.captcha.component.image.deformation.ImageDeformationByFilters" >
<constructor-arg index="0">
<list>
<ref bean="ripple2"/>
</list>
</constructor-arg>
</bean>

<bean id="ripple3Def"
class="com.octo.captcha.component.image.deformation.ImageDeformationByFilters" >
<constructor-arg index="0">
<list>
<ref bean="ripple3"/>
</list>
</constructor-arg>
</bean>

Document generated by Confluence on mars 27, 2007 00:53 Page 40


<bean id="sphereDef"
class="com.octo.captcha.component.image.deformation.ImageDeformationByFilters" >
<constructor-arg index="0">
<list>
<ref bean="sphere"/>
</list>
</constructor-arg>
</bean>

<bean id="waterDef"
class="com.octo.captcha.component.image.deformation.ImageDeformationByFilters" >
<constructor-arg index="0">
<list>
<ref bean="water"/>
</list>
</constructor-arg>
</bean>

<bean id="embossDef"
class="com.octo.captcha.component.image.deformation.ImageDeformationByFilters" >
<constructor-arg index="0">
<list>
<ref bean="emboss"/>
</list>
</constructor-arg>
</bean>

<bean id="rippleDefBack"
class="com.octo.captcha.component.image.deformation.ImageDeformationByFilters" >
<constructor-arg index="0">
<list>
<ref bean="rippleBack"/>
</list>
</constructor-arg>
</bean>

<bean id="cristalDef"
class="com.octo.captcha.component.image.deformation.ImageDeformationByFilters" >
<constructor-arg index="0">
<list>
<ref bean="crystal"/>
</list>
</constructor-arg>
</bean>

<bean id="weavesDef"
class="com.octo.captcha.component.image.deformation.ImageDeformationByFilters" >
<constructor-arg index="0">
<list>
<ref bean="weaves"/>
</list>
</constructor-arg>
</bean>

<bean id="twirlDef"
class="com.octo.captcha.component.image.deformation.ImageDeformationByFilters" >
<constructor-arg index="0">
<list>
<ref bean="twirl"/>
</list>
</constructor-arg>
</bean>

<bean id="none"
class="com.octo.captcha.component.image.deformation.ImageDeformationByFilters" >
<constructor-arg index="0">
<null/>
</constructor-arg>
</bean>

.   2


Document generated by Confluence on mars 27, 2007 00:53 Page 41


5
  -     ))  -  -  D
5 -  - 1 $ 
5  )  - 1 + ) 1 / 

!
.  " /  2


<?xml version="1.0" encoding="UTF-8"?>


<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>

<!-- ************ FACTORIES declaration ************-->

<!-- Constructs a captcha factory which produce captcha,


from a word generator (the content) and a word to image (the
representation)-->

<bean id="imageCaptchaFactory"
class="com.octo.captcha.image.gimpy.GimpyFactory" >
<constructor-arg><ref bean="wordgen"/></constructor-arg>
<constructor-arg><ref bean="wordtoimage"/></constructor-arg>
</bean>

<!-- ************ WORD 2 IMAGE declaration ************-->

<!-- Constructs a WordToImage, which assemble components: a font generator,


a background generator, a paster and deformations:
the fist one deform the background only (none is the "null"
deformation, which does nothing)
the second one deform the text only (none is the "null" deformation,
which does nothing)
the third one deform the hole picture
-->
<bean id="wordtoimage"
class="com.octo.captcha.component.image.wordtoimage.ComposedWordToImage" >
<constructor-arg index="0"><ref
bean="fontGenRandom"/></constructor-arg>
<constructor-arg index="1"><ref bean="backGenUni"/></constructor-arg>
<constructor-arg index="2"><ref
bean="simpleColoredPaster"/></constructor-arg>
<!-- <constructor-arg index="3"><ref bean="none"/></constructor-arg>-->
<!-- <constructor-arg index="4"><ref bean="none"/></constructor-arg>-->
<!-- <constructor-arg index="5"><ref
bean="ripple3Def"/></constructor-arg>-->
</bean>

<!-- ************ BACKGROUND declaration ************-->

<!-- Constructs a background generator,


this one is the default Unicolor, white is background color -->
<bean id="backGenUni"
class="com.octo.captcha.component.image.backgroundgenerator.UniColorBackgroundGenerator" >
<constructor-arg
index="0"><value>300</value></constructor-arg>
<constructor-arg
index="1"><value>100</value></constructor-arg>
</bean>

<!-- ************ FONT declaration ************-->

<bean id="fontArial" class="java.awt.Font" >


<constructor-arg index="0"><value>Arial</value></constructor-arg>
<constructor-arg index="1"><value>0</value></constructor-arg>
<constructor-arg index="2"><value>10</value></constructor-arg>
</bean>

<bean id="fontTahoma" class="java.awt.Font" >

Document generated by Confluence on mars 27, 2007 00:53 Page 42


<constructor-arg index="0"><value>Tahoma</value></constructor-arg>
<constructor-arg index="1"><value>0</value></constructor-arg>
<constructor-arg index="2"><value>10</value></constructor-arg>
</bean>

<bean id="fontVerdana" class="java.awt.Font" >


<constructor-arg index="0"><value>Verdana</value></constructor-arg>
<constructor-arg index="1"><value>0</value></constructor-arg>
<constructor-arg index="2"><value>10</value></constructor-arg>
</bean>

<bean id="fontComic" class="java.awt.Font" >


<constructor-arg index="0"><value>Comic sans
MS</value></constructor-arg>
<constructor-arg index="1"><value>0</value></constructor-arg>
<constructor-arg index="2"><value>10</value></constructor-arg>
</bean>

<bean id="fontLucida" class="java.awt.Font" >


<constructor-arg index="0"><value>Lucida
console</value></constructor-arg>
<constructor-arg index="1"><value>0</value></constructor-arg>
<constructor-arg index="2"><value>10</value></constructor-arg>
</bean>
<!-- ************ FONT GENERATOR declaration ************-->

<!-- Constructs Font generator, with the min and max size of font,
and with a list of fonts-->
<bean id="fontGenRandom"
class="com.octo.captcha.component.image.fontgenerator.RandomFontGenerator" >
<constructor-arg
index="0"><value>40</value></constructor-arg>
<constructor-arg
index="1"><value>50</value></constructor-arg>
<constructor-arg index="2">
<list>
<ref bean="fontArial"/>
<ref
bean="fontTahoma"/>
<ref
bean="fontVerdana"/>
<ref bean="fontComic"/>
<ref
bean="fontLucida"/>
</list>
</constructor-arg>
</bean>

<!-- ************ PASTER declaration ************-->

<!-- Constructs the paster component, a baffle one, which make holes in
characters
Parameters :
int for the min length of the word
int for the max length of the word
ColorGenerator for the color of the word
boolean to know if each character can have a different color
-->
<bean id="simpleColoredPaster"
class="com.octo.captcha.component.image.textpaster.RandomTextPaster" >
<constructor-arg type="java.lang.Integer"
index="0"><value>4</value></constructor-arg>
<constructor-arg type="java.lang.Integer"
index="1"><value>6</value></constructor-arg>
<constructor-arg
type="com.octo.captcha.component.image.color.ColorGenerator" index="2"><ref
bean="colorGenRandomDark"/></constructor-arg>
<constructor-arg
index="3"><value>true</value></constructor-arg>
</bean>

<!-- ************ DIC and WORD GENERATOR declaration ************-->

<!-- Constructs a File diconnary, which will read words from a file,
corresponding to Locle (for instance with locale France,
it will look for the file : toddlist_fr_FR.properties, if not found,
take toddlist.properties -->

Document generated by Confluence on mars 27, 2007 00:53 Page 43


<bean id="filedict"
class="com.octo.captcha.component.wordgenerator.FileDictionnary" >
<constructor-arg index="0"><value>toddlist</value></constructor-arg>
</bean>

<!-- <bean id="wordgen"


class="com.octo.captcha.component.wordgenerator.DictionaryWordGenerator" >
<constructor-arg><ref bean="filedict"/></constructor-arg>
</bean>-->

<!-- Constructs a word generator, which composed words from existing words
It takes a diconnary for the existing words-->
<bean id="wordgen"
class="com.octo.captcha.component.wordgenerator.ComposeDictionaryWordGenerator" >
<constructor-arg><ref bean="filedict"/></constructor-arg>
</bean>

<!-- ************ FILTER declaration ************-->

<!-- Constructs the "null" deformation component-->


<bean id="none"
class="com.octo.captcha.component.image.deformation.ImageDeformationByFilters" >
<constructor-arg index="0">
<null/>
</constructor-arg>
</bean>

<!-- ************ COLORS Declarations ************-->

<!-- Constructs a java Color-->


<bean id="white" class="java.awt.Color" >
<constructor-arg type="int"
index="0"><value>255</value></constructor-arg>
<constructor-arg type="int"
index="1"><value>255</value></constructor-arg>
<constructor-arg type="int"
index="2"><value>255</value></constructor-arg>
</bean>

<!-- Constructs a color generator which generate one color -->


<bean id="colorGenWhite"
class="com.octo.captcha.component.image.color.SingleColorGenerator" >
<constructor-arg index="0"><ref bean="white"/></constructor-arg>
</bean>

<!-- Constructs a color generator which generate dark color correspond to the
different ranges-->
<bean id="colorGenRandomDark"
class="com.octo.captcha.component.image.color.RandomRangeColorGenerator" >
<constructor-arg index="0">
<list>
<value>0</value>
<value>150</value>
</list>
</constructor-arg>
<constructor-arg index="1">
<list>
<value>0</value>
<value>150</value>
</list>
</constructor-arg>
<constructor-arg index="2">
<list>
<value>0</value>
<value>150</value>
</list>
</constructor-arg>
<constructor-arg index="3">
<list>
<value>255</value>
<value>255</value>
</list>
</constructor-arg>
</bean>

Document generated by Confluence on mars 27, 2007 00:53 Page 44


</beans>

!
.  " 0% 2


<?xml version="1.0" encoding="UTF-8"?>


<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>

<!-- Constructs a captcha engine, with custom factories-->


<bean
class="com.octo.captcha.engine.GenericCaptchaEngine" id="imageEngine">
<constructor-arg index="0">
<list>
<ref bean="imageCaptchaFactory"/>
</list>
</constructor-arg>
</bean>

<bean id="imageCaptchaService"
class="com.octo.captcha.service.multitype.GenericManageableCaptchaService">
<constructor-arg index="0">
<ref bean="imageEngine"/>
</constructor-arg>
<constructor-arg index="1"><value>300</value></constructor-arg>
<constructor-arg index="2"><value>200000</value></constructor-arg>
</bean>
</beans>

Document generated by Confluence on mars 27, 2007 00:53 Page 45


integrate JCAPTCHA and the J2EE security model

5   )   "   

*"  . 2  "&  .  ()*+


&" "    (:  


%           %) 0 D /         
) D8  %,56%3)      )  - ++ K    

5     )        %,56%     )) ++    ) 

4   -  &%:!   )        %,56%        
 )      ' -  )  H&)        

5     '   %,56% 5    )         D
-  )   )     ) )      - -    

Document generated by Confluence on mars 27, 2007 00:53 Page 46


JCaptcha and the SpringFramework

5   ) 


  #" J  )

! 

          1 -         -    -
       4    )  /  $'       - 14 )
  ;&H )  
/        -
    ) )  ;&H )   )  /  %
    
   )         /    

;<   .  

5   -      )   -    /   *

<bean class="com.octo.captcha.service.image.DefaultManageableImageCaptchaService"
id="imageCaptchaService"/>

= -     7   -  E )  )-      

0.  " 
%   .
.    0.

1      )            -  +

K            + -      )  ' )


 *               ) -  )  
5    -      ;&H        -    

5   + 3 -)        -      
:  +         -   -  -    B B )  -
 !

<bean class="com.octo.captcha.engine.GenericCaptchaEngine" id="imageEngine">


<constructor-arg index="0">
<list>
<ref bean="imageCaptchaFactory"/>
</list>
</constructor-arg>
</bean>

5   $  )D

Document generated by Confluence on mars 27, 2007 00:53 Page 47


9 % )       *  )
9 % )51       -  * 

<bean id="CaptchaFactory" class="com.octo.captcha.image.gimpy.GimpyFactory" >


<constructor-arg><ref bean="wordgen"/></constructor-arg>
<constructor-arg><ref bean="wordtoimage"/></constructor-arg>
</bean>

% K):     *   )    )        ' )


-    )  '        *   ) -    1  * 
 K):  )  (     ) -

<bean id="wordgen" class=


"com.octo.captcha.component.wordgenerator.ComposeDictionaryWordGenerator" >
<constructor-arg><ref bean="filedict"/></constructor-arg>
</bean>

% (  ) )   ) ) - )'

<bean id="filedict" class="com.octo.captcha.component.wordgenerator.FileDictionnary" >


<constructor-arg index="0"><value>toddlist</value></constructor-arg>
</bean>

%-             -    K)51          )


       D

9 % -  
9 %  ')  
9 % 5*  

5 *       * W  '           
)-       -   %             
)-     ) +*     *  - )- 

<bean id="wordtoimage"
class="com.octo.captcha.component.image.wordtoimage.DeformedComposedWordToImage" >
<constructor-arg index="0"><ref bean="fontGenRandom"/></constructor-arg>
<constructor-arg index="1"><ref bean="backGenUni"/></constructor-arg>
<constructor-arg index="2"><ref bean="simpleWhitePaster"/></constructor-arg>
<constructor-arg index="3"><ref bean="none"/></constructor-arg>
<constructor-arg index="4"><ref bean="none"/></constructor-arg>
<constructor-arg index="5"><ref bean="none"/></constructor-arg>
</bean>

% $ :  ) $    K)51 )--  -     )--   -  '
-       5    ) -  -    )  - 
     7 )  * 7 -  - 

<bean id="fontGenRandom"
class="com.octo.captcha.component.image.fontgenerator.RandomFontGenerator" >
<constructor-arg index="0"><value>40</value></constructor-arg>
<constructor-arg index="1"><value>50</value></constructor-arg>
<constructor-arg index="2">
<list>

Document generated by Confluence on mars 27, 2007 00:53 Page 48


<ref bean="fontArial"/>
<ref bean="fontTahoma"/>
<ref bean="fontVerdana"/>
<ref bean="fontComic"/>
<ref bean="fontLucida"/>
</list>
</constructor-arg>
</bean>

% -  ) ) '  D

<bean id="fontArial" class="java.awt.Font" >


<constructor-arg index="0"><value>Arial</value></constructor-arg>
<constructor-arg index="1"><value>0</value></constructor-arg>
<constructor-arg index="2"><value>10</value></constructor-arg>
</bean>

5 ? ' :         '   *       
 *       -    )   5 -        7
   )  ! -    

<bean id="backGenUni"
class="com.octo.captcha.component.image.backgroundgenerator.UniColorBackgroundGenerator" >
<constructor-arg index="0"><value>300</value></constructor-arg>
<constructor-arg index="1"><value>100</value></constructor-arg>
</bean>

5 5* ,   )       *    ') 5   )    
  *   !               )    
) !   )   *  '     -) 5* ,     )  )
     )  *      5* (    )) -    
%* -  *     - 5* ,  D
" &   -  *
 &*   -  *
# %           *    %*
L % ?     -      )   )--    !      -  
* - !

<bean id="simpleWhitePaster"
class="com.octo.captcha.component.image.textpaster.SimpleTextPaster" >
<constructor-arg type="java.lang.Integer"
index="0"><value>4</value></constructor-arg>
<constructor-arg type="java.lang.Integer"
index="1"><value>6</value></constructor-arg>
<constructor-arg type="com.octo.captcha.component.image.color.ColorGenerator"
index="2"><ref bean="colorGenRandomDark"/></constructor-arg>
<constructor-arg index="3"><value>true</value></constructor-arg>
</bean>

=   )      /    

0. "   " 0%   0.

5                             )


       % -       ) -)  /    

Document generated by Confluence on mars 27, 2007 00:53 Page 49


 )        '   +      ?--)+ 
  -  +

<bean id="imageCaptchaService"
class="com.octo.captcha.service.multitype.GenericManageableCaptchaService">
<constructor-arg index="0">
<ref bean="imageContainer"/>
</constructor-arg>
<constructor-arg index="1"><value>180</value></constructor-arg>
<constructor-arg index="2"><value>180000</value></constructor-arg>
</bean>

Document generated by Confluence on mars 27, 2007 00:53 Page 50


JRoller installation

5   )    J  

! 

5 )       )             0 


1 8  0  K  2+0/14= >> 

5    )))   # /  

9 /  " D ,@ 
9 /   D   ) - 
     
9 /  # D   0   - 

)=  

1       >>            / 0      )
   

!   " >  " 9  .

9   
 
   K+?31=$<  ) -    3 D
 3 3ZXQ

9 %))  -    ) -     - - 

<plug-in className="com.octo.captcha.module.struts.CaptchaServicePlugin"/>

9 5E              @)   )  )   ) 


)    %))  -    )   D

<action
path="/jcaptcha"
type="com.octo.captcha.module.struts.image.RenderImageCaptchaAction"
/>

5 E  
A     -         3 ) )   
  
 )  
A  )  
  F

" . " 9 

 .  

0  )   %      -            


5       )     
     -     * -  D

Document generated by Confluence on mars 27, 2007 00:53 Page 51


<!--
UnComment authenticator to be used.
-->
<context-param>
<param-name>org.roller.commentAuthenticatorClass</param-name>
<param-value>com.octo.captcha.module.roller.JCaptchaCommentAuthenticator</param-value>
<!--
<param-value>org.roller.presentation.velocity.DefaultCommentAuthenticator</param-value>
<param-value>org.roller.presentation.velocity.MathCommentAuthenticator</param-value>
-->
</context-param>

Document generated by Confluence on mars 27, 2007 00:53 Page 52


Struts integration

5   )   "   

0  &" & 

  3 )7

! 

5 )       )             /   ) K


         /   ) 
1 8    3 )     ) )    /   )          
  37

5    )))   /  

9 /  " D ,@ 
9 /   D   ) - 
     
9 /  # D 1) -     37)  - 
9 /  L D /   ) -)        
9 /  D &)-    

)=  

1     3 )         -  ++  


 )      * ))     -        )  ) 
1  
     

9   
 
   K+?31=$<  ) -    3 ) 3 D

 3 3Z

9   
  )  
   K+?31=$<  ) -    3 ) 3 D
  3"

9 %))  -   )     ) -     - - 

<plug-in className="com.octo.captcha.module.struts.CaptchaServicePlugin"/>

 E              @)   )  )   ) 


)   !

! "  4  " <?  . &

Document generated by Confluence on mars 27, 2007 00:53 Page 53


K    37      -   )  )      
5  -     -        3 )   3 -3  * 
 ) )FF! -  D

...

<!-- ========== Form Bean Definitions =================================== -->


<form-beans>

<!-- Registration form bean -->


<form-bean name="RegistrationForm"
type="org.apache.struts.webapp.example.RegistrationForm"/>

</form-beans>

<!-- ========== Global Forward Definitions ============================== -->


<global-forwards>
<forward name="Registration" path="/Registration.jsp"/>
</global-forwards>

<!-- ========== Action Mapping Definitions ============================== -->


<action-mappings>

<!-- Matches all edit actions (in this case, only user regstration) -->
<action path="/Edit*"
type="org.apache.struts.webapp.example.Edit{1}Action"
name="{1}Form"
scope="request"
validate="false">
<forward name="success" path="/{1}.jsp"/>
</action>

<!-- Matches all save actions (in this case, only user registration) -->
<action path="/Save*"
type="org.apache.struts.webapp.example.Save{1}Action"
name="{1}Form"
scope="request"
input="{1}"/>

</action-mappings>

...

0" 

/     ) *        /0  )!   )  


 
  -     -    E E  
1 )  )    

9        )


 0     *    E E  
9     E E     )  *   
    )   
9 $  ))  )       )       )

5 - -   '  -  D

<!-- Matches all edit actions (in this case, only user regstration) -->
<action path="/Edit*"
type="org.apache.struts.webapp.example.Edit{1}Action"
name="{1}Form"
scope="request"
validate="false">

Document generated by Confluence on mars 27, 2007 00:53 Page 54


<forward name="success" path="/{1}.jsp"/>
</action>

<!-- Transform the wildCardAction to use the jcaptcha validation routine-->

<action
path="/SaveRegistration"
type="com.octo.captcha.module.struts.VerifyCaptchaChallengeAction"
name="RegistrationForm"
scope="request"
input="Registration"
validate="false"
>
<forward name="success" path="/jcaptchaRegistration.do"/>

</action>

<!-- Add the real action -->

<action
path="/jcaptchaRegistration"
type="org.apache.struts.webapp.example.SaveRegistrationAction"
name="RegistrationForm"
scope="request"
input="Registration"
>

</action>

<!-- add the render action-->


<action
path="/jcaptcha"
type="com.octo.captcha.module.struts.image.RenderImageCaptchaAction"
>

</action>

 "   > 

9 )) 
    )  
9 )) 
 D   ))  - ) 
9 )) 
 D@    ))  @ 
9 )) 
  *   -
9 )) 
   

<%@ page contentType="text/html;charset=UTF-8" language="java" %>


<%@ taglib uri="/tags/app" prefix="app" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>

<%-- Add the jcaptcha taglib--%>


<%@ taglib uri="jcaptcha" prefix="jcaptcha"%>

<logic:equal name="RegistrationForm" property="action"


scope="request" value="Edit">
<app:checkLogon/>
</logic:equal>

<html:html>
<head>
<logic:equal name="RegistrationForm" property="action"
scope="request" value="Create">

Document generated by Confluence on mars 27, 2007 00:53 Page 55


<title><bean:message key="registration.title.create"/></title>
</logic:equal>
<logic:equal name="RegistrationForm" property="action"
scope="request" value="Edit">
<title><bean:message key="registration.title.edit"/></title>
</logic:equal>
<html:base/>
</head>
<body bgcolor="white">

<html:errors/>

<%-- Add the message tag--%>


<jcaptcha:message/>

<html:form action="/SaveRegistration" focus="username"


onsubmit="return validateRegistrationForm(this);">
<html:hidden property="action"/>
<table border="0" width="100%">

<%-- Add the jcaptcha form part--%>

<tr>
<th align="right">
<jcaptcha:question/>:
</th>
<td align="left">

<%-- Add the image--%>

<img src="jcaptcha.do"/>
<br/>
<%-- Add the input tag--%>

<input type="text" name="jcaptcha_response" />

</td>
</tr>

<tr>
<th align="right">
<bean:message key="prompt.username"/>:
</th>
<td align="left">
<logic:equal name="RegistrationForm" property="action"
scope="request" value="Create">
<html:text property="username" size="16" maxlength="16"/>
</logic:equal>
<logic:equal name="RegistrationForm" property="action"
scope="request" value="Edit">
<%--
<bean:write name="RegistrationForm" property="username"
scope="request" filter="true"/>
--%>
<html:hidden property="username" write="true"/>
</logic:equal>
</td>
</tr>
...

9
-  4    

%      ) D

9 K )))        ) '  )        - 


9 5      '   )       D   )     )

Document generated by Confluence on mars 27, 2007 00:53 Page 56


 ) ) 
9     
 )        )) D K       
  -  2-  % 
9 %      )  -  -      37) D ? -    
 -    37       -    37
   - 
9 8      -    @ 

Comments

6

1E) '       /       1  - )    )    ' -

6 1E) '        )-  1   1        
 U 3 =OR    )    / , R<V )  

1  )    D
R E              @)   )  )   ) 
)   !R

1 E  ))  -)  )  ) )        

 )    B

5'

 [   

, )  
 "#  


  D  D<<   ) <


<<$KS3"L

, )   
     


?   -              D

"!        ' D

package mypackage;
import com.octo.captcha.engine.image.gimpy.SimpleListImageCaptchaEngine;

import com.octo.captcha.service.image.EhcacheManageableImageCaptchaService;

import com.octo.captcha.service.image.ImageCaptchaService;

public class MyOwnManageableImageCaptchaService extends EhcacheManageableImageCaptchaService

implements ImageCaptchaService {

public MyOwnManageableImageCaptchaService() {
super(new SimpleListImageCaptchaEngine(), 180, 100000);

Document generated by Confluence on mars 27, 2007 00:53 Page 57


}}

)    )   / H 1 +   1 '  !  
  

!    3 -*          / ,  ' D

<plug-in className="com.octo.captcha.module.struts.CaptchaServicePlugin">
<set-property property="serviceClass"
value="mypackage.MyOwnManageableImageCaptchaService" />
</plug-in>

, ) 
  
  # J


6
1E   )   
U
 D@  <V ) U
 D <V
    )  
1         1   
1 )E -)    )  
1 -)  ' -  R@ R E     : E   -  EE
6  1 )       )- B
1E  /   1       ) 
U 3 =OR    )    / , R<V
B
' -   
 

, )  J J  \ #" J




Document generated by Confluence on mars 27, 2007 00:53 Page 58


Use cases

5   )    #   

+
  

5      %,56% )       )  


6    )        )      '         
 

!

1)   -       -)     ) - '        )   
/ -       ) -)   D

9     ) )  )   )


9     )           -  @ )  

+*  - ) - )   ) )     ) D

9  < )  '


9   )       
9 ) )  ' ) )  )   
9  -    ) )   -)     -      %!

& -       ) )    )  

+


6  -               -) )       )   
/        

9          -        

5      )  -)      

9         D   5     ) )       )   
9      D  R- - ) R             

&   )        '      

+*  -      )   )     ) D

9    )  )-) *     

Document generated by Confluence on mars 27, 2007 00:53 Page 59


9       @   
9     7  #(    (  #(  

   . ()*+3 "



 %

4             '  & - "    
               7 

9  .  

  &   "




5    ))             )    -   
 

9   
5        KKK  )  -   -    
5       ' -                    
  )   -    -  ' -      ! /    *  
       D  D<<<  <
9 H 
5       - %,56%  *  &   )         ) 
       )    )        

  &   "


    

5   '       )  D     '         -
-    )   -  
+*  D     '   -     -  '       
5 ') -  - %,56%  )       *     3   !

9  . &

5         ) - *    


 -  )

5         !        

,   < )        D      -        '
-  )    '

Document generated by Confluence on mars 27, 2007 00:53 Page 60

You might also like