Package ai.preferred.venom.validator
Class MimeTypeValidator
- java.lang.Object
-
- ai.preferred.venom.validator.MimeTypeValidator
-
- All Implemented Interfaces:
Validator
public class MimeTypeValidator extends Object implements Validator
This class determines the validity of a response by its mime type.A mime type that matches the pattern should return
Status.INVALID_CONTENT
, orStatus.VALID
otherwise.- Author:
- Maksim Tkachenko, Ween Jiann Lee
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface ai.preferred.venom.validator.Validator
Validator.Status
-
-
Field Summary
-
Fields inherited from interface ai.preferred.venom.validator.Validator
ALWAYS_VALID
-
-
Constructor Summary
Constructors Constructor Description MimeTypeValidator(String regex)
Constructs mime type validator.MimeTypeValidator(Pattern regex)
Constructs mime type validator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Validator.Status
isValid(Request request, Response response)
Method will be called when a response need validation.
-
-
-
Constructor Detail
-
MimeTypeValidator
public MimeTypeValidator(String regex)
Constructs mime type validator.- Parameters:
regex
- A regex string to match valid mime type
-
MimeTypeValidator
public MimeTypeValidator(Pattern regex)
Constructs mime type validator.- Parameters:
regex
- A regex pattern to match valid mime type
-
-
Method Detail
-
isValid
public final Validator.Status isValid(Request request, Response response)
Description copied from interface:Validator
Method will be called when a response need validation.
-
-