public class CaptchaImageResource extends DynamicImageResource
AbstractResource.ContentRangeType, AbstractResource.ResourceResponse, AbstractResource.WriteCallback
IResource.Attributes
CONTENT_DISPOSITION_HEADER_NAME, CONTENT_RANGE_ENDBYTE, CONTENT_RANGE_STARTBYTE, INTERNAL_HEADERS
Constructor and Description |
---|
CaptchaImageResource()
Construct.
|
CaptchaImageResource(IModel<String> challengeId)
Construct.
|
CaptchaImageResource(IModel<String> challengeId,
int fontSize,
int margin)
Construct.
|
CaptchaImageResource(String challengeId)
Construct.
|
CaptchaImageResource(String challengeId,
int fontSize,
int margin)
Construct.
|
Modifier and Type | Method and Description |
---|---|
String |
getChallengeId()
Gets the id for the challenge.
|
IModel<String> |
getChallengeIdModel()
Gets the id for the challenge
|
protected byte[] |
getImageData(IResource.Attributes attributes)
Get image data for our dynamic image resource.
|
void |
invalidate()
Causes the image to be redrawn the next time its requested.
|
protected Random |
newRandomNumberGenerator() |
protected byte[] |
render()
Renders this image
|
configureResponse, getFormat, newResourceResponse, setFormat, setLastModifiedTime, toImageData
configureCache, getCachingStrategy, respond, setRequestMetaData, setRequestRangeMetaData, setResponseContentRangeHeaderFields, setResponseHeaders
public CaptchaImageResource()
public CaptchaImageResource(String challengeId)
challengeId
- The id of the challengepublic CaptchaImageResource(IModel<String> challengeId)
challengeId
- The id of the challengepublic CaptchaImageResource(IModel<String> challengeId, int fontSize, int margin)
challengeId
- The id of the challengefontSize
- The font sizemargin
- The image's marginpublic CaptchaImageResource(String challengeId, int fontSize, int margin)
challengeId
- The id of the challengefontSize
- The font sizemargin
- The image's marginprotected Random newRandomNumberGenerator()
public final String getChallengeId()
public final IModel<String> getChallengeIdModel()
public final void invalidate()
protected final byte[] getImageData(IResource.Attributes attributes)
DynamicImageResource
DynamicImageResource.setLastModifiedTime(Time)
when it does so. This
ensures that image caching works correctly.getImageData
in class DynamicImageResource
attributes
- the context bringing the request, response and the parametersnull
means there is no image and 404
(Not found) response will be return.protected byte[] render()
Copyright © 2006–2022 Apache Software Foundation. All rights reserved.