Here you can find the source of getContentType(String boundary)
java.net.URLConnection
which includes the multipart boundary string.
Parameter | Description |
---|---|
boundary | the boundary string |
public static String getContentType(String boundary)
//package com.java2s; public class Main { /**/*from w w w.j ava 2 s . c o m*/ * Gets the content type string suitable for the * <code>java.net.URLConnection</code> which includes the multipart * boundary string. <br /> * <br /> * This method is static because, due to the nature of the * <code>java.net.URLConnection</code> class, once the output stream * for the connection is acquired, it's too late to set the content * type (or any other request parameter). So one has to create a * multipart boundary string first before using this class, such as * with the <code>createBoundary()</code> method. * * @param boundary the boundary string * @return the content type string * @see #createBoundary() */ public static String getContentType(String boundary) { return "multipart/form-data; boundary=" + boundary; } }