Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring 链接到春季HATEOAS中的演员问题_Spring_Rest_Link To_Hateoas - Fatal编程技术网

Spring 链接到春季HATEOAS中的演员问题

Spring 链接到春季HATEOAS中的演员问题,spring,rest,link-to,hateoas,Spring,Rest,Link To,Hateoas,当我尝试形成如下链接时 Link userLink = linkTo((controllerClass).slash("?location="+location+"&scheduledDepartur="+scheduleDepatur).withRel(USER_REL)); 它将错误显示为 The method slash(String) is undefined for the type Class<TrainController> 得到下面的错误 The meth

当我尝试形成如下链接时

Link userLink = linkTo((controllerClass).slash("?location="+location+"&scheduledDepartur="+scheduleDepatur).withRel(USER_REL));
它将错误显示为

The method slash(String) is undefined for the type Class<TrainController>
得到下面的错误

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

请帮助我解决此问题。

所有括号都已关闭

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());
我很惊讶您拥有的那些查询字符串参数不是getOffTrains控制器方法上的方法。那么它就适合您了

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