spring-projects / spring-projects/spring-hateoas

ControllerLinkBuilder do not take into account path extensions in generated links

Open
#261 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.1k
Forks
476
PR merge metrics
No merged PRs in 30d

Description

The ControllerLinkBuilder do not take into account the path extension if this is used instead of specifying the requested format using a Accept header.

Given the request mapping "/path/entity/{id}" and springs content-negotiation configured to support both Accept header and path-extensions, I would expect that the links generated for the response when accessing the URL with a path extension actually includes the path extension in the links created by ControllerLinkBuilder. This is not the case. Is this by design? I understand that links/uris identifying resources should be unaware of content-types, but in the context of a request using path extensions it would be more practical if the client could navigate the links without manually appending the path extension.

For example would the response to the request "/path/entity/123.json" include a self-rel link to "/path/entity/123", forcing the client to manually add the .json extension for the link to be usable in the current context of the client.

Contributor guide

No contributing guide indexed for this repository

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.

Research direction

Start at ControllerLinkBuilder and trace how links are generated for requests using path extensions versus Accept headers. Compare the generated link with the request URI in the example, then determine and document the expected behavior for path-extension links; no test or source file is named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.