spring hateoas 1.1.0 基本 rel 路径被截断
spring hateoas 1.1.0 base rel path getting truncated
我最近将我们的应用程序升级到 Spring Boot 2.3.2.RELEASE,它使用 Spring Hateoas 1.1.0.RELEASE.
我对任何 link 的基本 rel 路径是:“urn:eim:linkrel:”
使用 Spring Boot 2.2.6.RELEASE,响应如下:
{
"_links": {
"urn:eim:linkrel:users": {
"href": "https://localhost:8080/v1/users"
}
}
}
使用 Spring Boot 2.3.2.RELEASE,响应更改如下:
{
"_links": {
"urn:eim": {
"href": "https://localhost:8080/v1/users"
}
}
}
我生成上述响应的代码:
import javax.servlet.http.HttpServletRequest;
import org.springframework.hateoas.Link;
import org.springframework.hateoas.RepresentationModel;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class DemoController {
@RequestMapping(value = "/service", method = RequestMethod.GET, produces = "application/hal+json")
public HttpEntity<RepresentationModel<?>> service(HttpServletRequest request) {
RepresentationModel<?> service = new RepresentationModel<>();
service.add(Link.of("https://localhost:8080/v1/users", "urn:eim:linkrel:users"));
return new ResponseEntity<>(service, HttpStatus.OK);
}
}
有没有人有类似的问题?谁能告诉我解决此问题的方法。
根据Github issue,此问题(支持多个冒号)已修复,将在里程碑 1.2.0-M1 中发布。
我看到修复提交在分支 1 中。1.x。我想修复可能包含在修复版本 1.1.1 中。
我最近将我们的应用程序升级到 Spring Boot 2.3.2.RELEASE,它使用 Spring Hateoas 1.1.0.RELEASE.
我对任何 link 的基本 rel 路径是:“urn:eim:linkrel:”
使用 Spring Boot 2.2.6.RELEASE,响应如下:
{
"_links": {
"urn:eim:linkrel:users": {
"href": "https://localhost:8080/v1/users"
}
}
}
使用 Spring Boot 2.3.2.RELEASE,响应更改如下:
{
"_links": {
"urn:eim": {
"href": "https://localhost:8080/v1/users"
}
}
}
我生成上述响应的代码:
import javax.servlet.http.HttpServletRequest;
import org.springframework.hateoas.Link;
import org.springframework.hateoas.RepresentationModel;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class DemoController {
@RequestMapping(value = "/service", method = RequestMethod.GET, produces = "application/hal+json")
public HttpEntity<RepresentationModel<?>> service(HttpServletRequest request) {
RepresentationModel<?> service = new RepresentationModel<>();
service.add(Link.of("https://localhost:8080/v1/users", "urn:eim:linkrel:users"));
return new ResponseEntity<>(service, HttpStatus.OK);
}
}
有没有人有类似的问题?谁能告诉我解决此问题的方法。
根据Github issue,此问题(支持多个冒号)已修复,将在里程碑 1.2.0-M1 中发布。
我看到修复提交在分支 1 中。1.x。我想修复可能包含在修复版本 1.1.1 中。