Examples of BoxRestException


Examples of com.box.restclientv2.exceptions.BoxRestException

            if (expectedClass.isInstance(obj)) {
                return obj;
            }
            else {
                if (obj == null) {
                    throw new BoxRestException("Invalid class, expected:" + expectedClass.getCanonicalName());
                }
                throw new BoxRestException("Invalid class, expected:" + expectedClass.getCanonicalName() + ";current:" + obj.getClass().getCanonicalName());
            }
        }
    }
View Full Code Here

Examples of com.box.restclientv2.exceptions.BoxRestException

        BoxJSONException {
        try {
            BoxFileUploadRequestObject requestObject = new BoxFileUploadRequestObject();
            return requestObject.setMultipartMIME(getNewFileMultipartEntity(parentId, fileName, file));
        } catch (UnsupportedEncodingException e) {
            throw new BoxRestException(e);
        }
    }
View Full Code Here

Examples of com.box.restclientv2.exceptions.BoxRestException

    public static BoxFileUploadRequestObject uploadFileRequestObject(final String parentId, final String fileName, final InputStream inputStream)
        throws BoxRestException, BoxJSONException {
        try {
            return (new BoxFileUploadRequestObject()).setMultipartMIME(getNewFileMultipartEntity(parentId, inputStream, fileName));
        } catch (UnsupportedEncodingException e) {
            throw new BoxRestException(e);
        }
    }
View Full Code Here

Examples of com.box.restclientv2.exceptions.BoxRestException

     */
    public static BoxFileUploadRequestObject uploadNewVersionRequestObject(final String name, final File file) throws BoxRestException {
        try {
            return (new BoxFileUploadRequestObject()).setMultipartMIME(getNewVersionMultipartEntity(name, file));
        } catch (UnsupportedEncodingException e) {
            throw new BoxRestException(e);
        }
    }
View Full Code Here

Examples of com.box.restclientv2.exceptions.BoxRestException

     */
    public static BoxFileUploadRequestObject uploadNewVersionRequestObject(final String name, final InputStream inputStream) throws BoxRestException {
        try {
            return (new BoxFileUploadRequestObject()).setMultipartMIME(getNewVersionMultipartEntity(name, inputStream));
        } catch (UnsupportedEncodingException e) {
            throw new BoxRestException(e);
        }
    }
View Full Code Here

Examples of com.box.restclientv2.exceptions.BoxRestException

    }

    @Override
    public Object parse(IBoxResponse response) throws BoxRestException {
        if (!(response instanceof DefaultBoxResponse)) {
            throw new BoxRestException("class mismatch, expected:" + DefaultBoxResponse.class.getName() + ";current:" + response.getClass().getName());
        }

        HttpResponse httpResponse = ((DefaultBoxResponse) response).getHttpResponse();
        if (httpResponse == null) {
            return null;
View Full Code Here

Examples of com.box.restclientv2.exceptions.BoxRestException

        if (requestObject != null) {
            try {
                setEntity(requestObject.getEntity(parser));
            } catch (BoxJSONException e) {
                throw new BoxRestException(e, "Cannot parse entity of the request object.");
            } catch (UnsupportedEncodingException e) {
                throw new BoxRestException(e, "UnsupportedEncodingException in the request object.");
            }

            BoxRequestExtras mutator = requestObject.getRequestExtras();
            setRequestFields(mutator.getFields());
            getQueryParams().putAll(mutator.getQueryParams());
View Full Code Here

Examples of com.box.restclientv2.exceptions.BoxRestException

                ub.addParameter(entry.getKey(), StringUtils.defaultIfEmpty(entry.getValue(), ""));
            }

            rawRequest.setURI(ub.build());
        } catch (URISyntaxException e) {
            throw new BoxRestException("URISyntaxException:" + e.getMessage());
        }

        if (getAuth() != null) {
            getAuth().setAuth(this);
        }
View Full Code Here

Examples of com.box.restclientv2.exceptions.BoxRestException

            case DELETE:
                return new HttpDelete();
            case OPTIONS:
                return new HttpOptions();
            default:
                throw new BoxRestException("Method Not Implemented");
        }
    }
View Full Code Here

Examples of com.box.restclientv2.exceptions.BoxRestException

public class DefaultFileResponseParser implements IBoxResponseParser {

    @Override
    public Object parse(IBoxResponse response) throws BoxRestException {
        if (!(response instanceof DefaultBoxResponse)) {
            throw new BoxRestException("class mismatch, expected:" + DefaultBoxResponse.class.getName() + ";current:" + response.getClass().getCanonicalName());
        }
        HttpResponse httpResponse = ((DefaultBoxResponse) response).getHttpResponse();
        try {
            return httpResponse.getEntity().getContent();
        }
        catch (Exception e) {
            throw new BoxRestException(e, "Failed to parse response.");
        }
    }
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.