Should HttpURLConnection with CookieManager automatically handle session cookies?

前端 未结 1 443
执笔经年
执笔经年 2020-12-07 15:19

I have a Java application (JDK 1.7.0_13) and am using java.net.HttpURLConnection to connect to some servlet based services that do session management. I am trying to figure

相关标签:
1条回答
  • 2020-12-07 15:34

    I run your code and replace this

    CookieHandler.setDefault(new CookieManager()); 
    

    by

    CookieHandler.setDefault( new CookieManager( null, CookiePolicy.ACCEPT_ALL ) );
    

    It work!

    0 讨论(0)
提交回复
热议问题