Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-3154

REST endpoint does not return correct Expiry header for GET opeartion when the key is stored via HotRod or embedded cache

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 5.3.0.Final
    • 5.3.0.Final
    • Server
    • None

      The expiry header is not sent back at all if the entry was stored via HotRod or Embedded cache. It is sent back correctly only if the entry was stored via REST with timToLiveSeconds set.

      The following test fails if added to EmbeddedRestHotRodTest class:

      public void testHotRodEmbeddedPutRestGetExpiry() throws Exception {
            final String key = "8";
            final String key2 = "9";
      
            // 1. Put with HotRod
            assertEquals(null, cacheFactory.getHotRodCache().put(key, "v1", 5, TimeUnit.SECONDS));
      
            // 2. Put with Embedded
            assertEquals(null, cacheFactory.getEmbeddedCache().put(key2, "v2", 5, TimeUnit.SECONDS));
      
            // 3. Get with REST key
            HttpMethod get1 = new GetMethod(cacheFactory.getRestUrl() + "/" + key);
            cacheFactory.getRestClient().executeMethod(get1);
            assertEquals(HttpServletResponse.SC_OK, get1.getStatusCode());
            assertNotNull(get1.getResponseHeader("Expires"));
      //^^^fails here - returns null
      
            // 4. Get with REST key2
            HttpMethod get2 = new GetMethod(cacheFactory.getRestUrl() + "/" + key2);
            cacheFactory.getRestClient().executeMethod(get2);
            assertEquals(HttpServletResponse.SC_OK, get2.getStatusCode());
            assertNotNull(get2.getResponseHeader("Expires"));
      //^^^fails here - returns null
         }
      

            rh-ee-galder Galder ZamarreƱo
            mgencur Martin Gencur
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: