Package com.box.restclientv2

Examples of com.box.restclientv2.BoxBasicRestClient


                            }
                            preview.setLastPage(lPage);
                        }
                    }
                    catch (NumberFormatException e) {
                        throw new BoxRestException(e);
                    }
                }
            }
        }
    }
View Full Code Here


    }

    @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());
        }

        int statusCode = ((DefaultBoxResponse) response).getHttpResponse().getStatusLine().getStatusCode();
        BoxServerError error = null;
        if (isErrorResponse(statusCode)) {
View Full Code Here

    public HttpEntity getEntity() throws BoxRestException {
        try {
            return new StringEntity(getJSONEntity().toJSONString(objectMapper), CharEncoding.UTF_8);
        }
        catch (Exception e) {
            throw new BoxRestException(e);
        }
    }
View Full Code Here

        try {
            return new UrlEncodedFormEntity(pairs, CharEncoding.UTF_8);
        }
        catch (UnsupportedEncodingException e) {
            throw new BoxRestException(e);
        }
    }
View Full Code Here

        try {
            response = getRawHttpClient().execute(httpRequest);
        }
        catch (IOException e) {
            throw new BoxRestException(e);
        }
        DefaultBoxResponse boxResponse = new DefaultBoxResponse(response);
        boxResponse.setExpectedResponseCode(boxRequest.getExpectedResponseCode());
        return boxResponse;
    }
View Full Code Here

                            }
                            preview.setLastPage(lPage);
                        }
                    }
                    catch (NumberFormatException e) {
                        throw new BoxRestException(e);
                    }
                }
            }
        }
    }
View Full Code Here

            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

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

    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

     */
    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

TOP

Related Classes of com.box.restclientv2.BoxBasicRestClient

Copyright © 2018 www.massapicom. 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.