def add() {
def wine_requ = [
name: "Forster Ungeheuer 133",
address: "Germany 233"
]
def url = new URL("http://localhost:8080/tomcat/place")
def wine_resp = url.openConnection().with {
requestMethod = "POST"
doOutput = true
setRequestProperty("Content-Type", "application/json;charset=UTF-8")
outputStream.withWriter("UTF-8") { new StreamingJsonBuilder(it, wine_requ) }
new JsonSlurper().parse(inputStream.newReader("UTF-8"))
}
render wine_resp
}
def place() {
def url = new URL("http://localhost:8080/tomcat/place")
def urlConnection = url.openConnection()
urlConnection.with {
requestMethod = "GET"
doOutput = true
}
BufferedReader buff = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
render buff.readLine()
}
def wine_requ = [
name: "Forster Ungeheuer 133",
address: "Germany 233"
]
def url = new URL("http://localhost:8080/tomcat/place")
def wine_resp = url.openConnection().with {
requestMethod = "POST"
doOutput = true
setRequestProperty("Content-Type", "application/json;charset=UTF-8")
outputStream.withWriter("UTF-8") { new StreamingJsonBuilder(it, wine_requ) }
new JsonSlurper().parse(inputStream.newReader("UTF-8"))
}
render wine_resp
}
def place() {
def url = new URL("http://localhost:8080/tomcat/place")
def urlConnection = url.openConnection()
urlConnection.with {
requestMethod = "GET"
doOutput = true
}
BufferedReader buff = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
render buff.readLine()
}
No comments:
Post a Comment