|
10 | 10 | import org.springframework.ui.Model;
|
11 | 11 | import org.springframework.web.client.RestTemplate;
|
12 | 12 | import org.springframework.web.multipart.MultipartFile;
|
| 13 | +import org.springframework.web.util.UriComponentsBuilder; |
13 | 14 |
|
14 | 15 |
|
15 | 16 | import java.io.IOException;
|
| 17 | +import java.net.URI; |
16 | 18 | import java.net.URLEncoder;
|
17 | 19 | import java.util.Base64;
|
18 | 20 | import java.util.Collections;
|
@@ -209,17 +211,24 @@ public static void insertDigitalDoubleData(MultipartFile image, MultipartFile vi
|
209 | 211 | public static @Nullable String getDigitalDoubleData(String email) throws Exception {
|
210 | 212 | System.out.println("DigitalDoubles.downloaddigitaldouble lookup email:" + email);
|
211 | 213 | // 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/" ; |
213 | 216 |
|
214 | 217 |
|
| 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 |
215 | 224 | HttpHeaders headers = new HttpHeaders();
|
216 | 225 | headers.setContentType(MediaType.APPLICATION_JSON);
|
217 | 226 |
|
218 | 227 | // Prepare the request entity with headers
|
219 | 228 | HttpEntity<String> entity = new HttpEntity<>(headers);
|
220 | 229 |
|
221 | 230 | // 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); |
223 | 232 |
|
224 | 233 | // Check if the response is successful (status code 200)
|
225 | 234 | if (response.getStatusCode().is2xxSuccessful()) {
|
|
0 commit comments