spring-projects / spring-projects/spring-data-rest

Incorrect handling of matrix variables in _links [DATAREST-438]

Open
#818 0 comments 0 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Dec 31, 2020.

type: bug
Dominant language
Java
Stars
958
Forks
568
PR merge metrics
No merged PRs in 30d

Description

Tim te Beek opened DATAREST-438 and commented

I'm using a matrix variable in my repository URLs to set a value for my multi-tenant system, such that the server connects to the correct database, as per the reference URL. This works fine up to a point, with a minor issue that the matrix variables are stripped off, breaking any of the generated links because the variable is now missing.

A bigger issue arises when the matrix variable is used earlier in the URL, as opposed to at the end. In those cases invalid links are created, with duplicated elements:
A request for: http://myservice.com/;bla/genomes/2
Creates self link: http://myservice.com/genomes/2/genomes/2

As stated in the Spring Mvc documentation, inclusion of matrix variables should be valid anywhere in the path:
http://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html#mvc-ann-matrix-variables

Judging from the above, handling of matrix variables in spring data rest therefore seems inconsistent, and broken when used early on in the path. Is this something you can resolve?


Affects: 2.2.1 (Evans SR1)

Reference URL: http://stackoverflow.com/questions/25083710/combine-dynamic-datasource-routing-with-spring-data-rest

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.