-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
package com.yezhaodan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
@RestController
public class Controller {
@Autowired
RestTemplate restTemplate;
@RequestMapping(value="/test",method={RequestMethod.GET})
public void controll(){
String url = "************************************";
try {
HttpHeaders headers = AuthenticationUtil.getHttpHeaders();
HttpEntity<String> entity = new HttpEntity<>(null, headers);
ResponseEntity<String> resEntity = restTemplate.exchange(url, HttpMethod.POST, entity, String.class);
System.out.println(resEntity);
} catch (Exception e) {
System.out.println("error"+e.getMessage());
}
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels