List of usage examples for org.springframework.web.util UriComponentsBuilder queryParam
@Override
public UriComponentsBuilder queryParam(String name, @Nullable Collection<?> values)
From source file:com.orange.ngsi2.client.Ngsi2Client.java
private void addParam(UriComponentsBuilder builder, String key, Collection<? extends CharSequence> value) { if (!nullOrEmpty(value)) { builder.queryParam(key, String.join(",", value)); }// w w w. jav a 2 s .c o m }
From source file:org.zalando.boot.etcd.EtcdClient.java
public EtcdResponse deleteDir(String key) throws EtcdException { UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(KEYSPACE); builder.pathSegment(key);//from w w w . j a v a 2s . c o m builder.queryParam("dir", "true"); return execute(builder, HttpMethod.DELETE, null, EtcdResponse.class); }
From source file:org.zalando.boot.etcd.EtcdClient.java
public EtcdResponse deleteDir(String key, boolean recursive) throws EtcdException { UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(KEYSPACE); builder.pathSegment(key);/*w ww . j a v a 2 s.co m*/ builder.queryParam("recursive", recursive); return execute(builder, HttpMethod.DELETE, null, EtcdResponse.class); }
From source file:org.zalando.boot.etcd.EtcdClient.java
/** * Returns the node with the given key from etcd. * /*from www . j av a 2 s. c o m*/ * @param key * the node's key * @param recursive * <code>true</code> if child nodes should be returned, * <code>false</code> otherwise * @return the response from etcd with the node * @throws EtcdException * in case etcd returned an error */ public EtcdResponse get(String key, boolean recursive) throws EtcdException { UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(KEYSPACE); builder.pathSegment(key); builder.queryParam("recursive", recursive); return execute(builder, HttpMethod.GET, null, EtcdResponse.class); }
From source file:org.zalando.boot.etcd.EtcdClient.java
/** * Atomically deletes a key-value pair in etcd. * /*from www. j a v a 2 s . c o m*/ * @param key * the key * @param prevIndex * the modified index of the key * @return the response from etcd with the node * @throws EtcdException * in case etcd returned an error */ public EtcdResponse compareAndDelete(final String key, int prevIndex) throws EtcdException { UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(KEYSPACE); builder.pathSegment(key); builder.queryParam("prevIndex", prevIndex); return execute(builder, HttpMethod.DELETE, null, EtcdResponse.class); }
From source file:org.zalando.boot.etcd.EtcdClient.java
/** * Atomically deletes a key-value pair in etcd. * /*from w w w . j a va 2 s. c om*/ * @param key * the key * @param prevValue * the previous value of the key * @return the response from etcd with the node * @throws EtcdException * in case etcd returned an error */ public EtcdResponse compareAndDelete(final String key, String prevValue) throws EtcdException { UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(KEYSPACE); builder.pathSegment(key); builder.queryParam("prevValue", prevValue); return execute(builder, HttpMethod.DELETE, null, EtcdResponse.class); }
From source file:org.zalando.boot.etcd.EtcdClient.java
/** * Sets the value of the node with the given key in etcd. * /*from w ww . jav a 2 s .c o m*/ * @param key * the node's key * @param value * the node's value * @param ttl * the node's time-to-live or <code>-1</code> to unset existing * ttl * @return the response from etcd with the node * @throws EtcdException * in case etcd returned an error */ public EtcdResponse put(String key, String value, int ttl) throws EtcdException { UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(KEYSPACE); builder.pathSegment(key); builder.queryParam("ttl", ttl == -1 ? "" : ttl); MultiValueMap<String, String> payload = new LinkedMultiValueMap<>(1); payload.set("value", value); return execute(builder, HttpMethod.PUT, payload, EtcdResponse.class); }
From source file:org.zalando.boot.etcd.EtcdClient.java
/** * Atomically updates a key-value pair in etcd. * //from w ww. j av a 2 s . c o m * @param key * the key * @param value * the value * @param prevIndex * the modified index of the key * @return the response from etcd with the node * @throws EtcdException * in case etcd returned an error */ public EtcdResponse compareAndSwap(String key, String value, int prevIndex) throws EtcdException { UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(KEYSPACE); builder.pathSegment(key); builder.queryParam("prevIndex", prevIndex); MultiValueMap<String, String> payload = new LinkedMultiValueMap<>(1); payload.set("value", value); return execute(builder, HttpMethod.PUT, payload, EtcdResponse.class); }
From source file:org.zalando.boot.etcd.EtcdClient.java
/** * Atomically updates a key-value pair in etcd. * /* w w w .j a va 2 s . c om*/ * @param key * the key * @param value * the value * @param prevValue * the previous value of the key * @return the response from etcd with the node * @throws EtcdException * in case etcd returned an error */ public EtcdResponse compareAndSwap(String key, String value, String prevValue) throws EtcdException { UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(KEYSPACE); builder.pathSegment(key); builder.queryParam("prevValue", prevValue); MultiValueMap<String, String> payload = new LinkedMultiValueMap<>(1); payload.set("value", value); return execute(builder, HttpMethod.PUT, payload, EtcdResponse.class); }
From source file:org.zalando.boot.etcd.EtcdClient.java
/** * Atomically creates or updates a key-value pair in etcd. * /* ww w . j a v a2 s.co m*/ * @param key * the key * @param value * the value * @param prevExist * <code>true</code> if the existing node should be updated, * <code>false</code> of the node should be created * @return the response from etcd with the node * @throws EtcdException * in case etcd returned an error */ public EtcdResponse compareAndSwap(final String key, final String value, boolean prevExist) throws EtcdException { UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(KEYSPACE); builder.pathSegment(key); builder.queryParam("prevExist", prevExist); MultiValueMap<String, String> payload = new LinkedMultiValueMap<>(1); payload.set("value", value); return execute(builder, HttpMethod.PUT, payload, EtcdResponse.class); }