You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gz...@apache.org on 2017/04/12 09:26:22 UTC
[1/2] camel git commit: Polish example
Repository: camel
Updated Branches:
refs/heads/master 5fa7a8a4b -> 19fa67a64
Polish example
Signed-off-by: Gregor Zurowski <gr...@zurowski.org>
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/19fa67a6
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/19fa67a6
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/19fa67a6
Branch: refs/heads/master
Commit: 19fa67a64410d90b428998d33598891094567aad
Parents: 1612ede
Author: Gregor Zurowski <gr...@zurowski.org>
Authored: Wed Apr 12 11:24:24 2017 +0200
Committer: Gregor Zurowski <gr...@zurowski.org>
Committed: Wed Apr 12 11:26:07 2017 +0200
----------------------------------------------------------------------
.../src/main/java/sample/camel/PetController.java | 14 ++++++++------
.../src/main/java/sample/camel/RestRoute.java | 2 +-
2 files changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/19fa67a6/examples/camel-example-rest-producer/src/main/java/sample/camel/PetController.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-rest-producer/src/main/java/sample/camel/PetController.java b/examples/camel-example-rest-producer/src/main/java/sample/camel/PetController.java
index d9bb346..71c1802 100644
--- a/examples/camel-example-rest-producer/src/main/java/sample/camel/PetController.java
+++ b/examples/camel-example-rest-producer/src/main/java/sample/camel/PetController.java
@@ -16,8 +16,11 @@
*/
package sample.camel;
+import java.util.Collections;
+import java.util.Map;
+
+import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
@@ -28,15 +31,14 @@ public class PetController {
private static final String[] PETS = new String[]{"Snoopy", "Fido", "Tony the Tiger"};
- @RequestMapping(value = "/petById/{id}", produces = "application/json")
- public String petById(@PathVariable("id") Integer id) {
+ @GetMapping(value = "/pets/{id}")
+ public Map<String, String> petById(@PathVariable("id") Integer id) {
if (id != null && id > 0 && id <= PETS.length + 1) {
int index = id - 1;
String pet = PETS[index];
- return String.format("{ \"name\": \"%s\" }", pet);
+ return Collections.singletonMap("name", pet);
} else {
- // empty pet
- return "{ }";
+ return Collections.emptyMap();
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/19fa67a6/examples/camel-example-rest-producer/src/main/java/sample/camel/RestRoute.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-rest-producer/src/main/java/sample/camel/RestRoute.java b/examples/camel-example-rest-producer/src/main/java/sample/camel/RestRoute.java
index dc2b2f8..72fb2ea 100644
--- a/examples/camel-example-rest-producer/src/main/java/sample/camel/RestRoute.java
+++ b/examples/camel-example-rest-producer/src/main/java/sample/camel/RestRoute.java
@@ -34,7 +34,7 @@ public class RestRoute extends RouteBuilder {
from("timer:hello?period={{timer.period}}")
.setHeader("id", simple("${random(1,3)}"))
- .to("rest:get:petById/{id}")
+ .to("rest:get:pets/{id}")
.log("${body}");
}
[2/2] camel git commit: Add camel-example-rest-producer module to
parent
Posted by gz...@apache.org.
Add camel-example-rest-producer module to parent
Signed-off-by: Gregor Zurowski <gr...@zurowski.org>
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1612ede9
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1612ede9
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1612ede9
Branch: refs/heads/master
Commit: 1612ede904703da70f0afc2971e166cbc46ae4c7
Parents: 5fa7a8a
Author: Gregor Zurowski <gr...@zurowski.org>
Authored: Wed Apr 12 11:05:49 2017 +0200
Committer: Gregor Zurowski <gr...@zurowski.org>
Committed: Wed Apr 12 11:26:07 2017 +0200
----------------------------------------------------------------------
examples/pom.xml | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/1612ede9/examples/pom.xml
----------------------------------------------------------------------
diff --git a/examples/pom.xml b/examples/pom.xml
index bb82380..ed0a3ad 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -78,6 +78,7 @@
<module>camel-example-reload</module>
<module>camel-example-reportincident</module>
<module>camel-example-reportincident-wssecurity</module>
+ <module>camel-example-rest-producer</module>
<module>camel-example-restlet-jdbc</module>
<module>camel-example-route-throttling</module>
<module>camel-example-scala</module>