1
1
package oracleai ;
2
2
3
3
import org .springframework .beans .factory .annotation .Autowired ;
4
+ import org .springframework .http .*;
4
5
import org .springframework .stereotype .Service ;
5
6
import org .springframework .web .client .RestTemplate ;
6
- import org .springframework .http .HttpEntity ;
7
- import org .springframework .http .HttpHeaders ;
8
- import org .springframework .http .MediaType ;
9
- import org .springframework .http .ResponseEntity ;
10
7
11
8
import java .util .HashMap ;
12
9
import java .util .Map ;
@@ -23,24 +20,27 @@ public class DigitalDoubleService {
23
20
24
21
public void updateDigitalDoubleData (DigitalDoubleDownloadInfo info ) {
25
22
String url = AIApplication .ORDS_OMLOPSENDPOINT_URL + "update_digital_double_data/" ;
23
+
26
24
HttpHeaders headers = new HttpHeaders ();
27
25
headers .setContentType (MediaType .APPLICATION_JSON );
28
- Map <String , Object > requestBody = new HashMap <>();
26
+
27
+ Map <String , String > requestBody = new HashMap <>();
29
28
requestBody .put ("p_participant_email" , info .getEmail ());
30
29
requestBody .put ("p_modelglburl_out" , info .getModelGlbUrl ());
31
- requestBody .put ("p_modelfbxurl_out" , info .getModelFbxUrl () );
32
- requestBody .put ("p_modelusdzurl_out" , info .getModelUsdzUrl () );
33
- requestBody .put ("p_thumbnailurl_out" , info .getThumbnailUrl () );
34
- requestBody . put ( "p_videourl_out" , info . getAnimatedVideoLocation ());
35
- requestBody . put ( "p_video_out" , "" );
36
- requestBody . put ( "p_similar_image_out" , "" );
37
- HttpEntity < Map < String , Object >> entity = new HttpEntity <>( requestBody , headers );
38
- RestTemplate restTemplate = new RestTemplate ();
39
- ResponseEntity < String > response = restTemplate . postForEntity ( url , entity , String . class );
30
+ requestBody .put ("p_modelfbxurl_out" , info .modelFbxUrl );
31
+ requestBody .put ("p_modelusdzurl_out" , info .modelUsdzUrl );
32
+ requestBody .put ("p_thumbnailurl_out" , info .thumbnailUrl );
33
+
34
+ HttpEntity < Map < String , String >> entity = new HttpEntity <>( requestBody , headers );
35
+
36
+ ResponseEntity < String > response =
37
+ new RestTemplate (). exchange ( url , HttpMethod . POST , entity , String . class );
38
+
40
39
if (response .getStatusCode ().is2xxSuccessful ()) {
41
40
System .out .println ("Request successful: " + response .getBody ());
42
41
} else {
43
42
System .err .println ("Request failed with status code: " + response .getStatusCode ());
44
43
}
44
+
45
45
}
46
46
}
0 commit comments