title: Spring REST: Modifying a response before sending
body: <p>I'm using Spring and RepositoryRestResource to create a REST server. I store image names in the database and this is returned in the rest response. I'd like to send back the entire URL instead of just the image name. </p>
  
  <p>For example, when running locally, the response should be:</p>
  
  <pre><code>{
    image: 'http://localhost:8080/img/products/1.jpg'
  }
  </code></pre>
  
  <p>and when deploying to production, the response should be</p>
  
  <pre><code>{
    image: 'http://prod-server.com/img/products/1.jpg'
  }
  </code></pre>
  
  <p>What I currently get is:</p>
  
  <pre><code>{
    image: '1.jpg'
  }
  </code></pre>
  
  <p>The code is exactly what is here: <a href="https://github.com/spring-projects/spring-boot/tree/master/spring-boot-samples/spring-boot-sample-data-rest" rel="nofollow">https://github.com/spring-projects/spring-boot/tree/master/spring-boot-samples/spring-boot-sample-data-rest</a> except that I have my own Models</p>