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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:47:27+00:00 2026-05-16T18:47:27+00:00

I wand to develop http client in Java for college project which login to

  • 0

I wand to develop http client in Java for college project which login to site, obtain data from HTML data, complete and send forms.
I don’t know which http lib to use :
Apache HTTP client – don’t create DOM model but work with http redirects, multi threading.
HTTPUnit – create DOM model and is easy to work with forms, fields, tables etc. but I don’t know how will work with multi-threading and proxy settings.

Any advice ?

  • 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-16T18:47:28+00:00Added an answer on May 16, 2026 at 6:47 pm

    It sounds like you are trying to create a web-scraping application. For this purpose, I recommend the HtmlUnit library.

    It makes it easy to work with forms, proxies, and data embedded in web pages. Under the hood I think it uses Apache’s HttpClient to handle HTTP requests, but this is probably too low-level for you to be worried about.

    With this library you can control a web page in Java the same way you would control it in a web browser: clicking a button, typing text, selecting values.

    Here are some examples from HtmlUnit’s getting started page:

    Submitting a form:

    @Test
    public void submittingForm() throws Exception {
        final WebClient webClient = new WebClient();
    
        // Get the first page
        final HtmlPage page1 = webClient.getPage("http://some_url");
    
        // Get the form that we are dealing with and within that form, 
        // find the submit button and the field that we want to change.
        final HtmlForm form = page1.getFormByName("myform");
    
        final HtmlSubmitInput button = form.getInputByName("submitbutton");
        final HtmlTextInput textField = form.getInputByName("userid");
    
        // Change the value of the text field
        textField.setValueAttribute("root");
    
        // Now submit the form by clicking the button and get back the second page.
        final HtmlPage page2 = button.click();
    
        webClient.closeAllWindows();
    }
    

    Using a proxy server:

    @Test
    public void homePage_proxy() throws Exception {
        final WebClient webClient = new WebClient(BrowserVersion.FIREFOX_2, "http://myproxyserver", myProxyPort);
    
        //set proxy username and password 
        final DefaultCredentialsProvider credentialsProvider = (DefaultCredentialsProvider) webClient.getCredentialsProvider();
        credentialsProvider.addProxyCredentials("username", "password");
    
        final HtmlPage page = webClient.getPage("http://htmlunit.sourceforge.net");
        assertEquals("HtmlUnit - Welcome to HtmlUnit", page.getTitleText());
    
        webClient.closeAllWindows();
    }
    

    The WebClient class is single threaded, so every thread that deals with a web page will need its own WebClient instance.

    Unless you need to process Javascript or CSS, you can also disable these when you create the client:

    WebClient client = new WebClient();
    client.setJavaScriptEnabled(false);
    client.setCssEnabled(false);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Installing: ostaptan:~ ostap$ brew install imagemagick --disable-openmp --from-source ==> Downloading http://downloads.sf.net/project/machomebrew/mirror/ImageMagick-6.7.7-6.tar.bz2 Already downloaded: /Library/Caches/Homebrew/imagemagick-6.7.7-6.tar.bz2
I have database of ship hom whicn I wand to select data from my
For example: select name from person where id=2; I wand to know if this
I'm new in ASP.NET MVC2. But I want to develop a simply Newsletter site.
i have the following code from my JSP which doesn't quite work: <%@ taglib
I have a project using various members of Wikipedia's grey maps: http://en.wikipedia.org/wiki/Wikipedia:Blank_maps . I
I just start to develop for windows phone. I wand to convert my apps
I wand to upgrade my varchar(8000) to more data(I mean , I want to
My Icefaces project is running well in the tomcat server on following url http://localhost:8085/projectName/
I wand build project in windows, I get same Errors: bash C:\linux\android-ndk1\ndk-build V=1 cygwin

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.