title: How to add query string parameters with Spring HATEOAS?
body: <p>I'm trying to generate a link to search resources. So, I want to create a resource that provides a link to my search:</p>
  
  <pre><code>POST /resourcesearch
  {param1: "value1",param2:"value2"}
  </code></pre>
  
  <p>The response should be:</p>
  
  <pre><code>{"links":[
    {
      "rel":"self",
      "href":"http://localhost:8080/resourcesearch"
    },
    {
      "rel":"resources",
      "href":"http://localhost:8080/resources?param1=value1&amp;param2=value2"
    }
  }
  </code></pre>
  
  <p>Here is my code:</p>
  
  <pre><code>@Controller
  @RequestMapping("/resourcesearch")
  public class ResourceSearchController{
    @RequestMapping(method = RequestMethod.POST) 
    public ResponseEntity&lt;ResourceSupport&gt; createResourceSearch(@RequestBody ResourceDTO dto){
      ResourceSupport resource = new ResourceSupport();
      //... do something here to build query string based on "dto"
      resource.add(linkTo(ResourceController.class).withRel("resources"));
      return new ResponseEntity&lt;ResourceSupport&gt;(resource, HttpStatus.CREATED);
    }
  }
  ===========================================
  @Controller
  @RequestMapping("/resources")
  public class ResourceController{
    @RequestMapping(method = RequestMethod.GET)
    public ResponseEntity&lt;CollectionDTO&gt; listResources(@RequestParam("param1") String param1, @RequestParam("param2") String param2){
      ...
    }
  }
  </code></pre>
  
  <p>The thing is that I can't figure out how to add query string parameters to the url in the line:</p>
  
  <pre><code>resource.add(linkTo(ResourceController.class).withRel("resources"));
  </code></pre>
  
  <p>Because the result of that line is:</p>
  
  <pre><code>{
    "links" : [
      {
        "rel":"resources",
        "href":"http://localhost:8080/resources"
      }
    ]
  }
  </code></pre>
  
  <p>Any ideas?</p>