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

  • Home
  • SEARCH
  • 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 6089053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:03:21+00:00 2026-05-23T12:03:21+00:00

I Use BufferedInputStream For HTTP POST/GET But I Get Some Error the Below java.io.FileNotFoundException:

  • 0

I Use BufferedInputStream For HTTP POST/GET

But I Get Some Error the Below

  1. java.io.FileNotFoundException: http://XX.XX.XX.XX/WebWS/data.aspx
  2. Transport endpoint is not connected

Why Get This Error. My Code is Below

URL url = new URL(glob.postUrl);

    HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();

    try {

        httpConn.setDoInput(true);
        httpConn.setDoOutput(true);
        httpConn.setRequestMethod("GET");
        httpConn.setRequestProperty("Content-Type",
                "application/x-www-form-urlencoded");
        httpConn.setRequestProperty("Content-Language", "TR");      
        httpConn.setConnectTimeout(12000);


        Iterator<String> reqProps = hMap.keySet().iterator();
        while (reqProps.hasNext()) {
            String key = reqProps.next();
            String value = hMap.get(key);
            httpConn.addRequestProperty(key, value);
        }

        InputStream in = new BufferedInputStream(httpConn.getInputStream());

        StringBuilder builder = new StringBuilder();
        String line;
        try {
            BufferedReader reader = new BufferedReader(
                    new InputStreamReader(in, "UTF-8"));
            while ((line = reader.readLine()) != null) {
                builder.append(line);
            }
        } finally {
            in.close();
        }
        httpConn.disconnect();

Thanks.

  • 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-23T12:03:22+00:00Added an answer on May 23, 2026 at 12:03 pm

    Is there any reason you’re not using HttpClient?

    You can replace your code with something like:

    HttpContext httpContext = new BasicHttpContext();
    HttpClient httpClient = new DefaultHttpClient();
    HttpGet httpGet = new HttpGet(url);
    HttpResponse response = httpClient.execute(httpGet, httpContext);
    int statusCode = response.getStatusLine().getStatusCode();
    HttpEntity entity = response.getEntity();
    String page = EntityUtils.toString(entity);
    

    You can setup the HttpClient with ClientConnectionManager and HttpParams for security and various http parameters for the client at initialisation (plenty of examples around if you search on class names).

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

Sidebar

Related Questions

I'm trying to use a BufferedInputStream to load an external DICOM file, but it
use LWP::Simple; use Parallel::ForkManager; @links=( [http://prdownloads.sourceforge.net/sweethome3d/SweetHome3D-2.1-windows.exe,SweetHome3D-2.1-windows.exe], [http://prdownloads.sourceforge.net/sweethome3d/SweetHome3D-2.1-macosx.dmg,SweetHome3D-2.1-macosx.dmg], [http://prdownloads.sourceforge.net/sweethome3d/SweetHome3DViewer-2.1.zip,SweetHome3DViewer-2.1.zip], ); # Max 30 processes for
use this website a lot but first time posting. My program creates a number
Use case: I've just entered insert mode, and typed some text. Now I want
We use a data acquisition card to take readings from a device that increases
My application needs to download some big Files. I use a service for the
I have a Word macro that needs to run using Java. So I use
I have some general questions regarding the java.util.zip library. What we basically do is
use strict; use warnings; use Statistics::Descriptive; use 5.012; my @data = ( -2, 7,
I'm trying to use basic Java code in Scala to read from a file

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.