001package com.box.sdk; 002 003import java.net.URL; 004import okhttp3.MediaType; 005 006/** 007 * Used to make HTTP multipart requests to the Box API. 008 * 009 * <p>This class partially implements the HTTP multipart standard in order to upload files to Box. 010 * The body of this request type cannot be set directly. Instead, it can be modified by adding 011 * multipart fields and setting file contents. The body of multipart requests will not be logged 012 * since they are likely to contain binary data. 013 */ 014public class BoxMultipartRequest extends AbstractBoxMultipartRequest { 015 016 /** 017 * Constructs an authenticated BoxMultipartRequest using a provided BoxAPIConnection. 018 * 019 * @param api an API connection for authenticating the request. 020 * @param url the URL of the request. 021 */ 022 public BoxMultipartRequest(BoxAPIConnection api, URL url) { 023 super(api, url); 024 } 025 026 @Override 027 protected String getPartName() { 028 return "file"; 029 } 030 031 @Override 032 protected MediaType getPartContentType(String filename) { 033 return MediaType.parse("application/octet-stream"); 034 } 035}