|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.mailet.base.GenericMatcher org.apache.james.transport.matchers.AttachmentFileNameIs
public class AttachmentFileNameIs
Checks if at least one attachment has a file name which matches any element of a comma-separated or space-separated list of file name masks.
Syntax: match="AttachmentFileNameIs=[-d] [-z] masks"
The match is case insensitive.
File name masks may start with a wildcard '*'.
Multiple file name masks can be specified, e.g.: '*.scr,*.bat'.
If '-d
' is coded, some debug info will be logged.
If '-z
' is coded, the check will be non-recursively applied
to the contents of any attached '*.zip' file.
Field Summary | |
---|---|
protected static java.lang.String |
DEBUG_REQUEST_PARAMETER
Debug request parameter. |
protected boolean |
isDebug
Controls certain log messages. |
protected static java.lang.String |
UNZIP_REQUEST_PARAMETER
Unzip request parameter. |
protected boolean |
unzipIsRequested
True if unzip is requested. |
protected static java.lang.String |
ZIP_SUFFIX
Match string for zip files. |
Constructor Summary | |
---|---|
AttachmentFileNameIs()
|
Method Summary | |
---|---|
protected java.lang.String |
cleanFileName(java.lang.String fileName)
Transforms fileName in a trimmed lowercase string usable for matching agains the masks. |
void |
init()
|
java.util.Collection |
match(Mail mail)
Either every recipient is matching or neither of them. |
protected boolean |
matchFound(javax.mail.Part part)
Checks if part matches with at least one of the masks . |
protected boolean |
matchFound(java.lang.String fileName)
Checks if fileName matches with at least one of the masks . |
protected boolean |
matchFoundInZip(javax.mail.Part part)
Checks if part is a zip containing a file that matches with at least one of the masks . |
Methods inherited from class org.apache.mailet.base.GenericMatcher |
---|
destroy, getCondition, getMailetContext, getMatcherConfig, getMatcherInfo, getMatcherName, init, log, log |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String UNZIP_REQUEST_PARAMETER
protected static final java.lang.String DEBUG_REQUEST_PARAMETER
protected static final java.lang.String ZIP_SUFFIX
protected boolean isDebug
protected boolean unzipIsRequested
Constructor Detail |
---|
public AttachmentFileNameIs()
Method Detail |
---|
public void init() throws javax.mail.MessagingException
init
in class GenericMatcher
javax.mail.MessagingException
GenericMatcher
public java.util.Collection match(Mail mail) throws javax.mail.MessagingException
match
in interface Matcher
match
in class GenericMatcher
javax.mail.MessagingException
- if no matching attachment is found and at least one exception was thrownprotected boolean matchFound(javax.mail.Part part) throws java.lang.Exception
masks
.
java.lang.Exception
protected boolean matchFound(java.lang.String fileName)
masks
.
protected boolean matchFoundInZip(javax.mail.Part part) throws javax.mail.MessagingException, java.io.IOException
masks
.
javax.mail.MessagingException
java.io.IOException
protected java.lang.String cleanFileName(java.lang.String fileName)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |