merge with branch issue-697

This commit is contained in:
Sebastian Sdorra
2015-05-17 12:28:54 +02:00
2 changed files with 26 additions and 7 deletions

View File

@@ -73,18 +73,18 @@ public final class HttpUtil
/** Field description */ /** Field description */
public static final String ENCODING = "UTF-8"; public static final String ENCODING = "UTF-8";
/**
* location header
* @since 1.43
*/
public static final String HEADER_LOCATION = "Location";
/** /**
* content-length header * content-length header
* @since 1.46 * @since 1.46
*/ */
public static final String HEADER_CONTENT_LENGTH = "Content-Length"; public static final String HEADER_CONTENT_LENGTH = "Content-Length";
/**
* location header
* @since 1.43
*/
public static final String HEADER_LOCATION = "Location";
/** /**
* header for identifying the scm-manager client * header for identifying the scm-manager client
* @since 1.19 * @since 1.19
@@ -296,6 +296,25 @@ public final class HttpUtil
} }
} }
/**
* Creates the value for the content-disposition attachment header. The method
* creates the filename as specified in rfc6266.
*
* @param name attachment name
* @see <a href="http://tools.ietf.org/html/rfc6266#section-5">rfc6266 section 5</a>
* @return value of content-disposition header
* @since 1.46
*/
public static String createContentDispositionAttachmentHeader(String name)
{
StringBuilder buffer = new StringBuilder("attachment; ");
buffer.append("filename=\"").append(name).append("\"; ");
buffer.append("filename*=utf-8''").append(encode(name));
return buffer.toString();
}
/** /**
* Method description * Method description
* *

View File

@@ -1141,7 +1141,7 @@ public class RepositoryResource
*/ */
private String getContentDispositionName(String name) private String getContentDispositionName(String name)
{ {
return "attachment; filename=\"".concat(name).concat("\""); return HttpUtil.createContentDispositionAttachmentHeader(name);
} }
/** /**