Problem cookies values with double quote

maco
2009-04-17
2013-04-26
  • maco
    maco
    2009-04-17

    Hi,

    I use httpunit to receive response with cookies, I must receive two cookies but httpunit divide in three.
    This special behavior occurs when i use GlassFish Server, in WAS6 no pass. When the cookie has == and white space characters, GlassFish puts double quote in NewUniversalCookie, in the beginning and at the end.

    HttpUnit receive this response

    Response Headers    Value
    (Status-Line)    HTTP/1.1 200 OK
    X-Powered-By    Servlet/2.5
    Server    Sun GlassFish Enterprise Server v2.1
    Set-Cookie    UniversalCookie=a0775c7168f6a91a69874c7587a4#1239806798590#3600000#U2FsdGVkX18zzhi1qcuSkfug0hwqix7iEPw0tIEX3LXp1BSvhTufTMrFw1bdzw3+BREXfDsO8TsM-rTR9YLtX+4LXZ+CQBcTc6mOfu4MTlGYHZSrLVYNfp8kW/SNBKDSYbf4xuPkABmIz/xJHez0fjY3u-+oZqatr4BCEZyGUX0kN0R3nCxMkqug==; Path=/
    Set-Cookie    NewUniversalCookie="mmmmmmmmmmmmmmm==mmmmmmm mmmmmmm"; Path=/
    Content-Type    text/html; charset=iso-8859-1
    Transfer-Encoding    chunked
    Date    Thu, 16 Apr 2009 13:49:25 GMT

    But when I trace the result.

    Code

            String[] headersNames = response.getHeaderFieldNames();
            for (int i = 0; i < headersNames.length;i++) {
                String header = (String)headersNames[i];
                System.out.println("header[" + i + "]: " + header + " : " + response.getHeaderField(header));           
            }
           
           
            String[] cookieNames = response.getNewCookieNames();
            for (int i = 0; i < cookieNames.length;i++) {
                String cookie = (String)cookieNames[i];
                System.out.println("cookie[" + i + "]: " + cookie + " : " + response.getNewCookieValue(cookie));           
            }

    Trace

    header[0]: CONTENT-TYPE : text/html; charset=iso-8859-1
    header[1]: TRANSFER-ENCODING : chunked
    header[2]: SERVER : Sun GlassFish Enterprise Server v2.1
    header[3]: X-POWERED-BY : Servlet/2.5
    header[4]: DATE : Thu, 16 Apr 2009 13:49:25 GMT
    header[5]: SET-COOKIE : UniversalCookie=a0775c7168f6a91a69874c7587a4#1239806798590#3600000#U2FsdGVkX18zzhi1qcuSkfug0hwqix7iEPw0tIEX3LXp1BSvhTufTMrFw1bdzw3+BREXfDsO8TsM-rTR9YLtX+4LXZ+CQBcTc6mOfu4MTlGYHZSrLVYNfp8kW/SNBKDSYbf4xuPkABmIz/xJHez0fjY3u-+oZqatr4BCEZyGUX0kN0R3nCxMkqug==; Path=/
    cookie[0]: UniversalCookie : a0775c7168f6a91a69874c7587a4#1239806798590#3600000#U2FsdGVkX18zzhi1qcuSkfug0hwqix7iEPw0tIEX3LXp1BSvhTufTMrFw1bdzw3+BREXfDsO8TsM-rTR9YLtX+4LXZ+CQBcTc6mOfu4MTlGYHZSrLVYNfp8kW/SNBKDSYbf4xuPkABmIz/xJHez0fjY3u-+oZqatr4BCEZyGUX0kN0R3nCxMkqug==
    cookie[1]: mmmmmmmmmmmmmmm : =mmmmmmm mmmmmmm
    cookie[2]: NewUniversalCookie :

    NewUniversalCookie has value null and HttpUnit create a new cookie mmmmmmmmmmmmmmm with value =mmmmmmm mmmmmmm

    Are there some form to use double quote in cookies with HttpUnit?.

    And another question

    getHeaderFieldNames() method return only one SET-COOKIE name but i have two Set-Cookie.

    Thanks.