Examples of BoxRestException


Examples of com.box.restclientv2.exceptions.BoxRestException

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

        InputStream in = null;
        try {
            in = httpResponse.getEntity().getContent();
            if (in == null) {
                return null;
            }
            else {
                return parseInputStream(in);
            }
        }
        catch (Exception e) {
            throw new BoxRestException(e, "Failed to parse response.");
        }
        finally {
            IOUtils.closeQuietly(in);
        }
    }
View Full Code Here

Examples of com.box.restclientv2.exceptions.BoxRestException

    public static final String AUTH_HEADER_NAME = "Authorization";

    @Override
    public void setAuth(final IBoxRequest request) throws BoxRestException, AuthFatalFailureException {
        if (!(request instanceof DefaultBoxRequest)) {
            throw new BoxRestException("class does not match, expected:" + DefaultBoxRequest.class.getCanonicalName() + ";current:"
                                       + request.getClass().getCanonicalName());
        }
    }
View Full Code Here

Examples of com.box.restclientv2.exceptions.BoxRestException

        }
        try {
            return new StringEntity(en.toJSONString(parser), CharEncoding.UTF_8);
        }
        catch (UnsupportedEncodingException e) {
            throw new BoxRestException(e);
        }
    }
View Full Code Here

Examples of com.box.restclientv2.exceptions.BoxRestException

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

Examples of com.box.restclientv2.exceptions.BoxRestException

    private void handleException(final Exception e, final int sequenceId) throws BoxRestException {
        for (IBoxRestVisitor v : visitors) {
            v.visitException(e, sequenceId);
        }
        throw new BoxRestException(e);
    }
View Full Code Here

Examples of com.box.restclientv2.exceptions.BoxRestException

        auth.refresh();
        HttpEntity entity = boxRequest.getRequestEntity();
        if (entity == null || entity.isRepeatable()) {
            return execute(boxRequest, true);
        }
        throw new BoxRestException(ENTITY_CANNOT_BE_RETRIED);
    }
View Full Code Here

Examples of com.box.restclientv2.exceptions.BoxRestException

     */
    protected void doRefresh() throws AuthFatalFailureException {
        internalSetTokenState(OAuthTokenState.REFRESHING);

        if (mOAuthToken == null) {
            setRefreshFail(new BoxRestException("OAuthToken is null"));
            throw new AuthFatalFailureException(getRefreshFailException());
        }

        String refreshToken = mOAuthToken.getRefreshToken();
        try {
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.