Отсутствует переменная шаблона URI «размер страницы» для параметра метода типа int - PullRequest
0 голосов
/ 02 ноября 2019

Я разрабатываю приложение angular-springboot и не могу связаться с контроллером springboot. Вот мой контроллер

@CrossOrigin(origins = "http://localhost:4200", maxAge = 3600)
@RestController
@RequestMapping({"/api"})
public class ProduitImmobilierController {

    @Autowired
    private ProduitImmobilierServiceImpl userService;

    @RequestMapping(value = "/produitimmobilier/all/{{pagesize}}/{{page}}",
    method = RequestMethod.GET,
    produces = {"text/plain;charset=UTF-8", MediaType.APPLICATION_JSON_VALUE},
    consumes = {"text/plain;charset=UTF-8", MediaType.APPLICATION_JSON_VALUE})
    public @ResponseBody List<ProduitImmobilierDTO> findAll(@PathVariable("pagesize") int pagesize, @PathVariable("page") int page){
        return userService.findAll(pagesize, page);
    }

Вот мой угловой сервис

  getListProduitImmobilierDTO(pagesize: number, page: number): Observable<ProduitImmobilierDTO[]> {
    const headerDict = {
      'Content-Type': 'application/json',
      Accept: 'application/json',
      'Accept-Charset': 'charset=UTF-8',
      'Access-Control-Allow-Headers': 'Content-Type'
    };

    const requestOptions = {
      headers: new HttpHeaders(headerDict)
    };
    return this.http.get('/api/produitimmobilier/all/' + pagesize + '/' + page, requestOptions).pipe(map((jsonArray: any) =>jsonArray.map((jsonItem) => ProduitImmobilierDTO.fromJson(jsonItem))));
  }

У меня в консоли Firefox есть следующее сообщение об ошибке

error: "Internal Server Error"
​​
message: "Missing URI template variable 'pagesize' for method parameter of type int"
​​
path: "/api/produitimmobilier/all/5/1"
​​
status: 500

Запрос doen 'Т даже не до контроллера Springboot. Вы можете мне помочь?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...