Class CaptchaImageResource
- java.lang.Object
-
- org.apache.wicket.request.resource.AbstractResource
-
- org.apache.wicket.request.resource.DynamicImageResource
-
- org.apache.wicket.extensions.markup.html.captcha.CaptchaImageResource
-
- All Implemented Interfaces:
Serializable,org.apache.wicket.request.resource.IResource,org.apache.wicket.util.io.IClusterable
public class CaptchaImageResource extends org.apache.wicket.request.resource.DynamicImageResource
Generates a captcha image.- Author:
- Joshua Perlow
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.wicket.request.resource.AbstractResource
org.apache.wicket.request.resource.AbstractResource.ContentRangeType, org.apache.wicket.request.resource.AbstractResource.ResourceResponse, org.apache.wicket.request.resource.AbstractResource.WriteCallback
-
-
Constructor Summary
Constructors Constructor Description CaptchaImageResource()Construct.CaptchaImageResource(String challengeId)Construct.CaptchaImageResource(String challengeId, int fontSize, int margin)Construct.CaptchaImageResource(org.apache.wicket.model.IModel<String> challengeId)Construct.CaptchaImageResource(org.apache.wicket.model.IModel<String> challengeId, int fontSize, int margin)Construct.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetChallengeId()Gets the id for the challenge.org.apache.wicket.model.IModel<String>getChallengeIdModel()Gets the id for the challengeprotected byte[]getImageData(org.apache.wicket.request.resource.IResource.Attributes attributes)voidinvalidate()Causes the image to be redrawn the next time its requested.protected RandomnewRandomNumberGenerator()protected byte[]render()Renders this image-
Methods inherited from class org.apache.wicket.request.resource.DynamicImageResource
configureResponse, getFormat, newResourceResponse, setFormat, setLastModifiedTime, toImageData
-
-
-
-
Constructor Detail
-
CaptchaImageResource
public CaptchaImageResource()
Construct.
-
CaptchaImageResource
public CaptchaImageResource(String challengeId)
Construct.- Parameters:
challengeId- The id of the challenge
-
CaptchaImageResource
public CaptchaImageResource(org.apache.wicket.model.IModel<String> challengeId)
Construct.- Parameters:
challengeId- The id of the challenge
-
CaptchaImageResource
public CaptchaImageResource(org.apache.wicket.model.IModel<String> challengeId, int fontSize, int margin)
Construct.- Parameters:
challengeId- The id of the challengefontSize- The font sizemargin- The image's margin
-
CaptchaImageResource
public CaptchaImageResource(String challengeId, int fontSize, int margin)
Construct.- Parameters:
challengeId- The id of the challengefontSize- The font sizemargin- The image's margin
-
-
Method Detail
-
newRandomNumberGenerator
protected Random newRandomNumberGenerator()
-
getChallengeId
public final String getChallengeId()
Gets the id for the challenge.- Returns:
- The id for the challenge
-
getChallengeIdModel
public final org.apache.wicket.model.IModel<String> getChallengeIdModel()
Gets the id for the challenge- Returns:
- The id for the challenge
-
invalidate
public final void invalidate()
Causes the image to be redrawn the next time its requested.
-
getImageData
protected final byte[] getImageData(org.apache.wicket.request.resource.IResource.Attributes attributes)
- Specified by:
getImageDatain classorg.apache.wicket.request.resource.DynamicImageResource
-
render
protected byte[] render()
Renders this image- Returns:
- The image data
-
-