2014-11-29 4 views
0

아래와 같은 링크를 만들려고 할 때.봄에 링크토 캐스팅 문제가 발생했습니다. HATEOAS

Link userLink = linkTo((controllerClass).slash("?location="+location+"&scheduledDepartur="+scheduleDepatur).withRel(USER_REL)); 

그리고 내가

Link selfLink = linkTo(methodOn(controllerClass).getOffTrains(trainStatus, valid, locale).slash("?depatureLocation="+depatureLocation+"&scheduledDepartureDate="+scheduleDepatureDate).withSelfRel()); 

오류 아래 가지고있어

The method slash(String) is undefined for the type Class<TrainController> 

는 시도가 링크 방법을 아래에 사용하는 경우와 같이

The method slash(String) is undefined for the type HttpEntity<TrainStatus>. 

는이 문제를 해결하기 위해 도와 오류 표시 발행물.

답변

0

귀하의 모든 괄호는 꺼져 있습니다.

Link selfLink = linkTo(methodOn(controllerClass).getOffTrains(trainStatus, valid, locale).slash("?depatureLocation="+depatureLocation+"&scheduledDepartureDate="+scheduleDepatureDate).withSelfRel()); 

Link selfLink = linkTo(methodOn(controllerClass).getOffTrains(trainStatus, valid, locale)).slash("?depatureLocation="+depatureLocation+"&scheduledDepartureDate="+scheduleDepatureDate).withSelfRel()); 

나는 당신이 그 쿼리 문자열 매개 변수는 단지 당신을 위해 일 것 method..then getOffTrains 컨트롤러의 방법하지 놀랍해야한다.

+0

명확하게 설명해 주시겠습니까? – Ramkumar