问题描述
我正在使用 Spring Data Rest 存储库来保存对象。 我有两个对象之间的 ManyToMany 关系。 链接请求载荷如下
Content-type: text/uri-list
{
https://server-fqdn/teams/TEAM 3
}
这给出了以下例外
java.lang.IllegalArgumentException: Illegal character in path at index 87: https://server-fqdn/teams/TEAM 3
at java.net.URI.create(URI.java:852) ~[na:1.8.0_242]
at org.springframework.hateoas.UriTemplate.expand(UriTemplate.java:194) ~[spring-hateoas-0.23.0.RELEASE.jar!/:na]
at org.springframework.hateoas.Link.expand(Link.java:176) ~[spring-hateoas-0.23.0.RELEASE.jar!/:na]
at org.springframework.data.rest.webmvc.RepositoryPropertyReferenceController.loadPropertyValue(RepositoryPropertyReferenceController.java:420) ~[spring-data-rest-webmvc-2.6.20.RELEASE.jar!/:na]
at org.springframework.data.rest.webmvc.RepositoryPropertyReferenceController.access$200(RepositoryPropertyReferenceController.java:77) ~[spring-data-rest-webmvc-2.6.20.RELEASE.jar!/:na]
at org.springframework.data.rest.webmvc.RepositoryPropertyReferenceController$4.apply(RepositoryPropertyReferenceController.java:308) ~[spring-data-rest-webmvc-2.6.20.RELEASE.jar!/:na]
at org.springframework.data.rest.webmvc.RepositoryPropertyReferenceController$4.apply(RepositoryPropertyReferenceController.java:294) ~[spring-data-rest-webmvc-2.6.20.RELEASE.jar!/:na]
at org.springframework.data.rest.webmvc.RepositoryPropertyReferenceController.doWithReferencedProperty(RepositoryPropertyReferenceController.java:449) ~[spring-data-rest-webmvc-2.6.20.RELEASE.jar!/:na]
at org.springframework.data.rest.webmvc.RepositoryPropertyReferenceController.createPropertyReference(RepositoryPropertyReferenceController.java:350) ~[spring-data-rest-webmvc-2.6.20.RELEASE.jar!/:na]
为了解决这个问题,我们将编码的 url 作为有效负载传递
Content-type: text/uri-list
{
https://server-fqdn/teams/ TEAM%203
}
但是 Sprint Data Rest 在持久化到数据库之前不会对其进行解码。 有人可以帮忙吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)