Example usage for org.springframework.web.util UriComponentsBuilder pathSegment

List of usage examples for org.springframework.web.util UriComponentsBuilder pathSegment

Introduction

In this page you can find the example usage for org.springframework.web.util UriComponentsBuilder pathSegment.

Prototype

@Override
public UriComponentsBuilder pathSegment(String... pathSegments) throws IllegalArgumentException 

Source Link

Document

Append path segments to the existing path.

Usage

From source file:org.zalando.boot.etcd.EtcdClient.java

/**
 * Atomically updates a key-value pair in etcd.
 * //  w  w w  .j  a  v a2  s  .  c o  m
 * @param key
 *            the key
 * @param value
 *            the value
 * @param ttl
 *            the time-to-live
 * @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, int ttl, String prevValue) throws EtcdException {
    UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(KEYSPACE);
    builder.pathSegment(key);
    builder.queryParam("ttl", ttl == -1 ? "" : ttl);
    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.
 * //w  w w.ja  v a2s . com
 * @param key
 *            the key
 * @param value
 *            the value
 * @param ttl
 *            the time-to-live
 * @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, int ttl, boolean prevExist)
        throws EtcdException {
    UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(KEYSPACE);
    builder.pathSegment(key);
    builder.queryParam("ttl", ttl == -1 ? "" : ttl);
    builder.queryParam("prevExist", prevExist);

    MultiValueMap<String, String> payload = new LinkedMultiValueMap<>(1);
    payload.set("value", value);

    return execute(builder, HttpMethod.PUT, payload, EtcdResponse.class);
}

From source file:org.haiku.haikudepotserver.dataobjects.Architecture.java

UriComponentsBuilder appendPathSegments(UriComponentsBuilder builder) {
    return builder.pathSegment(getCode());
}

From source file:org.haiku.haikudepotserver.dataobjects.Pkg.java

public UriComponentsBuilder appendPathSegments(UriComponentsBuilder builder) {
    return builder.pathSegment(getName());
}