qbit/consul-client/src/main/java/io/advantageous/consul/endpoints/KeyValueStoreEndpoint.java
public boolean putValue(final String key, final String value, final long flags, final KeyValuePutOptions putOptions) {
        Integer cas = putOptions.getCas();
        String release = putOptions.getRelease();
        String acquire = putOptions.getAcquire();


        final URI uri = createURI("/" + key);
        final HttpRequestBuilder httpRequestBuilder = RequestUtils
                .getHttpRequestBuilder(null, null, RequestOptions.BLANK, "");


//        httpRequestBuilder.addParam("recurse", "true");


        if (cas != null) {
            httpRequestBuilder.addParam("cas", cas.toString());
        }

        if (!Str.isEmpty(release)) {
            httpRequestBuilder.addParam("release", release);
        }

        if (!Str.isEmpty(acquire)) {
            httpRequestBuilder.addParam("acquire", acquire);
        }

        if (flags != 0) {
            httpRequestBuilder.addParam("flags", String.valueOf(flags));
        }


        httpRequestBuilder.setBody(value);
        httpRequestBuilder.setMethodPut();

        final HTTP.Response httpResponse = HTTP.jsonRestCallViaPUT(uri.toString() + "?" + httpRequestBuilder.paramString(),
                value);

        if (httpResponse.code() == 200) {
            return Boolean.parseBoolean(httpResponse.body());
        } else {
            die("Unable to put value", uri, putOptions, httpResponse.code(), httpResponse.body());
            return false;
        }

    }
public boolean putValue(final String key, final String value, final long flags, final KeyValuePutOptions putOptions) {
        Integer cas = putOptions.getCas();
        String release = putOptions.getRelease();
        String acquire = putOptions.getAcquire();


        final URI uri = createURI("/" + key);
        final HttpRequestBuilder httpRequestBuilder = RequestUtils
                .getHttpRequestBuilder(null, null, RequestOptions.BLANK, "");


//        httpRequestBuilder.addParam("recurse", "true");


        if (cas != null) {
            httpRequestBuilder.addParam("cas", cas.toString());
        }

        if (!Str.isEmpty(release)) {
            httpRequestBuilder.addParam("release", release);
        }

        if (!Str.isEmpty(acquire)) {
            httpRequestBuilder.addParam("acquire", acquire);
        }

        if (flags != 0) {
            httpRequestBuilder.addParam("flags", String.valueOf(flags));
        }


        httpRequestBuilder.setBody(value);
        httpRequestBuilder.setMethodPut();

        final HTTP.Response httpResponse = HTTP.jsonRestCallViaPUT(uri.toString() + "?" + httpRequestBuilder.paramString(),
                value);

        if (httpResponse.code() == 200) {
            return Boolean.parseBoolean(httpResponse.body());
        } else {
            die("Unable to put value", uri, putOptions, httpResponse.code(), httpResponse.body());
            return false;
        }

    }
public boolean putValue ( final String key , final String value , final long flags , final KeyValuePutOptions putOptions ) { Integer cas = putOptions . getCas ( ) ; String release = putOptions . getRelease ( ) ; String acquire = putOptions . getAcquire ( ) ; final URI uri = createURI ( "/" + key ) ; final HttpRequestBuilder httpRequestBuilder = RequestUtils . getHttpRequestBuilder ( null , null , RequestOptions . BLANK , "" ) ; //        httpRequestBuilder.addParam("recurse", "true"); if ( cas != null ) { httpRequestBuilder . addParam ( "cas" , cas . toString ( ) ) ; } if ( ! Str . isEmpty ( release ) ) { httpRequestBuilder . addParam ( "release" , release ) ; } if ( ! Str . isEmpty ( acquire ) ) { httpRequestBuilder . addParam ( "acquire" , acquire ) ; } if ( flags != 0 ) { httpRequestBuilder . addParam ( "flags" , String . valueOf ( flags ) ) ; } httpRequestBuilder . setBody ( value ) ; httpRequestBuilder . setMethodPut ( ) ; final HTTP . Response httpResponse = HTTP . jsonRestCallViaPUT ( uri . toString ( ) + "?" + httpRequestBuilder . paramString ( ) , value ) ; if ( httpResponse . code ( ) == 200 ) { return Boolean . parseBoolean ( httpResponse . body ( ) ) ; } else { die ( "Unable to put value" , uri , putOptions , httpResponse . code ( ) , httpResponse . body ( ) ) ; return false ; } }
Puts a value into the key/value store.

@param key        The key to use as index.
@param value      The value to index.
@param putOptions PUT options (e.g. wait, acquire).
@param flags      flags
@return <code>true</code> if the value was successfully indexed.
Puts a value into the key / value store .