Skip to content

Commit e08a53d

Browse files
committed
digital double logic
1 parent d2cdd4c commit e08a53d

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

java-ai/src/main/java/oracleai/services/ORDSCalls.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
import org.springframework.ui.Model;
1111
import org.springframework.web.client.RestTemplate;
1212
import org.springframework.web.multipart.MultipartFile;
13+
import org.springframework.web.util.UriComponentsBuilder;
1314

1415

1516
import java.io.IOException;
17+
import java.net.URI;
1618
import java.net.URLEncoder;
1719
import java.util.Base64;
1820
import java.util.Collections;
@@ -209,17 +211,24 @@ public static void insertDigitalDoubleData(MultipartFile image, MultipartFile vi
209211
public static @Nullable String getDigitalDoubleData(String email) throws Exception {
210212
System.out.println("DigitalDoubles.downloaddigitaldouble lookup email:" + email);
211213
// String url = AIApplication.ORDS_OMLOPSENDPOINT_URL + "modelurls/geturls/" + email;
212-
String url = AIApplication.ORDS_OMLOPSENDPOINT_URL + "/digitaldouble/fbxurl/" + URLEncoder.encode(email, "UTF-8");
214+
String baseUrl = AIApplication.ORDS_OMLOPSENDPOINT_URL +
215+
"/digitaldouble/fbxurl/" ;
213216

214217

218+
// Use UriComponentsBuilder to append the email as a query parameter
219+
URI uri = UriComponentsBuilder.fromHttpUrl(baseUrl)
220+
.queryParam("email", URLEncoder.encode(email, "UTF-8"))
221+
.build(true).toUri();
222+
223+
// Set the headers
215224
HttpHeaders headers = new HttpHeaders();
216225
headers.setContentType(MediaType.APPLICATION_JSON);
217226

218227
// Prepare the request entity with headers
219228
HttpEntity<String> entity = new HttpEntity<>(headers);
220229

221230
// Execute the GET request
222-
ResponseEntity<String> response = new RestTemplate().exchange(url, HttpMethod.GET, entity, String.class);
231+
ResponseEntity<String> response = new RestTemplate().exchange(uri, HttpMethod.GET, entity, String.class);
223232

224233
// Check if the response is successful (status code 200)
225234
if (response.getStatusCode().is2xxSuccessful()) {

0 commit comments

Comments
 (0)