Package org.nuxeo.common.utils
Class RFC2231
- java.lang.Object
- 
- org.nuxeo.common.utils.RFC2231
 
- 
 public class RFC2231 extends Object RFC-2231 specifies how a MIME parameter value, likeContent-Disposition'sfilename, can be encoded to contain arbitrary character sets.- Author:
- Florent Guillaume
 
- 
- 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static StringencodeContentDisposition(String filename, boolean inline, String userAgent)Encodes aContent-Dispositionheader.protected static voidencodeRFC2231(StringBuilder sb, String value)Encodes a MIME parameter per RFC 2231.static voidpercentEscape(StringBuilder sb, String value)Does a simple %-escaping of the UTF-8 bytes of the value.
 
- 
- 
- 
Method Detail- 
percentEscapepublic static void percentEscape(StringBuilder sb, String value) Does a simple %-escaping of the UTF-8 bytes of the value. Keep only some know safe characters.- Parameters:
- sb- the builder to which escaped chars are appended
- value- the value to escape
 
 - 
encodeRFC2231protected static void encodeRFC2231(StringBuilder sb, String value) Encodes a MIME parameter per RFC 2231.This implementation always uses UTF-8 and no language. - Parameters:
- sb- the buffer to fill
- value- the value to encode
 
 - 
encodeContentDispositionpublic static String encodeContentDisposition(String filename, boolean inline, String userAgent) Encodes aContent-Dispositionheader. For some user agents the full RFC-2231 encoding won't be performed as they don't understand it.- Parameters:
- filename- the filename
- inline-- truefor an inline disposition,- falsefor an attachment
- userAgent- the userAgent
- Returns:
- a full string to set as value of a Content-Dispositionheader
 
 
- 
 
-