Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6978343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:44:35+00:00 2026-05-27T17:44:35+00:00

My HttpClient, HttpPost, or HttpGet method is only working once. I can successfully log

  • 0

My HttpClient, HttpPost, or HttpGet method is only working once. I can successfully log in an get html from the response the first time, but when I try and log in a second time, the html is blank and I am not even getting a response. What’s wrong?

    public void parseDoc() {
    new Thread(new Runnable() {

        @Override
        public void run() {
            sting.loadData("<p></p>", "text/html", null);
            HttpParams params = new BasicHttpParams();
            HttpClientParams.setRedirecting(params, true);
            httpclient = new DefaultHttpClient();

            httppost = new HttpPost(
                    "https://secure.groupfusion.net/processlogin.php");
            String HTML = "";
            try {
                List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(
                        3);
                nameValuePairs
                        .add(new BasicNameValuePair(
                                "referral_page",
                                "/modules/gradebook/ui/gradebook.phtml?type=student_view&jli=t&jli=t&jli=t&jli=t&jli=t&jli=t&printable=FALSE&portrait_or_landscape=portrait"));
                nameValuePairs.add(new BasicNameValuePair("currDomain",
                        "beardenhs.knoxschools.org"));
                nameValuePairs
                        .add(new BasicNameValuePair("username", user));
                nameValuePairs
                        .add(new BasicNameValuePair("password", pass));
                httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

                HttpResponse response = httpclient.execute(httppost);
                HTML = EntityUtils.toString(response.getEntity());
                Document doc = Jsoup.parse(HTML);
                Element link = doc.select("a").first();
                linkHref = link.attr("href");
                HttpGet request = new HttpGet();
                try {
                    request.setURI(new URI(linkHref));

                } catch (URISyntaxException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                response = httpclient.execute(request);

                InputStream in = response.getEntity().getContent();
                BufferedReader reader = new BufferedReader(
                        new InputStreamReader(in));
                StringBuilder str = new StringBuilder();
                String line = null;
                while ((line = reader.readLine()) != null) {
                    str.append(line);
                }
                in.close();
                HTML = str.toString();
                doc = Jsoup.parse(HTML);
                Elements divs = doc.getElementsByTag("tbody");
                for (Element d : divs) {
                    if (i == 2) {
                        finishGrades();
                        f++;
                        break;
                    }
                    i++;
                    ggg = d.html();

                }

            } catch (ClientProtocolException e) {
            } catch (IOException e) {
            }

        }
    }).start();

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T17:44:37+00:00Added an answer on May 27, 2026 at 5:44 pm

    OK, I’m not an android person. Have never owned a smartphone. (Never used FB either!) So this is more of a question than an answer. Writing question here is easier than typing in the comments section, especially paragraphing.

    Is there any reason you do not close or release the http connection? I am asking because I tend to have to close/release my connections. Except, when I was experimenting with long polling the server. Is that how android programming works?

    Is the android a single thread or multi-threaded architecture? What happens when you have two threads trying to open a connection? Will the first thread block the second, especially when the first thread refuses to relinquish the connection?

    What happens if you closed or released the connection at the intended end of each request?

    What does it mean when you login/logout. Would logging out release/close the connection? Do you specifically logout so that the server closes the connection or is the connection still alive?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am retrieving the whole html and javascript of a page I get from
I'm using HttpGet method for retrieving data from a web service in my Android
I am trying to get a JSON response from our server and the response
I am trying get content from the link https://....com:8455 where Server's certificate is not
Java Code: HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost( http://localhost/SC/upload.php); FileBody
this is my .java HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(http://*******.com/mobileproject/updateclass.php);
I use Apache's DefaultHttpClient() with the execute(HttpPost post) method to make a http POST.
Device is a Xoom Tablet. For some reason I can't do a HttpPost, when
I am using HTTPClient to make a web request. From the linux part, using
I want to login my gmail and get the contact list automatically with httpClient,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.