spring-projects / spring-projects/spring-data-commons

@EnableSpringDataWebSupport and Spring 4.1 mvcUrl JSP tag are difficult to combine [DATACMNS-573]

Open
#1,040 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

in: core status: ideal-for-contribution type: enhancement
Dominant language
Java
Stars
838
Forks
730
PR merge metrics
No merged PRs in 30d

Description

Hans Desmet opened DATACMNS-573 and commented

@EnableSpringDataWebSupport allows to specify an entity where the browsers sends an entity identifier:

@Controller
class ClientController {
  @RequestMapping(value = "/clients/{client}", method = RequestMethod.GET)
  ModelAndView get(@PathVariable Client client) {
  }
}

accepts a request to /clients/1 and converts 1 to the {8Client}} entity with id 1 by reading this entity from the database.

You can however not refer to this method with the new mvcUrl JSP tag in Spring 4.1:

${s:mvcUrl('CC#get').arg(0,1).build()}

because you feed the first parameter an Integer value 1, which is not compatible with real the type of the parameter Client and mvcUrl does not know about the automatic conversion provided by @EnableSpringDataWebSupport.


Affects: 1.8.4 (Dijkstra SR4)

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 by tracing how @EnableSpringDataWebSupport converts path-variable identifiers and how the Spring 4.1 mvcUrl JSP tag resolves method arguments. Reproduce the ClientController example with mvcUrl('CC#get').arg(0,1).build(). Done means the URL can be generated for an entity identifier without requiring a Client object directly.

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
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.