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

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

Introduction

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

Prototype

@Override
public UriComponentsBuilder path(String path) 

Source Link

Document

Append the given path to the existing path of this builder.

Usage

From source file:com.orange.ngsi2.client.Ngsi2Client.java

/**
 * Update the registration by registration ID
 * @param registrationId the registration ID
 * @return//from   w w w. j av  a 2 s  .com
 */
public ListenableFuture<Void> updateRegistration(String registrationId, Registration registration) {
    UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(baseURL);
    builder.path("v2/registrations/{registrationId}");
    return adapt(request(HttpMethod.PATCH, builder.buildAndExpand(registrationId).toUriString(), registration,
            Void.class));
}

From source file:com.orange.ngsi2.client.Ngsi2Client.java

/**
 * Delete the registration by registration ID
 * @param registrationId the registration ID
 * @return//from   w w w .  ja va2s . c  o m
 */
public ListenableFuture<Void> deleteRegistration(String registrationId) {
    UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(baseURL);
    builder.path("v2/registrations/{registrationId}");
    return adapt(
            request(HttpMethod.DELETE, builder.buildAndExpand(registrationId).toUriString(), null, Void.class));
}

From source file:com.orange.ngsi2.client.Ngsi2Client.java

/**
 * Get a Subscription by subscription ID
 * @param subscriptionId the subscription ID
 * @return the subscription/*  w ww.  jav  a 2  s . co m*/
 */
public ListenableFuture<Subscription> getSubscription(String subscriptionId) {
    UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(baseURL);
    builder.path("v2/subscriptions/{subscriptionId}");
    return adapt(request(HttpMethod.GET, builder.buildAndExpand(subscriptionId).toUriString(), null,
            Subscription.class));
}

From source file:com.orange.ngsi2.client.Ngsi2Client.java

/**
 * Update the subscription by subscription ID
 * @param subscriptionId the subscription ID
 * @return//from  w w  w  . j  a  v  a  2 s  .co  m
 */
public ListenableFuture<Void> updateSubscription(String subscriptionId, Subscription subscription) {
    UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(baseURL);
    builder.path("v2/subscriptions/{subscriptionId}");
    return adapt(request(HttpMethod.PATCH, builder.buildAndExpand(subscriptionId).toUriString(), subscription,
            Void.class));
}

From source file:com.orange.ngsi2.client.Ngsi2Client.java

/**
 * Delete the subscription by subscription ID
 * @param subscriptionId the subscription ID
 * @return/*from  www .  ja  va 2 s. c  om*/
 */
public ListenableFuture<Void> deleteSubscription(String subscriptionId) {
    UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(baseURL);
    builder.path("v2/subscriptions/{subscriptionId}");
    return adapt(
            request(HttpMethod.DELETE, builder.buildAndExpand(subscriptionId).toUriString(), null, Void.class));
}

From source file:com.orange.ngsi2.client.Ngsi2Client.java

/**
 * Get an entity/*from w w w  .ja  v a  2  s  .c  om*/
 * @param entityId the entity ID
 * @param type optional entity type to avoid ambiguity when multiple entities have the same ID, null or zero-length for empty
 * @param attrs the list of attributes to retreive for this entity, null or empty means all attributes
 * @return the entity
 */
public ListenableFuture<Entity> getEntity(String entityId, String type, Collection<String> attrs) {
    UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(baseURL);
    builder.path("v2/entities/{entityId}");
    addParam(builder, "type", type);
    addParam(builder, "attrs", attrs);
    return adapt(request(HttpMethod.GET, builder.buildAndExpand(entityId).toUriString(), null, Entity.class));
}

From source file:com.orange.ngsi2.client.Ngsi2Client.java

/**
 * Replace all the existing attributes of an entity with a new set of attributes
 * @param entityId the entity ID//from w ww  . ja va  2s .c  o  m
 * @param type optional entity type to avoid ambiguity when multiple entities have the same ID, null or zero-length for empty
 * @param attributes the new set of attributes
 * @return the listener to notify of completion
 */
public ListenableFuture<Void> replaceEntity(String entityId, String type, Map<String, Attribute> attributes) {
    UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(baseURL);
    builder.path("v2/entities/{entityId}");
    addParam(builder, "type", type);
    return adapt(
            request(HttpMethod.PUT, builder.buildAndExpand(entityId).toUriString(), attributes, Void.class));
}

From source file:com.orange.ngsi2.client.Ngsi2Client.java

/**
 * Retrieve the attribute of an entity/*from w  w w  .j av  a 2  s .com*/
 * @param entityId the entity ID
 * @param type optional entity type to avoid ambiguity when multiple entities have the same ID, null or zero-length for empty
 * @param attributeName the attribute name
 * @return
 */
public ListenableFuture<Attribute> getAttribute(String entityId, String type, String attributeName) {
    UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(baseURL);
    builder.path("v2/entities/{entityId}/attrs/{attributeName}");
    addParam(builder, "type", type);
    return adapt(request(HttpMethod.GET, builder.buildAndExpand(entityId, attributeName).toUriString(), null,
            Attribute.class));
}

From source file:com.orange.ngsi2.client.Ngsi2Client.java

/**
 * Delete the attribute of an entity/*www .  j a  v  a2 s .c o  m*/
 * @param entityId the entity ID
 * @param type optional entity type to avoid ambiguity when multiple entities have the same ID, null or zero-length for empty
 * @param attributeName the attribute name
 * @return
 */
public ListenableFuture<Attribute> deleteAttribute(String entityId, String type, String attributeName) {
    UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(baseURL);
    builder.path("v2/entities/{entityId}/attrs/{attributeName}");
    addParam(builder, "type", type);
    return adapt(request(HttpMethod.DELETE, builder.buildAndExpand(entityId, attributeName).toUriString(), null,
            Attribute.class));
}

From source file:com.orange.ngsi2.client.Ngsi2Client.java

/**
 * Retrieve the attribute of an entity/*from  w  w w.j  av a 2 s. c  o  m*/
 * @param entityId the entity ID
 * @param type optional entity type to avoid ambiguity when multiple entities have the same ID, null or zero-length for empty
 * @param attributeName the attribute name
 * @return
 */
public ListenableFuture<Object> getAttributeValue(String entityId, String type, String attributeName) {
    UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(baseURL);
    builder.path("v2/entities/{entityId}/attrs/{attributeName}/value");
    addParam(builder, "type", type);
    return adapt(request(HttpMethod.GET, builder.buildAndExpand(entityId, attributeName).toUriString(), null,
            Object.class));
}