Segue as classe que eu criei:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="s"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib tagdir="/WEB-INF/tags" prefix="tags"%>
<c:url value="/" var="contextPath" />
<tags:pageTemplate titulo="Lista depedidos">
<div class="container">
<h1>Lista de Pedidos</h1>
<table class="table table-bordered table-striped table-hover">
<tr>
<th>ID</th>
<th>Valor</th>
<th>Data Pedido</th>
<th>Titulo</th>
</tr>
<c:forEach items="${response }" var="response">
<tr>
<td>${response.id}</td>
<td>${response.valor}</td>
<td><fmt:formatDate pattern="dd/MM/yyyy"
value="${response.data.time}" /></td>
<td>${response.produtos}</td>
</tr>
</c:forEach>
</table>
</div>
</tags:pageTemplate>
package br.com.casadocodigo.loja.controllers;
import java.util.concurrent.Callable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import br.com.casadocodigo.loja.models.Pedidos;
@RequestMapping("/pedidos")
@Controller
public class PedidosServicoController {
@Autowired
private RestTemplate restTemplate = new RestTemplate();
@GetMapping
public Callable<ModelAndView> listar(RedirectAttributes model) {
return () -> {
try {
String url ="https://book-payment.herokuapp.com/orders";
Pedidos[] response = restTemplate.getForObject(url
,Pedidos[].class);
System.out.println(response.toString());
ModelAndView modelAndView = new ModelAndView("carrinho/pedidos");
modelAndView.addObject("response", response);
return modelAndView;
} catch (HttpClientErrorException e) {
e.printStackTrace();
return new ModelAndView("redirect:/pedidos");
}
};
}
}