Examples of addBoxJSONStringEntityPart()


Examples of com.box.boxjavalibv2.httpentities.MultipartEntityWithProgressListener.addBoxJSONStringEntityPart()

    // In order to handle foreign characters, the file name is handled in metadata part instead of the InputStreamBody part.
    private static MultipartEntityWithProgressListener getNewFileMultipartEntity(final String parentId, final InputStream inputStream, final String fileName)
        throws BoxRestException, UnsupportedEncodingException, BoxJSONException {
        MultipartEntityWithProgressListener me = new MultipartEntityWithProgressListener(HttpMultipartMode.BROWSER_COMPATIBLE);
        me.addContentBodyPart(Constants.PARENT_ID, new StringBody(parentId));
        me.addBoxJSONStringEntityPart(METADATA, getMetadataBody(parentId, fileName));

        // The contents of the file should come after the part that specifies the parent folder id, so
        // that Box's infrastructure can efficiently stream the file to its final destination based on
        // the parent folder.
        me.addContentBodyPart(KEY_FILE_NAME, new InputStreamBody(inputStream, PLACEHOLDER_FILENAME));
View Full Code Here

Examples of com.box.boxjavalibv2.httpentities.MultipartEntityWithProgressListener.addBoxJSONStringEntityPart()

    // In order to handle foreign characters, the file name is handled in metadata part instead of the FileBody part.
    private static MultipartEntityWithProgressListener getNewFileMultipartEntity(final String parentId, final String name, final File file)
        throws BoxRestException, UnsupportedEncodingException, BoxJSONException {
        MultipartEntityWithProgressListener me = new MultipartEntityWithProgressListener(HttpMultipartMode.BROWSER_COMPATIBLE);
        me.addContentBodyPart(Constants.PARENT_ID, new StringBody(parentId));
        me.addBoxJSONStringEntityPart(METADATA, getMetadataBody(parentId, name));
        if (me.getContentBodyPart(KEY_CONTENT_MODIFIED_AT) == null) {
            String date = ISO8601DateParser.toString(new Date(file.lastModified()));
            me.addContentBodyPart(KEY_CONTENT_MODIFIED_AT, new StringBody(date));
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.