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

  • SEARCH
  • Home
  • 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 6807609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:51:13+00:00 2026-05-26T19:51:13+00:00

In my project we use some img tags like that <img src=url to java

  • 0

In my project we use some img tags like that

<img src="url to java servlet?parameters">

while the servlet responds the bytesteam right away, something like

response.getOutputStream().write(imageBytes);

That all works fine, but is there any way of caching that image in the browser, because it wont cache it automatically like regular url 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-26T19:51:13+00:00Added an answer on May 26, 2026 at 7:51 pm

    You need to set at least the ETag, Last-Modified and Expires headers on the response. The ETag header should represent the unique identifier of the file based on a combination of filename, filesize and lastmodified timestamp). The Last-Modified header should represent the last modified timestamp of the file. The Expires header should inform the client how long it is allowed to keep the file in cache.

    If the cache has been expired in the client side and the ETag or Last-Modified are available, then the client will send a HEAD request to check if the file needs to be renewed. If not, then the Expires will just be postponed again accordingly.

    You can find here a servlet example which handles this all (and download resumes and automatic GZIP): FileServlet supporting resume and GZIP.

    However, if your files are available on the disk file system already (and not in a database), then you should consider just delegating the job to the servletcontainer’s builtin default servlet. See also Reliable data serving.

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

Sidebar

Related Questions

In my current project we use some plugins needed by other plugins parameters like
I would like to use some build parameters from Project 1 in Project 2.
I have a project in which I'd like to use some of the .NET
I'm currently building a project and I would like to make use of some
I use some libraries that I don't want built as part of every project
In CarTrackr project , It use some technique that creates only 1 repository instance
I'll use GWT for my next project but I would like to use some
This is my first project that i need to use some database ( using
I have a Django project that uses SQLAlchemy to use some legacy ORM objects.
i would like to use some classes that are into lib/Varien , my idea

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.