[infinispan-issues] [JBoss JIRA] (ISPN-3154) REST endpoint does not return correct Expiry header when the key is stored via HotRod or embedded cache
Martin Gencur (JIRA)
jira-events at lists.jboss.org
Thu May 30 07:38:55 EDT 2013
[ https://issues.jboss.org/browse/ISPN-3154?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12778171#comment-12778171 ]
Martin Gencur commented on ISPN-3154:
-------------------------------------
This problem only appears when using Get requests and String values, it works correctly for Head requests.
Changing this line (https://github.com/infinispan/infinispan/blob/master/server/rest/src/main/scala/org/infinispan/rest/Server.scala#L153) to the following fixes the problem for me:
{code}
case s: String => {
Response.ok(s, "text/plain")
.lastModified(lastMod)
.expires(expires)
.build
}
{code}
> REST endpoint does not return correct Expiry header when the key is stored via HotRod or embedded cache
> -------------------------------------------------------------------------------------------------------
>
> Key: ISPN-3154
> URL: https://issues.jboss.org/browse/ISPN-3154
> Project: Infinispan
> Issue Type: Bug
> Components: Server
> Affects Versions: 5.3.0.Beta2
> Reporter: Martin Gencur
> Assignee: Galder ZamarreƱo
> Fix For: 5.3.0.Final
>
>
> 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:
> {code:java}
> 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
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the infinispan-issues
mailing list