You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2020/01/06 14:13:27 UTC
[isis] 01/03: ISIS-2158: decouple LinkRepresentation from client
code
This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git
commit 40a20721ce3edc26885997469240ed60e7c6f8f9
Author: Andi Huber <ah...@apache.org>
AuthorDate: Mon Jan 6 14:13:54 2020 +0100
ISIS-2158: decouple LinkRepresentation from client code
---
.../restfulobjects/applib/LinkRepresentation.java | 22 ----------------------
.../isis/legacy/restclient/RestfulClient.java | 16 ++++++++++++++--
2 files changed, 14 insertions(+), 24 deletions(-)
diff --git a/core/viewers/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/LinkRepresentation.java b/core/viewers/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/LinkRepresentation.java
index e9d1c7d..61fb739 100644
--- a/core/viewers/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/LinkRepresentation.java
+++ b/core/viewers/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/LinkRepresentation.java
@@ -24,11 +24,6 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;
-import org.apache.isis.viewer.restfulobjects.applib.client.ClientExecutor;
-import org.apache.isis.viewer.restfulobjects.applib.client.ClientRequestConfigurer;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-
public final class LinkRepresentation extends JsonRepresentation {
public LinkRepresentation() {
@@ -111,23 +106,6 @@ public final class LinkRepresentation extends JsonRepresentation {
return new JsonRepresentation(arguments);
}
- public <T> RestfulResponse<JsonRepresentation> follow(final ClientExecutor executor) throws Exception {
- return follow(executor, null);
- }
-
- public <T extends JsonRepresentation> RestfulResponse<T> follow(final ClientExecutor executor, final JsonRepresentation requestArgs) throws Exception {
-
- final ClientRequestConfigurer clientRequestConfigurer = ClientRequestConfigurer.create(executor, getHref());
-
- clientRequestConfigurer.accept(MediaType.APPLICATION_JSON_TYPE);
- clientRequestConfigurer.setHttpMethod(getHttpMethod());
-
- clientRequestConfigurer.configureArgs(requestArgs);
-
- final RestfulRequest restfulRequest = new RestfulRequest(clientRequestConfigurer);
- return restfulRequest.executeT();
- }
-
@Override
public int hashCode() {
final int prime = 31;
diff --git a/legacy/vro/restclient/src/main/java/org/apache/isis/legacy/restclient/RestfulClient.java b/legacy/vro/restclient/src/main/java/org/apache/isis/legacy/restclient/RestfulClient.java
index 2c71242..b790f0e 100644
--- a/legacy/vro/restclient/src/main/java/org/apache/isis/legacy/restclient/RestfulClient.java
+++ b/legacy/vro/restclient/src/main/java/org/apache/isis/legacy/restclient/RestfulClient.java
@@ -129,8 +129,20 @@ public class RestfulClient {
return followT(link, requestArgs);
}
- public <T extends JsonRepresentation> RestfulResponse<T> followT(final LinkRepresentation link, final JsonRepresentation requestArgs) throws Exception {
- return link.<T> follow(executor, requestArgs);
+ public <T extends JsonRepresentation> RestfulResponse<T> followT(
+ final LinkRepresentation link,
+ final JsonRepresentation requestArgs) throws Exception {
+
+ final ClientRequestConfigurer clientRequestConfigurer =
+ ClientRequestConfigurer.create(executor, link.getHref());
+
+ clientRequestConfigurer.accept(MediaType.APPLICATION_JSON_TYPE);
+ clientRequestConfigurer.setHttpMethod(link.getHttpMethod());
+
+ clientRequestConfigurer.configureArgs(requestArgs);
+
+ final RestfulRequest restfulRequest = new RestfulRequest(clientRequestConfigurer);
+ return restfulRequest.executeT();
}
public RestfulRequest createRequest(final RestfulHttpMethod httpMethod, final String uriTemplate) {