Note that there are some explanatory texts on larger screens.

plurals
  1. POStatus code of the method
    primarykey
    data
    text
    <p>I am executing following sample program of httpclient of "GET" method.</p> <pre><code> import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.params.HttpMethodParams; public class TestMethodStatuscode { public static void main(String[] args) throws Exception { HttpClient client = new HttpClient(); client.getParams().setParameter(HttpMethodParams.USER_AGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 (.NET CLR 3.5.30729)"); //client.getParams().setCookiePolicy(org.apache.http.client.params.CookiePolicy.BROWSER_COMPATIBILITY); GetMethod get = new GetMethod("http://de.mg40.mail.yahoo.com/neo/launch?.rand=80g4u84m26ifl"); //get_siteurl.getParams().setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY); client.executeMethod(get); System.out.println("Status code: "+get.getStatusCode()); //System.out.println(get.getResponseBodyAsString()); get.releaseConnection(); } </code></pre> <p>}</p> <p>output:- Status code: 200</p> <p>The url I am trying to fetch is some url which I get during process of login to <code>yahoo.de</code> email account (login to <code>yahoo.de</code> did not work for me so was trying this code). If I enable wireshark (filter-http or <code>(http.request.method == POST or http.request.method == GET)</code> and then type this url in browser , press enter and finally I notice in wireshark that the return code of the above url is <code>302</code> which means it is redirected. </p> <p>Also when I run my program and check in wireshark, I see that method returns the code <code>302</code>. So my queston is why it is giving me <code>200</code> as a statuscode as output and not <code>302</code> ?</p>
    singulars
    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.
    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