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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:33:45+00:00 2026-05-28T06:33:45+00:00

I request a text file from a server. The url does not end in

  • 0

I request a text file from a server. The url does not end in some_file.txt, because the file is created dynamically per the request (not sure if that is even relevant). When I use the code below, I do not read in the text (though I do read in html, if pointed to a url that has html).

            String text = "RESULTS:\n";

            try {  

                String urlString = 
                    "http://appdata.mysite.com/httpauth/" +
                    "hub/DAR_param1_RTQB?" + 
                    "method=query&list=param2"; 

                // Create a URL 
                URL url = new URL(urlString);

                // Read all the text returned by the server
                in = new BufferedReader(new InputStreamReader(url.openStream()));

                String line;
                while ((line = in.readLine()) != null) {
                    text = text + line;
                }                    
            } catch (MalformedURLException e) {
            } catch (IOException e) {
            } catch (Exception e) {
            } finally {
                if ( in != null ) {
                    try {
                        in.close();
                    } catch (IOException e) {
                        Log.e(TAG, "Exception trying to close BufferedReader");
                    }
                }
            } 

            return text;

This returns only “RESULTS:”, but none of the text. What am I missing?

Edit: Here is an example of the file. This is displayed in a browser if the url is pasted into the address bar:

20120120_1734
20120120_1725
20120120_1715
20120120_1705
20120120_1655
  • 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-28T06:33:45+00:00Added an answer on May 28, 2026 at 6:33 am

    You are swallowing all the potential errors that you need to see to troubleshoot this.

    In your catch clauses, try adding some code to see the errors.
    Something along the lines of:

    System.out.println("Error: ", e.getMessage());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

server: apache http server 2.2 problem: code does not load my text file hello
I upload a file from a Nokia N97 phone to server, everything works fine
I'm using python to programatically download a zip file from a web server. Using
I try to read a local file from server. I have been googling this
I keep getting a Bad Request error from the URL I'm calling in my
I wrote this code to download a file from an FTP server. When the
I am sending password text to the http service request object.like <request><password>pass.text</password></request> now this
I know we can request xml, html as well as text images directly using
Why am I getting these errors? alt text http://img39.imageshack.us/img39/2203/help.tif It says: Error: Request for
The request I sent is accept gzip but the response is not compressed, instead,

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.