Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8146450

Java Web Start resource cache doesn't store all HTTP response headers

    Details

    • Subcomponent:
    • Resolved In Build:
      b105
    • CPU:
      x86_64
    • OS:
      linux

      Description

      FULL PRODUCT VERSION :
      java version "1.8.0_65"
      Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
      Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)

      Java(TM) Web Start 11.65.2.17-fcs


      ADDITIONAL OS VERSION INFORMATION :
      Linux lubuntu 4.2.0-22-generic #27-Ubuntu SMP Thu Dec 17 22:57:08 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
      Microsoft Windows [Version 10.0.10586]

      A DESCRIPTION OF THE PROBLEM :
      When fetching remote resource, such as:
      https://ecn.t3.tiles.virtualearth.net/tiles/a132022301030030201.jpeg?g=4810

      With empty Java cache, I get following headers:
      Server: Microsoft-IIS/8.5
      Access-Control-Allow-Origin: *
      Connection: keep-alive
      X-VE-TFE: DB40190734
      Last-Modified: Thu, 14 May 2015 15:53:56 GMT
      X-VE-TBE: DB40251634
      Date: Thu, 31 Dec 2015 18:54:11 GMT
      Cache-Control: public, max-age=31502169
      X-VE-TILEMETA-CaptureDatesRange: 5/12/2009-6/17/2009
      ETag: "3510"
      X-AspNet-Version: 4.0.30319
      Expires: Fri, 30 Dec 2016 09:30:20 GMT
      Content-Length: 24993
      X-VE-TILEMETA-Product-IDs: 138
      X-Powered-By: ASP.NET
      Content-Type: image/jpeg


      But on the second call (served from JWS cache) I get following headers:
      date: Thu, 31 Dec 2015 18:55:26 GMT
      content-length: 1033
      server: Microsoft-IIS/8.5
      expires: Fri, 01 Jan 2016 13:29:40 GMT
      content-type: image/png
      cache-control: private, max-age=66854

      I'm missing all X-* header and ETag headers.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. compile provided code and execute it under Java Web Start with resource caching enabled
      2. On second call, the application will fail, as ETag header is not present

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      No matter, if file is served from Java cache or directly from server, all headers should be returned
      ACTUAL -
      Only limited list of headers is returned

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.io.IOException;
      import java.net.MalformedURLException;
      import java.net.URL;
      import java.net.URLConnection;
      import java.util.List;
      import java.util.Map.Entry;

      public class TestHeaders {

      public static void main(String[] args) throws MalformedURLException, IOException {
      String url;
      url = "https://ecn.t3.tiles.virtualearth.net/tiles/a132022301030030201.jpeg?g=4810";
      String header = "ETag";
      URLConnection urlConn = new URL(url).openConnection();
      urlConn.setUseCaches(true);
      for (Entry<String, List<String>> e: urlConn.getHeaderFields().entrySet()) {
      System.out.println(e.getKey() + ": " + e.getValue().toString());
      }

      if (urlConn.getHeaderField(header) == null) {
      throw new AssertionError(header + " not present");
      }
      }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      The workaround is to set:
      urlConn.setUseCache(false);

      But this will force delivery of the resource passing all the caches of the proxies in between which is undesirable, as they properly cache all of the headers.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dtitov Daniil Titov
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: