From 91108daef0866e20eb7bb4f0100f28bdf3343b1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Sch=C3=BCth?= Date: Fri, 21 Oct 2016 13:59:09 +0200 Subject: [PATCH 1/8] Fix missing field error handling --- .../com/gentics/mesh/core/data/node/impl/MicronodeImpl.java | 6 ++++-- .../java/com/gentics/mesh/core/data/node/impl/NodeImpl.java | 6 ++++-- .../changes/9116cfb9-569b-4d10-8a50-098480aaf7a2.bugfix.md | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 doc/src/main/changelog/changes/9116cfb9-569b-4d10-8a50-098480aaf7a2.bugfix.md diff --git a/core/src/main/java/com/gentics/mesh/core/data/node/impl/MicronodeImpl.java b/core/src/main/java/com/gentics/mesh/core/data/node/impl/MicronodeImpl.java index ab5377772f..40276407ac 100644 --- a/core/src/main/java/com/gentics/mesh/core/data/node/impl/MicronodeImpl.java +++ b/core/src/main/java/com/gentics/mesh/core/data/node/impl/MicronodeImpl.java @@ -77,8 +77,10 @@ public Observable transformToRestSync(InternalActionContext a if (fieldEntry.isRequired() && restField == null) { /* TODO i18n */ // TODO no trx fail. Instead let obsRestField fail - throw error(BAD_REQUEST, "The field {" + fieldEntry.getName() - + "} is a required field but it could not be found in the micronode. Please add the field using an update call or change the field schema and remove the required flag."); +// throw error(BAD_REQUEST, "The field {" + fieldEntry.getName() +// + "} is a required field but it could not be found in the micronode. Please add the field using an update call or change the field schema and remove the required flag."); + restMicronode.getFields().put(fieldEntry.getName(), null); + return restMicronode; } if (restField == null) { log.info("Field for key {" + fieldEntry.getName() + "} could not be found. Ignoring the field."); diff --git a/core/src/main/java/com/gentics/mesh/core/data/node/impl/NodeImpl.java b/core/src/main/java/com/gentics/mesh/core/data/node/impl/NodeImpl.java index e89a77ea18..4d82d19541 100644 --- a/core/src/main/java/com/gentics/mesh/core/data/node/impl/NodeImpl.java +++ b/core/src/main/java/com/gentics/mesh/core/data/node/impl/NodeImpl.java @@ -395,8 +395,10 @@ public Observable transformToRestSync(InternalActionContext ac, in .getRestFieldFromGraph(ac, fieldEntry.getName(), fieldEntry, containerLanguageTags, level).map(restField -> { if (fieldEntry.isRequired() && restField == null) { // TODO i18n - throw error(BAD_REQUEST, "The field {" + fieldEntry.getName() - + "} is a required field but it could not be found in the node. Please add the field using an update call or change the field schema and remove the required flag."); +// throw error(BAD_REQUEST, "The field {" + fieldEntry.getName() +// + "} is a required field but it could not be found in the node. Please add the field using an update call or change the field schema and remove the required flag."); + restNode.getFields().put(fieldEntry.getName(), null); + return restNode; } if (restField == null) { log.info("Field for key {" + fieldEntry.getName() + "} could not be found. Ignoring the field."); diff --git a/doc/src/main/changelog/changes/9116cfb9-569b-4d10-8a50-098480aaf7a2.bugfix.md b/doc/src/main/changelog/changes/9116cfb9-569b-4d10-8a50-098480aaf7a2.bugfix.md new file mode 100644 index 0000000000..faf0422586 --- /dev/null +++ b/doc/src/main/changelog/changes/9116cfb9-569b-4d10-8a50-098480aaf7a2.bugfix.md @@ -0,0 +1 @@ +Missing fields could cause error responses. Instead the missing fields will not be set to null instead. From 80581fe8364abc9b60a43cea07cf718a6531c682 Mon Sep 17 00:00:00 2001 From: Maven Release Manager Date: Fri, 21 Oct 2016 14:23:30 +0200 Subject: [PATCH 2/8] Raise version --- api/pom.xml | 2 +- changelog-system/pom.xml | 2 +- core/pom.xml | 2 +- databases/orientdb/pom.xml | 2 +- databases/pom.xml | 2 +- demo/pom.xml | 2 +- doc/pom.xml | 2 +- pom.xml | 2 +- rest-client/pom.xml | 2 +- server/pom.xml | 2 +- services/image-imgscalr/pom.xml | 2 +- services/pom.xml | 2 +- verticles/admin-gui/pom.xml | 2 +- verticles/admin/pom.xml | 2 +- verticles/navigation/pom.xml | 2 +- verticles/pom.xml | 2 +- verticles/sitemap/pom.xml | 2 +- verticles/tagcloud/pom.xml | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index e778ef773a..34df7986fe 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -10,7 +10,7 @@ com.gentics.mesh mesh - 0.6.27 + 0.6.28 diff --git a/changelog-system/pom.xml b/changelog-system/pom.xml index ea31401473..0d5a04de07 100644 --- a/changelog-system/pom.xml +++ b/changelog-system/pom.xml @@ -11,7 +11,7 @@ com.gentics.mesh mesh - 0.6.27 + 0.6.28 diff --git a/core/pom.xml b/core/pom.xml index a2524c609f..029571f5a4 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -9,7 +9,7 @@ com.gentics.mesh mesh - 0.6.27 + 0.6.28 diff --git a/databases/orientdb/pom.xml b/databases/orientdb/pom.xml index 69c9440635..2b5e9844a9 100644 --- a/databases/orientdb/pom.xml +++ b/databases/orientdb/pom.xml @@ -9,7 +9,7 @@ com.gentics.mesh mesh-databases - 0.6.27 + 0.6.28 diff --git a/databases/pom.xml b/databases/pom.xml index 03582e972b..3c3597ca78 100644 --- a/databases/pom.xml +++ b/databases/pom.xml @@ -9,7 +9,7 @@ com.gentics.mesh mesh - 0.6.27 + 0.6.28 diff --git a/demo/pom.xml b/demo/pom.xml index 394b11ec6c..f891290c9d 100644 --- a/demo/pom.xml +++ b/demo/pom.xml @@ -9,7 +9,7 @@ com.gentics.mesh mesh - 0.6.27 + 0.6.28 diff --git a/doc/pom.xml b/doc/pom.xml index 9528be06b4..a741635651 100644 --- a/doc/pom.xml +++ b/doc/pom.xml @@ -5,7 +5,7 @@ com.gentics.mesh mesh - 0.6.27 + 0.6.28 mesh-doc diff --git a/pom.xml b/pom.xml index b89e6ce533..ab6d539a1c 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.gentics.mesh mesh - 0.6.27 + 0.6.28 pom Mesh diff --git a/rest-client/pom.xml b/rest-client/pom.xml index 405ebda9ec..50a81ab4b1 100644 --- a/rest-client/pom.xml +++ b/rest-client/pom.xml @@ -9,7 +9,7 @@ com.gentics.mesh mesh - 0.6.27 + 0.6.28 diff --git a/server/pom.xml b/server/pom.xml index 37c03503fa..48d942cb94 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -9,7 +9,7 @@ com.gentics.mesh mesh - 0.6.27 + 0.6.28 diff --git a/services/image-imgscalr/pom.xml b/services/image-imgscalr/pom.xml index 65c1ee5308..bb0709ad16 100644 --- a/services/image-imgscalr/pom.xml +++ b/services/image-imgscalr/pom.xml @@ -9,7 +9,7 @@ com.gentics.mesh mesh-services - 0.6.27 + 0.6.28 diff --git a/services/pom.xml b/services/pom.xml index c290fd5dc0..86eae3ebcf 100644 --- a/services/pom.xml +++ b/services/pom.xml @@ -9,7 +9,7 @@ com.gentics.mesh mesh - 0.6.27 + 0.6.28 diff --git a/verticles/admin-gui/pom.xml b/verticles/admin-gui/pom.xml index 94fc3571e9..e0e339f40a 100644 --- a/verticles/admin-gui/pom.xml +++ b/verticles/admin-gui/pom.xml @@ -9,7 +9,7 @@ com.gentics.mesh mesh-verticles - 0.6.27 + 0.6.28 diff --git a/verticles/admin/pom.xml b/verticles/admin/pom.xml index d5e1dc3d10..f655d1888b 100644 --- a/verticles/admin/pom.xml +++ b/verticles/admin/pom.xml @@ -9,7 +9,7 @@ com.gentics.mesh mesh-verticles - 0.6.27 + 0.6.28 diff --git a/verticles/navigation/pom.xml b/verticles/navigation/pom.xml index 9d137a95d7..2024a2218c 100644 --- a/verticles/navigation/pom.xml +++ b/verticles/navigation/pom.xml @@ -9,7 +9,7 @@ com.gentics.mesh mesh-verticles - 0.6.27 + 0.6.28 diff --git a/verticles/pom.xml b/verticles/pom.xml index fad19fdbf4..6396de564b 100644 --- a/verticles/pom.xml +++ b/verticles/pom.xml @@ -9,7 +9,7 @@ com.gentics.mesh mesh - 0.6.27 + 0.6.28 diff --git a/verticles/sitemap/pom.xml b/verticles/sitemap/pom.xml index 2e7954716b..bb447b1a5d 100644 --- a/verticles/sitemap/pom.xml +++ b/verticles/sitemap/pom.xml @@ -9,7 +9,7 @@ com.gentics.mesh mesh-verticles - 0.6.27 + 0.6.28 diff --git a/verticles/tagcloud/pom.xml b/verticles/tagcloud/pom.xml index 2c5eb8e369..4d72b810d2 100644 --- a/verticles/tagcloud/pom.xml +++ b/verticles/tagcloud/pom.xml @@ -9,7 +9,7 @@ com.gentics.mesh mesh-verticles - 0.6.27 + 0.6.28 From 79315930d3e42e8f977acdc44653a0b2e0ec3c17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Sch=C3=BCth?= Date: Fri, 21 Oct 2016 14:54:18 +0200 Subject: [PATCH 3/8] Fix typo --- .../changes/9116cfb9-569b-4d10-8a50-098480aaf7a2.bugfix.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/main/changelog/changes/9116cfb9-569b-4d10-8a50-098480aaf7a2.bugfix.md b/doc/src/main/changelog/changes/9116cfb9-569b-4d10-8a50-098480aaf7a2.bugfix.md index faf0422586..8110d1197d 100644 --- a/doc/src/main/changelog/changes/9116cfb9-569b-4d10-8a50-098480aaf7a2.bugfix.md +++ b/doc/src/main/changelog/changes/9116cfb9-569b-4d10-8a50-098480aaf7a2.bugfix.md @@ -1 +1 @@ -Missing fields could cause error responses. Instead the missing fields will not be set to null instead. +Missing fields could cause error responses. Instead the missing fields will now be set to null instead. From e42e224ad2b0fc6cd089027ca9525cc41eef28bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Sch=C3=BCth?= Date: Mon, 23 Jan 2017 17:10:19 +0100 Subject: [PATCH 4/8] Fix path handling --- .../java/com/gentics/mesh/rest/impl/MeshRestHttpClientImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest-client/src/main/java/com/gentics/mesh/rest/impl/MeshRestHttpClientImpl.java b/rest-client/src/main/java/com/gentics/mesh/rest/impl/MeshRestHttpClientImpl.java index 90d6e196ff..91d7309297 100644 --- a/rest-client/src/main/java/com/gentics/mesh/rest/impl/MeshRestHttpClientImpl.java +++ b/rest-client/src/main/java/com/gentics/mesh/rest/impl/MeshRestHttpClientImpl.java @@ -502,7 +502,7 @@ public Future webroot(String projectName, String path, QueryPar if (!path.startsWith("/")) { throw new RuntimeException("The path {" + path + "} must start with a slash"); } - String requestUri = BASEURI + "/" + projectName + "/webroot" + path + getQuery(parameters); + String requestUri = BASEURI + "/" + projectName + "/webroot" + URIUtils.encodeFragment(path) + getQuery(parameters); MeshResponseHandler handler = new MeshResponseHandler<>(Object.class, HttpMethod.GET, requestUri); HttpClientRequest request = client.request(GET, requestUri, handler); if (log.isDebugEnabled()) { From 81854405e44dae732f7f0f46c312676271c7f1a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Sch=C3=BCth?= Date: Tue, 7 Mar 2017 11:30:49 +0100 Subject: [PATCH 5/8] Update docs --- ...f287-4b4a-a66b-047738f3a26b.enhancement.md | 1 + doc/src/main/docs/index.asciidoc | 50 +++++++++++++++++++ pom.xml | 12 +++++ .../rest/impl/MeshRestHttpClientImpl.java | 2 +- server/pom.xml | 6 ++- 5 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 doc/src/main/changelog/changes/664d32b3-f287-4b4a-a66b-047738f3a26b.enhancement.md diff --git a/doc/src/main/changelog/changes/664d32b3-f287-4b4a-a66b-047738f3a26b.enhancement.md b/doc/src/main/changelog/changes/664d32b3-f287-4b4a-a66b-047738f3a26b.enhancement.md new file mode 100644 index 0000000000..e5a8e6e7ad --- /dev/null +++ b/doc/src/main/changelog/changes/664d32b3-f287-4b4a-a66b-047738f3a26b.enhancement.md @@ -0,0 +1 @@ +The documentation has been enhanced. diff --git a/doc/src/main/docs/index.asciidoc b/doc/src/main/docs/index.asciidoc index fc287110e4..b302f403ee 100644 --- a/doc/src/main/docs/index.asciidoc +++ b/doc/src/main/docs/index.asciidoc @@ -1364,6 +1364,56 @@ The mesh-ui can be configured using the mesh-ui-config.js file. The mesh ui will provide a preview button when editing nodes. A post request to a configureable url is being dispatchen when the button will be triggered. The post request will contain the node JSON data of the current editing state. This way a preview page can be easily rendered by custom frontend implementations. +== JAVA REST client + +You can add the following maven dependency and repository to your project to get the mesh rest client. + +[source,xml] +---- +… + + mesh-rest-client + com.gentics.mesh + ${mesh.version} + +… + + + maven.gentics.com + Gentics Maven Repository + https://maven.gentics.com/maven2 + + true + + + true + + + +… +---- + +Usage: + +[source,java] +---- + MeshRestClient client = MeshRestClient.create("localhost", 8080, vertx, BASIC_AUTH); + client.setLogin("username", "password"); + client.login().toCompletable().await(); + + client.findNodes("demo", new NodeRequestParameter().setExpandAll(true).setLanguages("en")).setHandler(rh -> { + if (rh.succeeded()) { + NodeListResponse list = rh.result(); + for(NodeResponse nodeResponse : list.getData()) { + System.out.println(nodeResponse.getUuid()); + System.out.println(nodeResponse.getFields().getStringField("name").getString()); + } + } else { + rh.cause().printStackTrace(); + } + }); +---- + == License Gentics Mesh is published under a commercial license. http://getmesh.io/Terms[License Terms] diff --git a/pom.xml b/pom.xml index ab6d539a1c..8b0b8f21d5 100644 --- a/pom.xml +++ b/pom.xml @@ -171,6 +171,18 @@ ${project.artifactId}-${project.version} + + org.apache.maven.plugins + maven-source-plugin + + + attach-sources + + jar + + + +