Package org.eclipse.jetty.client

Examples of org.eclipse.jetty.client.ContentExchange


                    fieldsValue.append(',');
                }
            }
            params = fieldsValue.toString();
        }
        ContentExchange get = getContentExchange(HttpMethods.GET, sobjectsUrl(sObjectName + "/" + id + params));
        // requires authorization token
        setAccessToken(get);

        doHttpRequest(get, new DelegatingClientCallback(callback));
    }
View Full Code Here


    @Override
    public void createSObject(String sObjectName, InputStream sObject,
                              ResponseCallback callback) {
        // post the sObject
        final ContentExchange post = getContentExchange(HttpMethods.POST, sobjectsUrl(sObjectName));

        // authorization
        setAccessToken(post);

        // input stream as entity content
        post.setRequestContentSource(sObject);
        post.setRequestContentType(PayloadFormat.JSON.equals(format) ? APPLICATION_JSON_UTF8 : APPLICATION_XML_UTF8);

        doHttpRequest(post, new DelegatingClientCallback(callback));
    }
View Full Code Here

    }

    @Override
    public void updateSObject(String sObjectName, String id, InputStream sObject,
                              ResponseCallback callback) {
        final ContentExchange patch = getContentExchange("PATCH", sobjectsUrl(sObjectName + "/" + id));
        // requires authorization token
        setAccessToken(patch);

        // input stream as entity content
        patch.setRequestContentSource(sObject);
        patch.setRequestContentType(PayloadFormat.JSON.equals(format) ? APPLICATION_JSON_UTF8 : APPLICATION_XML_UTF8);

        doHttpRequest(patch, new DelegatingClientCallback(callback));
    }
View Full Code Here

    }

    @Override
    public void deleteSObject(String sObjectName, String id,
                              ResponseCallback callback) {
        final ContentExchange delete = getContentExchange(HttpMethods.DELETE, sobjectsUrl(sObjectName + "/" + id));

        // requires authorization token
        setAccessToken(delete);

        doHttpRequest(delete, new DelegatingClientCallback(callback));
View Full Code Here

    }

    @Override
    public void getSObjectWithId(String sObjectName, String fieldName, String fieldValue,
                                 ResponseCallback callback) {
        final ContentExchange get = getContentExchange(HttpMethods.GET,
                sobjectsExternalIdUrl(sObjectName, fieldName, fieldValue));

        // requires authorization token
        setAccessToken(get);
View Full Code Here

    }

    @Override
    public void upsertSObject(String sObjectName, String fieldName, String fieldValue, InputStream sObject,
                              ResponseCallback callback) {
        final ContentExchange patch = getContentExchange("PATCH",
                sobjectsExternalIdUrl(sObjectName, fieldName, fieldValue));

        // requires authorization token
        setAccessToken(patch);

        // input stream as entity content
        patch.setRequestContentSource(sObject);
        // TODO will the encoding always be UTF-8??
        patch.setRequestContentType(PayloadFormat.JSON.equals(format) ? APPLICATION_JSON_UTF8 : APPLICATION_XML_UTF8);

        doHttpRequest(patch, new DelegatingClientCallback(callback));
    }
View Full Code Here

    }

    @Override
    public void deleteSObjectWithId(String sObjectName, String fieldName, String fieldValue,
                                    ResponseCallback callback) {
        final ContentExchange delete = getContentExchange(HttpMethods.DELETE,
                sobjectsExternalIdUrl(sObjectName, fieldName, fieldValue));

        // requires authorization token
        setAccessToken(delete);
View Full Code Here

        doHttpRequest(delete, new DelegatingClientCallback(callback));
    }

    @Override
    public void getBlobField(String sObjectName, String id, String blobFieldName, ResponseCallback callback) {
        final ContentExchange get = getContentExchange(HttpMethods.GET,
                sobjectsUrl(sObjectName + "/" + id + "/" + blobFieldName));
        // TODO this doesn't seem to be required, the response is always the content binary stream
        //get.setRequestHeader(HttpHeaders.ACCEPT_ENCODING, "base64");

        // requires authorization token
View Full Code Here

        try {

            String encodedQuery = URLEncoder.encode(soqlQuery, StringUtil.__UTF8_CHARSET.toString());
            // URLEncoder likes to use '+' for spaces
            encodedQuery = encodedQuery.replace("+", "%20");
            final ContentExchange get = getContentExchange(HttpMethods.GET, versionUrl() + "query/?q=" + encodedQuery);

            // requires authorization token
            setAccessToken(get);

            doHttpRequest(get, new DelegatingClientCallback(callback));
View Full Code Here

        }
    }

    @Override
    public void queryMore(String nextRecordsUrl, ResponseCallback callback) {
        final ContentExchange get = getContentExchange(HttpMethods.GET, instanceUrl + nextRecordsUrl);

        // requires authorization token
        setAccessToken(get);

        doHttpRequest(get, new DelegatingClientCallback(callback));
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.client.ContentExchange

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.