You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Sergey Beryozkin (JIRA)" <ji...@apache.org> on 2010/11/06 17:34:07 UTC

[jira] Commented: (CXF-3112) Further problem with cookies in Jax-RS (similar to closed issue 3035)

    [ https://issues.apache.org/jira/browse/CXF-3112?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12929071#action_12929071 ] 

Sergey Beryozkin commented on CXF-3112:
---------------------------------------

I have this test in systests/jaxrs/, :



@Test
    public void testSetCookieWebClient() throws Exception {
        WebClient client = WebClient.create("http://localhost:" + PORT + "/bookstore/setcookies");
        Response r = client.type("*/*").get();
        assertEquals(200, r.getStatus());
        List<Object> cookies = r.getMetadata().get("Set-Cookie");
        assertNotNull(cookies);
        assertEquals(1, cookies.size());
        // just added it locally
        System.out.println(cookies.get(0));
    }

which prints

"bar.com.anoncart=107894933471602436; Domain=.bar.com; Expires=Thu, 01-Oct-2020 23:44:22 GMT; Path=/".

The server code :

 @GET
    @Path("setcookies")
    public Response setComplexCookies() {
        return Response.ok().header("Set-Cookie", 
                                    "bar.com.anoncart=107894933471602436; Domain=.bar.com;"
                                    + " Expires=Thu, 01-Oct-2020 23:44:22 GMT; Path=/")
                                    .build();
    }


Can you give more info please ? 


> Further problem with cookies in Jax-RS (similar to closed issue 3035)
> ---------------------------------------------------------------------
>
>                 Key: CXF-3112
>                 URL: https://issues.apache.org/jira/browse/CXF-3112
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.3.0, 2.2.11
>            Reporter: David Hagar
>
> Prior to version 2.2.11, multiple cookies were not handled properly by the method org.apache.cxf.jaxrs.client.AbstractClient#setResponseBuilder(HttpURLConnection, Exchange) -- this was resolved for some cookies, but it still breaks for others. Specifically, any cookie that contains an "Expires" field now gets split into two objects by the aforementioned method. 
> For example, if the header is:
> Set-Cookie: com.wm.visitor=10789493347; Domain=.walmart.com; Expires=Thu, 01-Oct-2020 23:44:22 GMT; Path=/
> Then response.getMetadata().get("Set-Cookie"); will return an array of length 2, with values = {" com.wm.visitor=10789493347; Domain=.walmart.com; Expires=Thu", "01-Oct-2020 23:44:22 GMT; Path=/"
> I'm pretty sure this is a conflict of the code looking for date related headers conflicting with the code looking for cookie related headers. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.