Skip to content

Issue generating links off of request mapping in parent class #20

@elennick

Description

@elennick

I am running into a problem generating links off of routes in a specific scenario. I have a controller method in an abstract parent class that has a signature like this:

    @RequestMapping(method = RequestMethod.GET)
    public HttpEntity<CollectionResource> getCollection(
            @RequestParam(name = "offset") Integer offset,
            @RequestParam(name = "size") Integer size,
            @RequestParam(name = "sort") String sort,
            @RequestParam(name = "q") String q,
            @RequestParam(name = "filter") T filter)

...where T is a generic parameter specified by what is subclassing this parent class. In another unrelated resource, I link to the child class using AffordanceBuilder like so:

        Affordance links = AffordanceBuilder.linkTo(methodOn(
                ChildController.class)
                .getCollection(null, null, null, null, null))
                .withRel("resourcerelation");

What gets generated winds up looking like this:

href: "http://localhost:8080/apinull{?offset,size,sort,q,filter}"

...the obvious issue being that while the base url, context root and uri template all get generated properly, the path is coming through as "null".

Let me know if I can give more specific details about this or create a quick example app that demonstrates it. There is a lot more code around this than what I posted that could possibly have an effect.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions