Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoberto E. Escobar2014-09-04 15:26:59 -0400
committerRoberto E. Escobar2014-09-04 17:34:22 -0400
commit0e5f003b2994eb82a8f1f6ffbb8c362d5eff8bc8 (patch)
tree24a7a70fb4e4ccd6313bcdb9ffd31cafd04875c2 /plugins/org.eclipse.osee.ote.master.rest.client
parentb6344fd2a6dcacb733e5d5edb23de582522c0d7d (diff)
downloadorg.eclipse.osee-0e5f003b2994eb82a8f1f6ffbb8c362d5eff8bc8.tar.gz
org.eclipse.osee-0e5f003b2994eb82a8f1f6ffbb8c362d5eff8bc8.tar.xz
org.eclipse.osee-0e5f003b2994eb82a8f1f6ffbb8c362d5eff8bc8.zip
bug[ats_ATS105324]: Create a new WebTarget for each request
Update JaxRsClient interface to prevent creation of nested web targets. Change-Id: Ia59dc912d505e12536ddb0646e6429f2c913cf6f
Diffstat (limited to 'plugins/org.eclipse.osee.ote.master.rest.client')
-rw-r--r--plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/AddServer.java9
-rw-r--r--plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/GetAvailableServers.java9
-rw-r--r--plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/RemoveServer.java10
3 files changed, 16 insertions, 12 deletions
diff --git a/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/AddServer.java b/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/AddServer.java
index 32fd268756..0dc70eee8c 100644
--- a/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/AddServer.java
+++ b/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/AddServer.java
@@ -3,8 +3,8 @@ package org.eclipse.osee.ote.master.rest.client.internal;
import java.net.URI;
import java.util.concurrent.Callable;
import javax.ws.rs.client.Entity;
-import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.UriBuilder;
import org.eclipse.osee.jaxrs.client.JaxRsClient;
import org.eclipse.osee.ote.master.rest.client.OTEMasterServerResult;
import org.eclipse.osee.ote.master.rest.model.OTEServer;
@@ -23,11 +23,12 @@ public class AddServer implements Callable<OTEMasterServerResult> {
@Override
public OTEMasterServerResult call() throws Exception {
+ URI targetUri =
+ UriBuilder.fromUri(uri).path(OTEMasterServerImpl.CONTEXT_NAME).path(OTEMasterServerImpl.CONTEXT_SERVERS).build();
+
OTEMasterServerResult result = new OTEMasterServerResult();
try {
- WebTarget resource = webClientProvider.target(uri);
- resource.path(OTEMasterServerImpl.CONTEXT_NAME).path(OTEMasterServerImpl.CONTEXT_SERVERS).request(
- MediaType.APPLICATION_XML).post(Entity.xml(server));
+ webClientProvider.target(targetUri).request(MediaType.APPLICATION_XML).post(Entity.xml(server));
} catch (Throwable th) {
result.setSuccess(false);
result.setThrowable(th);
diff --git a/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/GetAvailableServers.java b/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/GetAvailableServers.java
index a3af0bd437..57bc86f234 100644
--- a/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/GetAvailableServers.java
+++ b/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/GetAvailableServers.java
@@ -2,8 +2,8 @@ package org.eclipse.osee.ote.master.rest.client.internal;
import java.net.URI;
import java.util.concurrent.Callable;
-import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.UriBuilder;
import org.eclipse.osee.jaxrs.client.JaxRsClient;
import org.eclipse.osee.ote.master.rest.client.OTEMasterServerAvailableNodes;
import org.eclipse.osee.ote.master.rest.model.OTEServer;
@@ -20,12 +20,13 @@ public class GetAvailableServers implements Callable<OTEMasterServerAvailableNod
@Override
public OTEMasterServerAvailableNodes call() throws Exception {
+ URI targetUri =
+ UriBuilder.fromUri(uri).path(OTEMasterServerImpl.CONTEXT_NAME).path(OTEMasterServerImpl.CONTEXT_SERVERS).build();
+
OTEMasterServerAvailableNodes result = new OTEMasterServerAvailableNodes();
try {
- WebTarget resource = webClientProvider.target(uri);
OTEServer[] servers =
- resource.path(OTEMasterServerImpl.CONTEXT_NAME).path(OTEMasterServerImpl.CONTEXT_SERVERS).request(
- MediaType.APPLICATION_XML).get(OTEServer[].class);
+ webClientProvider.target(targetUri).request(MediaType.APPLICATION_XML).get(OTEServer[].class);
result.setServers(servers);
result.setSuccess(true);
} catch (Throwable th) {
diff --git a/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/RemoveServer.java b/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/RemoveServer.java
index 5cfed8e621..b966e07956 100644
--- a/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/RemoveServer.java
+++ b/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/RemoveServer.java
@@ -4,8 +4,8 @@ import java.net.URI;
import java.util.concurrent.Callable;
import javax.ws.rs.HttpMethod;
import javax.ws.rs.client.Entity;
-import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.UriBuilder;
import org.eclipse.osee.jaxrs.client.JaxRsClient;
import org.eclipse.osee.ote.master.rest.client.OTEMasterServerResult;
import org.eclipse.osee.ote.master.rest.model.OTEServer;
@@ -24,11 +24,13 @@ public class RemoveServer implements Callable<OTEMasterServerResult> {
@Override
public OTEMasterServerResult call() throws Exception {
+ URI targetUri =
+ UriBuilder.fromUri(uri).path(OTEMasterServerImpl.CONTEXT_NAME).path(OTEMasterServerImpl.CONTEXT_SERVERS).build();
+
OTEMasterServerResult result = new OTEMasterServerResult();
try {
- WebTarget resource = webClientProvider.target(uri);
- resource.path(OTEMasterServerImpl.CONTEXT_NAME).path(OTEMasterServerImpl.CONTEXT_SERVERS).request(
- MediaType.APPLICATION_XML).method(HttpMethod.DELETE, Entity.xml(server));
+ webClientProvider.target(targetUri).request(MediaType.APPLICATION_XML).method(HttpMethod.DELETE,
+ Entity.xml(server));
} catch (Throwable th) {
result.setSuccess(false);
result.setThrowable(th);

Back to the top