Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6991937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:34:11+00:00 2026-05-27T19:34:11+00:00

I have a bit of code like this in my template: #{list people, as:’person’}

  • 0

I have a bit of code like this in my template:

#{list people, as:'person'}
    <img src="@@{Application.image(person.id)}">
#{/list}

After starting up the play server, the list shows the first image multiple times. So for example, if the people variable contained the ids of 1, 2, 3, 4, 5 – then there will be five images shown but they are all the same image: that of the image corresponding to the id of 1.

If I hit refresh, the images all change to be unique depending on their ids. The html rendered from the template looks like this:

<img src="http://url/application/image?personId=1"/>
<img src="http://url/application/image?personId=2"/>
<img src="http://url/application/image?personId=3"/>
<img src="http://url/application/image?personId=4"/>
<img src="http://url/application/image?personId=5"/>

How can I stop the template from showing the same image first time round?

Edit: Also tried adding the response headers seen below prior to the renderBinary(image) call in my controller that responds to the src request:

...
response.setHeader("Pragma-directive", "no-cache");
response.setHeader("Cache-directive", "no-cache");
response.setHeader("Cache-control", "no-cache");
response.setHeader("Pragma", "no-cache");
response.setHeader("Expires", "0");
renderBinary(imageFile);

as per this post. It actually worked the first couple of times but then the third time after stopping and starting the Play server, I had the same caching issue where all the images showed the same image despite the differing personIds. I have also appended the timestamp to the end of the url without any luck.

Edit #2: I also tried changing the http.cacheControl property to 0 in the application.conf:

http.cacheControl=0

But it again gave me inconsistent results as to whether it showed the right or wrong images.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T19:34:12+00:00Added an answer on May 27, 2026 at 7:34 pm

    I’m not sure if this is a viable solution, but I’ve got a work around for now that seems to work (well, it hasn’t failed on me just yet) by doing these things:

    • Set the cache-control prior to the renderBinary(…) call in the Controller

      response.setHeader("Cache-Control", "no-cache");

    • Convert the File that you are rendering to a FileInputStream and pass that to the renderBinary(…) method instead of the File directly.

    Like this:

    File fileImage = ... // some .png image
    FileInputStream stream = new FileInputStream(fileImage);
    renderBinary(stream);
    

    I got the idea from seeing this bug report about caching and rendering binaries.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a bit of php code like this: $test = <!--my comment goes
I have this bit of code, public static List<string> GetSentencesFromWords(List<string> words, string fileContents) {
I have some templates that look roughly like this: <template name=items> <div class=item-list> {{#each
We have some code that looks like this: class Serializer { public: template<class Type>
I have a bunch of code in a routine that looks a bit like
I have this bit of code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data;
i have this bit of code, it limits the Li's to 15 of them
So I have this bit of code for x in range(x1,x2): for y in
I have a bit of sample code that is throwing this warning: main.c: In
I have an email template where the user can enter text like this: Hello

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.