Package com.basho.riak.client.http.request

Examples of com.basho.riak.client.http.request.RequestMeta


     *
     * @return Same as {@link RiakClient}
     */
    public HttpResponse fetch(String bucket, String key, RequestMeta meta, boolean streamResponse) {
        if (meta == null) {
            meta = new RequestMeta();
        }
        if (meta.getQueryParam(Constants.QP_R) == null) {
            meta.setQueryParam(Constants.QP_R, Constants.DEFAULT_R.toString());
        }
        HttpGet get = new HttpGet(ClientUtils.makeURI(config, bucket, key));
View Full Code Here


    /**
     * Same as {@link RiakClient}, except only returning the HTTP response
     */
    public boolean stream(String bucket, String key, StreamHandler handler, RequestMeta meta) throws IOException {
        if (meta == null) {
            meta = new RequestMeta();
        }
        if (meta.getQueryParam(Constants.QP_R) == null) {
            meta.setQueryParam(Constants.QP_R, Constants.DEFAULT_R.toString());
        }
        HttpGet get = new HttpGet(ClientUtils.makeURI(config, bucket, key));
View Full Code Here

    /**
     * Same as {@link RiakClient}, except only returning the HTTP response
     */
    public HttpResponse delete(String bucket, String key, RequestMeta meta) {
        if (meta == null) {
            meta = new RequestMeta();
        }
        String url = ClientUtils.makeURI(config, bucket, key);
        HttpDelete delete = new HttpDelete(url);
        return executeMethod(bucket, key, delete, meta);
    }
View Full Code Here

                                      fetchMeta.getBasicQuorum(), true, fetchMeta.getReturnDeletedVClock(),
                                      fetchMeta.getIfModifiedSince(), fetchMeta.getIfModifiedVClock(),
                                      fetchMeta.getTimeout());
        }

        RequestMeta rm = convert(fetchMeta);
        FetchResponse resp = client.fetchMeta(bucket, key, rm);
        return handleBodyResponse(resp);
    }
View Full Code Here

        }

        if (key == null || key.trim().equals("")) {
            throw new IllegalArgumentException("Key cannot be null or empty or just whitespace");
        }
        RequestMeta rm = convert(fetchMeta);

        FetchResponse resp = client.fetch(bucket, key, rm);
        return handleBodyResponse(resp);
    }
View Full Code Here

            throw new IllegalArgumentException("cannot store a null RiakObject, or a RiakObject without a bucket");
        }
        RiakResponse response = RiakResponse.empty();

        com.basho.riak.client.http.RiakObject riakObject = convert(object, client);
        RequestMeta requestMeta = convert(storeMeta);
        StoreResponse resp = client.store(riakObject, requestMeta);

        if (!resp.isSuccess()) {
            if (resp.getStatusCode() == HttpStatus.SC_PRECONDITION_FAILED) {
                if (storeMeta.hasIfNoneMatch() && storeMeta.getIfNoneMatch()) {
View Full Code Here

    public HttpResponse setBucketSchema(String bucket, JSONObject schema, RequestMeta meta) {
        if (schema == null) {
            schema = new JSONObject();
        }
        if (meta == null) {
            meta = new RequestMeta();
        }

        meta.setHeader(Constants.HDR_ACCEPT, Constants.CTYPE_JSON);

        HttpPut put = new HttpPut(ClientUtils.makeURI(config, bucket));
View Full Code Here

     * Same as {@link RiakClient#getBucketSchema(String, RequestMeta)}, except
     * only returning the HTTP response.
     */
    public HttpResponse getBucketSchema(String bucket, RequestMeta meta) {
        if (meta == null) {
            meta = new RequestMeta();
        }
        if (meta.getQueryParam(Constants.QP_KEYS) == null) {
            meta.setQueryParam(Constants.QP_KEYS, Constants.NO_KEYS);
        }
        return listBucket(bucket, meta, false);
View Full Code Here

     *
     * @return an {@link HttpResponse} whose body should be the result of asking
     *         Riak to list buckets.
     */
    public HttpResponse listBuckets(boolean streamResponse) {
        final RequestMeta  meta = new RequestMeta();
        if (streamResponse) {
            meta.setQueryParam(Constants.QP_BUCKETS, Constants.STREAM_BUCKETS);
        } else {
            meta.setQueryParam(Constants.QP_BUCKETS, Constants.LIST_BUCKETS);
        }
        HttpGet get = new HttpGet(config.getUrl());
        return executeMethod(null, null, get, meta, streamResponse);
    }
View Full Code Here

     * if streamResponse==true, the response will be streamed back, so the user
     * is responsible for calling {@link BucketResponse#close()}
     */
    public HttpResponse listBucket(String bucket, RequestMeta meta, boolean streamResponse) {
        if (meta == null) {
            meta = new RequestMeta();
        }
        if (meta.getQueryParam(Constants.QP_KEYS) == null) {
            if (streamResponse) {
                meta.setQueryParam(Constants.QP_KEYS, Constants.STREAM_KEYS);
            } else {
View Full Code Here

TOP

Related Classes of com.basho.riak.client.http.request.RequestMeta

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.