defect commit
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package com.bayer.edam.migration;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.hateoas.MediaTypes;
|
||||
import org.springframework.hateoas.client.Traverson;
|
||||
|
||||
public class Application {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(Application.class);
|
||||
|
||||
public static void main(String args[]) {
|
||||
Map<String, Object> parameters = new HashMap<>();
|
||||
parameters.put("user", 27);
|
||||
|
||||
Traverson traverson;
|
||||
try {
|
||||
traverson = new Traverson(new URI("http://localhost:8080/api/"), MediaTypes.HAL_JSON);
|
||||
String name = traverson.follow("movies", "movie", "actor").withTemplateParameters(parameters).toObject("$.name");
|
||||
|
||||
} catch (URISyntaxException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package hello;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
public class Application {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(Application.class);
|
||||
|
||||
public static void main(String args[]) {
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
Quote quote = restTemplate.getForObject("http://gturnquist-quoters.cfapps.io/api/random", Quote.class);
|
||||
restTemplate.
|
||||
log.info(quote.toString());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package hello;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class Quote {
|
||||
|
||||
private String type;
|
||||
private Value value;
|
||||
|
||||
public Quote() {
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Value getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(Value value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Quote{" + "type='" + type + '\'' + ", value=" + value + '}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package hello;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class Value {
|
||||
|
||||
private Long id;
|
||||
private String quote;
|
||||
|
||||
public Value() {
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public String getQuote() {
|
||||
return this.quote;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setQuote(String quote) {
|
||||
this.quote = quote;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Value{" + "id=" + id + ", quote='" + quote + '\'' + '}';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user