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 5957241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:22:22+00:00 2026-05-22T18:22:22+00:00

In Apache HTTP Client (4.x, the successor to commons http 3.x), on HttpClient the

  • 0

In Apache HTTP Client (4.x, the successor to commons http 3.x), on HttpClient the method:

HttpClient.execute(HttpUriRequest request) 

States in the JavaDocs:

“Executes a request using the default context.”

  • What is the default context (referring to an HttpContext object)?
  • How can I configure the default context so I don’t need to pass it on each call to execute()? (I don’t control the call to execute(), but I control creating the HttpClient)
  • 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-22T18:22:22+00:00Added an answer on May 22, 2026 at 6:22 pm

    The default context is configured by the HttpClient implementation that you are using. For implementations based on AbstractHttpClient, the work is done by the createHttpContext() method. Note that a new default context is created for each execute call.

    One way to configure the default context yourself would be to extend one of the existing HttpClient implementation classes and override the method.

    Another way is to set the various parameters that the method uses; e.g. the connection manager’s scheme registry, the authScheme registry, the cookieSpecs registry, the cookie store or the credentials provider.

    For the record, here’s what the DefaultHttpClient.createHttpContext() does:

    @Override
    protected HttpContext createHttpContext() {
        HttpContext context = new BasicHttpContext();
        context.setAttribute(
            ClientContext.SCHEME_REGISTRY, 
            getConnectionManager().getSchemeRegistry());
        context.setAttribute(
            ClientContext.AUTHSCHEME_REGISTRY, 
            getAuthSchemes());
        context.setAttribute(
            ClientContext.COOKIESPEC_REGISTRY, 
            getCookieSpecs());
        context.setAttribute(
            ClientContext.COOKIE_STORE, 
            getCookieStore());
        context.setAttribute(
            ClientContext.CREDS_PROVIDER, 
            getCredentialsProvider());
        return context;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While issuing a GET request using Apache HTTP Client v4, how do I obtain
I am using apache http commons 4.I have added both httpcore-4.0.1.jar and httpclient-4.0.1.jar in
I am using Apache HttpClient and would like to communicate HTTP errors (400 Bad
i am using the apache commons httpclient in a lotus notes java agent and
I am trying to connect to a secure server using Apache Commons HttpClient 3.1
Using Apache's commons-httpclient for Java, what's the best way to add query parameters to
org.apache.http.client.methods.HttpGet; HttpGet method = new HttpGet(url.toExternalForm()); method.getParams() Whare are these params? Are they the
package com.crumbin.tabs; import java.util.ArrayList; import java.util.HashMap; import org.apache.http.client.HttpClient; import android.content.Context; import android.database.Cursor; import android.location.Location;
I am executing following sample program of httpclient of GET method. import org.apache.commons.httpclient.HttpClient; import
Any idea how apache http client handles Retry-After header ? Apache has given default

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.