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

baseUri handling broken [DATAREST-84]

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

Nobody has claimed this yet.

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

Description

Oliver Drotbohm opened DATAREST-84 and commented

Suppose we have a DispatcherServlet registered to bootstrap SD REST configuration and mapped to /. Our Spring Data REST configuration adds a baseUri of api. This results in the following:

  • browse to / and you still get the repositories listed. Expected: / should not be handled by Spring Data REST, /api/ should.
  • the response for / returns links correctly prepended with /api/ but following them results in a 404.

Both of the issues seem to be rooted in RepositoryRestHandlerMapping. It exposes the root resource for an empty request URI where it should do so for the baseUri if configured. For a call to a repository URI, the usage of the ResourceMapping does not consider the baseUri neither


Affects: 1.1.0.M1

1 votes, 3 watchers

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.

Research direction

Start with RepositoryRestHandlerMapping and the ResourceMapping usage described in the issue. Reproduce the configured baseUri scenario with a DispatcherServlet mapped to /, then verify that / is not handled, /api/ serves the root resource, and repository links resolve instead of returning 404.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.