[infinispan-issues] [JBoss JIRA] (ISPN-3770) Incorrect Content-Type header when putting object via REST and get with different Accept

Galder Zamarreño (JIRA) issues at jboss.org
Wed Dec 11 11:30:33 EST 2013


    [ https://issues.jboss.org/browse/ISPN-3770?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12930447#comment-12930447 ] 

Galder Zamarreño commented on ISPN-3770:
----------------------------------------

Hmmm, I had the chance to look into this more closely. We have [tests|https://github.com/infinispan/infinispan/blob/master/integrationtests/compatibility-mode-it/src/test/java/org/infinispan/it/compatibility/EmbeddedRestHotRodTest.java] where we put a custom Serializable object via Hot Rod, and we can retrieve it via REST using json/xml easily. I don't see why the same should not be possible if the serialized object was stored via REST. Reopening and assigning it to myself to investigate more deeply.
                
> Incorrect Content-Type header when putting object via REST and get with different Accept
> ----------------------------------------------------------------------------------------
>
>                 Key: ISPN-3770
>                 URL: https://issues.jboss.org/browse/ISPN-3770
>             Project: Infinispan
>          Issue Type: Bug
>          Components: Server
>            Reporter: Jiří Holuša
>            Assignee: Mircea Markus
>
> When putting serialized object via REST post and then getting it back with different Accept header (for example application/json), the retrieved data has still the "creation-time" Content-Type and data doesn't change in any way.
> I would expect retrieving nice json structure for instace.
> Code snippet:
> {code}
> public void testCustomObjectGetAcceptJSONAndXML() throws Exception{
>         String fullPathKeyA = fullPathKey(KEY_A);
>         TestSerializable object = new TestSerializable("CONTENT");
>         ByteArrayOutputStream bout = new ByteArrayOutputStream();
>         ObjectOutputStream oo = new ObjectOutputStream(bout);
>         oo.writeObject(object);
>         oo.flush();
>         oo.close();
>         byte[] byteData = bout.toByteArray();
>         post(fullPathKeyA, byteData, "application/x-java-serialized-object");
>         HttpResponse getJson = get(fullPathKeyA, null, HttpServletResponse.SC_OK, true, "Accept", "application/json");
>         assertTrue(getJson.getHeaders("Content-type")[0].getValue().contains("application/json")); //this assertion fails
>         HttpResponse getXml = get(fullPathKeyA, null, HttpServletResponse.SC_OK, true, "Accept", "application/xml");
>         assertTrue(getXml.getHeaders("Content-type")[0].getValue().contains("application/xml")); //this assertion fails
>     }  
> {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