| java.lang.Object net.matuschek.http.DownloadRuleSet
DownloadRuleSet | public class DownloadRuleSet (Code) | | This download selector decides if a file should be downloaded
based on the mime type and the size of the content (content-length
header)
author: Daniel Matuschek daniel@matuschek.net version: $Id: DownloadRuleSet.java,v 1.5 2003/02/27 18:46:58 oliver_schmidt Exp $ |
Method Summary | |
public void | addRule(String mimeBaseType, String mimeSubtype, int minSize, int maxSize, boolean allow) adds a download rule for the given mimetype/subtype
Parameters: mimeType - basic mime type (the part before /) Parameters: mimeSubtype - mime sub type (part after /) Parameters: minSize - minimal size (in bytes) Parameters: maxSize - maximal size (in bytes) Parameters: allow - allow or deny this download ?wildchar "*" can be used as mimeType and mimeSubtype that means"all". | public boolean | downloadAllowed(Vector httpHeaders) | public boolean | getDefault() | public Vector | getDownloadRules() Get the value of downloadRules. | protected String | getHeaderValue(Vector httpHeaders, String name) gets the value of a httpHeader from a vector of httpHeaders
Parameters: httpHeaders - a Vector of HttpHeader objects Parameters: name - name of the header (e.g. | public void | loadRuleFile(String filename) | public boolean | processAllowed(Vector httpHeaders) | public void | setDefault(boolean allow) | public void | setDownloadRules(Vector<DownloadRule> downloadRules) Set the value of downloadRules.
Parameters: v - Value to assign to downloadRules. | public String | toString() converts the object to a String represenation. |
defaultBehavior | protected boolean defaultBehavior(Code) | | default behavior, if no rule matches (allow or deny)
true = allow, false = deny *
|
DownloadRuleSet | public DownloadRuleSet()(Code) | | initializes the DownloadRuleSet with an empty rule set
if no other rules will be added, it will allow all downloads
|
addRule | public void addRule(String mimeBaseType, String mimeSubtype, int minSize, int maxSize, boolean allow)(Code) | | adds a download rule for the given mimetype/subtype
Parameters: mimeType - basic mime type (the part before /) Parameters: mimeSubtype - mime sub type (part after /) Parameters: minSize - minimal size (in bytes) Parameters: maxSize - maximal size (in bytes) Parameters: allow - allow or deny this download ?wildchar "*" can be used as mimeType and mimeSubtype that means"all". there will be no pattern matching, that means "*" matchesall types, but "t*" doesn't match all types that start with t |
downloadAllowed | public boolean downloadAllowed(Vector httpHeaders)(Code) | | |
getDefault | public boolean getDefault()(Code) | | gets the default behaviour
|
getDownloadRules | public Vector getDownloadRules()(Code) | | Get the value of downloadRules.
Value of downloadRules as a Vector fo DownloadRule objects. |
getHeaderValue | protected String getHeaderValue(Vector httpHeaders, String name)(Code) | | gets the value of a httpHeader from a vector of httpHeaders
Parameters: httpHeaders - a Vector of HttpHeader objects Parameters: name - name of the header (e.g. content-length) not case-sensitive the value of this header or null if this header doesn'texists |
loadRuleFile | public void loadRuleFile(String filename) throws IOException(Code) | | adds a set of rules that are defined in a rule file
a rule file consists of lines in the format
allow|deny mimetype/subtype yyyyy
|
processAllowed | public boolean processAllowed(Vector httpHeaders)(Code) | | |
setDefault | public void setDefault(boolean allow)(Code) | | sets the default behavior
Parameters: allow - allow or deny download if no matching rule was found |
setDownloadRules | public void setDownloadRules(Vector<DownloadRule> downloadRules)(Code) | | Set the value of downloadRules.
Parameters: v - Value to assign to downloadRules. Must be a vectorof DownloadRule objects |
toString | public String toString()(Code) | | converts the object to a String represenation. the format may
change without notice. Use it only for debugging and logging.
|
|
|