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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T03:56:41+00:00 2026-05-18T03:56:41+00:00

I want to get content of page from URL by this code : public

  • 0

I want to get content of page from URL by this code :

public static String getContentResult(URL url) throws IOException{

    InputStream in = url.openStream();
    StringBuffer sb = new StringBuffer();

    byte [] buffer = new byte[256];

    while(true){
        int byteRead = in.read(buffer);
        if(byteRead == -1)
            break;
        for(int i = 0; i < byteRead; i++){
            sb.append((char)buffer[i]);
        }
    }
    return sb.toString();
}

But with this URL : http://portal.acm.org/citation.cfm?id=152610.152611&coll=DL&dl=GUIDE&CFID=114782066&CFTOKEN=85539315
i can’t get Asbtract :Database management systems will continue to manage…..

Can you give me solution for solve problem ?
Thanks in advance

  • 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-18T03:56:42+00:00Added an answer on May 18, 2026 at 3:56 am

    Outputting the header of of the get request:

    HTTP/1.1 302 Moved Temporarily
    Connection: close
    Date: Thu, 18 Nov 2010 15:35:24 GMT
    Server: Microsoft-IIS/6.0
    location: http://portal.acm.org/citation.cfm?id=152610.152611&coll=DL&dl=GUIDE
    Content-Type: text/html; charset=UTF-8
    

    This means that the server wants you to download the new locations address. So either you get the header directly from the UrlConnection and follow that link or you use HttpClient automatically which automatically follow redirects. The code below is based on HttpClient:

    public class HttpTest {
        public static void main(String... args) throws Exception {
    
            System.out.println(readPage(new URL("http://portal.acm.org/citation.cfm?id=152610.152611&coll=DL&dl=GUIDE&CFID=114782066&CFTOKEN=85539315")));
        }
    
        private static String readPage(URL url) throws Exception {
    
            DefaultHttpClient client = new DefaultHttpClient();
            HttpGet request = new HttpGet(url.toURI());
            HttpResponse response = client.execute(request);
    
            Reader reader = null;
            try {
                reader = new InputStreamReader(response.getEntity().getContent());
    
                StringBuffer sb = new StringBuffer();
                {
                    int read;
                    char[] cbuf = new char[1024];
                    while ((read = reader.read(cbuf)) != -1)
                        sb.append(cbuf, 0, read);
                }
    
                return sb.toString();
    
            } finally {
                if (reader != null) {
                    try {
                        reader.close();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to get the content off this* page. Everything I've looked up gives
I use this code to load the content from a different page into the
I want to get images from a flickr rss but this code won't get
I get a page using file_get_contents from a remote server, but I want to
I want to get the content which are displayed by a particular page in
I want to get the content of a list in a webpage from below
I want to get a MIME Content-Type from a given extension (preferably without accessing
What i basically want to do is to get content from a website and
i cannot get current content page html. when i trying access from script in
I want to hide master page table from the content page. I have tried

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.