spring-projects / spring-projects/spring-hateoas

Consider instance-based alternative for ControllerLinkBuilder static methods

Open
#420 0 comments 6 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

There are cases when there is no ThreadLocal request context (e.g. SPR-13743, SPR-12800) and other cases where the base path needs to be customized (e.g. SPR-12617). For such use cases consider providing an option to create a ControllerLinkBiulder with a "base" UriComponentsBuilder to use instead of relying on ServletUriComponentsBuilder.fromServletMapping(request) along with instance-based variants of the presently static methods. In effect use of the "current request" becomes optional. This is something we've already done for MvcUriComponentsBuilder in the Spring Framework as an example.

The original request was created in the Spring Framework JIRA as SPR-13743. We can't do anything so I'm "moving" it here.

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 with ControllerLinkBuilder's static methods and compare them with the instance-based approach already used by MvcUriComponentsBuilder in the Spring Framework. Define how a base UriComponentsBuilder replaces the current-request lookup and identify the corresponding instance variants. Done means callers can use a customized base or no request context while existing static behavior remains available.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.