Note that there are some explanatory texts on larger screens.

plurals
  1. POCookie not showing (apache httpclient v4)
    primarykey
    data
    text
    <pre><code> private static CookieStore cookieStore = new BasicCookieStore(); private HttpClient client = new DefaultHttpClient(); private static HttpContext httpContext = new BasicHttpContext(); public static void main(String[] args) throws Exception { String url = "http://www.codechef.com"; String account = "http://www.codechef.com/node?destination=node"; httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); List&lt;NameValuePair&gt; postParams = http.getFormParams(); sendPost(url, postParams); } private void sendPost(String url, List&lt;NameValuePair&gt; postParams) throws Exception { HttpPost post = new HttpPost(url); post.setHeader("Accept","text/plain"); post.setHeader("Accept-Language", "en-US"); post.setHeader("Connection", "keep-alive"); post.setEntity(new UrlEncodedFormEntity(postParams)); HttpResponse response = client.execute(post,httpContext); List&lt;Cookie&gt; cook=cookieStore.getCookies(); if(cook==null) System.out.println("Null"); else{ System.out.println(cook.size()); for(Cookie c:cook){ String cookieReader=c.getName()+" = "+c.getValue()+";domain= "+c.getDomain(); System.out.println(cookieReader); } } } public List&lt;NameValuePair&gt; getFormParams() throws UnsupportedEncodingException { List&lt;NameValuePair&gt; paramList = new ArrayList&lt;NameValuePair&gt;(); paramList.add(new BasicNameValuePair("name","name")); paramList.add(new BasicNameValuePair("pass","pass")); return paramList; } </code></pre> <p>After the post method, the size of the cookie is 0, but I checked from the browser, and it shows sessionID cookie. But I cannot extract it using this code to authenticate user. Thank you.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload