Nuxeo Enterprise Platform 5.4

org.nuxeo.common.utils
Class RFC2231

java.lang.Object
  extended by org.nuxeo.common.utils.RFC2231

public class RFC2231
extends java.lang.Object

RFC-2231 specifies how a MIME parameter value, like Content-Disposition's filename, can be encoded to contain arbitrary character sets.

Author:
Florent Guillaume

Method Summary
static java.lang.String encodeContentDisposition(java.lang.String filename, boolean inline, java.lang.String userAgent)
          Encodes a Content-Disposition header.
static void percentEscape(java.lang.StringBuilder buf, java.lang.String value)
          Does a simple %-escaping of the UTF-8 bytes of the value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

percentEscape

public static void percentEscape(java.lang.StringBuilder buf,
                                 java.lang.String value)
Does a simple %-escaping of the UTF-8 bytes of the value. Keep only some know safe characters.

Parameters:
buf - the buffer to which escaped chars are appended
value - the value to escape

encodeContentDisposition

public static java.lang.String encodeContentDisposition(java.lang.String filename,
                                                        boolean inline,
                                                        java.lang.String userAgent)
Encodes a Content-Disposition header. For some user agents the full RFC-2231 encoding won't be performed as they don't understand it.

Parameters:
filename - the filename
inline - true for an inline disposition, false for an attachment
userAgent - the userAgent
Returns:
a full string to set as value of a Content-Disposition header

Nuxeo Enterprise Platform 5.4

Copyright © 2010 Nuxeo SAS. All Rights Reserved.