Whitelabel Error Page при переходе на контроллер
Добрый день я пытаюсь получить информацию о пользовательском аккаунте на Яндексе и его историю платежей. Для этого я зарегистрировал своё приложение на Яндекс Money.
Вот мой код:
package controller;
import org.springframework.http.*;
import org.springframework.stereotype.Controller;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@RestController
public class YandexMoneyController {
@RequestMapping(value = "/sendReq", method = RequestMethod.GET)
// @ResponseBody
public ResponseEntity<String> testMethod(@RequestParam(value = "code", required = true) String code
/* HttpSession session,*/
)
{
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
;
map.add("client_id", "id_application");
map.add("response_type", "code");
map.add("redirect_uri", "http://localhost:8089/successPayment");
map.add("scope", "account-info operation-history");
HttpEntity<MultiValueMap<String, String>> entity = new HttpEntity<>(map, headers);
ResponseEntity<String> response =
restTemplate.exchange("https://money.yandex.ru",
HttpMethod.POST,
entity,
String.class);
return response;
}
}
Помогите, пожалуйста, разобраться с данной проблемой.
