473,327 Members | 2,094 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

urlconnection doesn't working with redirect?

hi, I've trying to grab a asp page but it seems java can't handle any page
that is not static (or redirected?)?
I evened tryied using HttpURLConnection class and set setFollowRedirects()
to true, but still I didn't get the html page (that shows up when you open
the site from IE) instead I get a very short page, what's going on?

thanks

------------------- my methods to pull this asp page -----------
URL u = new URL("http://www.yourname.com");

HttpURLConnection url;
url = (HttpURLConnection)u.openConnection() ;
url.setFollowRedirects(true);

BufferedReader html = new BufferedReader(new InputStreamReader(
url.getInputStream()));
from the page I get back there is following javascript

location.replace("default.asp");
anyone know what's going wrong? thanks
tony

Jul 17 '05 #1
1 11036
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

tony wrote:
hi, I've trying to grab a asp page but it seems java can't handle
any page that is not static (or redirected?)?
I evened tryied using HttpURLConnection class and set
setFollowRedirects() to true, but still I didn't get the html page
(that shows up when you open the site from IE) instead I get a very
short page, what's going on?

thanks from the page I get back there is following javascript

location.replace("default.asp");


Hi,
setFollowRedirects() will cause the connection to follow HTTP
redirects, but it doesn't operate on the content (i.e. doesn't parse
JavaScript). You'll need to do that yourself.

- --
Chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE+/jvZwxczzJRavJYRAktwAJ9q/tPcMXe0ENwir70GC/sm8VryIgCfZ0S/
GfzT505ihlUP3dSBg2sHUxM=
=2rCq
-----END PGP SIGNATURE-----
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Chewy509 | last post by:
Hi Everyone, I'll just start, and say I am not a PHP developer (I'm a sysadmin, who has gotten lumped with a non-working website). But since I like to do this type of stuff, I though I might...
4
by: Jochen Daum | last post by:
Hi, I have to emulate a "file upload" to a Java Servlet which is done with the class URLConnection. The java source basically does URLConnection conn =...
1
by: Johnnie | last post by:
Hello, I am trying to submit a request object to a server (not local), using a servlet. When given a ZIP code this particular server is supposed to return xml with the city/state/areacode etc......
0
by: prabhat | last post by:
Hi, The getHeaderField(0) of class URLConnection in java.net package returns a String which provides status code. An example of returned string is : "HTTP/1.0 200 OK". The status code 200 mean...
3
by: mark.irwin | last post by:
Hello all, Have an issue where a redirect pushes data to a page with a select case which then redirects to another page. Problem is the redirect isnt working in 1 case. Code below: strURL =...
12
by: Henry Wu | last post by:
Hi, I've semi-successfully converted my old VB6 project to VB.NET2003 http://wuhenry.beigetower.org/vbVideoInspection.rar ,it is a simple webcam program that works flawlessly on VB6. Now I'm having...
5
by: ODAN | last post by:
We are testing a ASP.NET application in Visual Studion 2003 and written in C#. One of the pages that register new users on this application fails to redirect to another page when the button is...
2
by: Ned Balzer | last post by:
Hi, Apologies if this is a newbie question, I haven't found the answer in any faqs. I have an asp.net 2.0 page that sets session variables and then redirects to another page. For the page...
3
by: Athmaus | last post by:
Hello, I have this ecom page that i am making where customers can select to choose additional licenses before they purchase. I have that part working with javascript. Problem is that when the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.