Refresh HTTP java code

J

jrichard

Im french, sorry for my english

I have a program who take some information of a web page. The number
of results are different in fonction on my search and are displayed on
different pages with an index like :
http://www.xxxxxxx.com/recherche?page=11
http://www.xxxxxxx.com/recherche?page=12
etc

My problem is : if i want take the information of
http://www.xxxxxxx.com/recherche?page=12, the browser display the
first page of the search. Only an refresh on the page display after
refresh the good results. So my program can take only the first page
of result.

I have not find any solution for refresh the page in the same URL
connection.
like :

URL url = new URL(remoteMachine);
URLConnection urlconn = url.openConnection();

if (urlconn.getContent() instanceof InputStream) {
BufferedReader in = new BufferedReader(new
InputStreamReader(urlconn.getInputStream()));
etc .........

I hope its possible to refresh the page in the same java url
connection. Please help me.
Tks.
 
J

jrichard

Im french, sorry for my english

I have a program who take some information of a web page. The number
of results are different in fonction on my search and are displayed on
different pages with an index like :
http://www.xxxxxxx.com/recherche?page=11
http://www.xxxxxxx.com/recherche?page=12
etc

My problem is : if i want take the information of
http://www.xxxxxxx.com/recherche?page=12, the browser display the
first page of the search. Only an refresh on the page display after
refresh the good results. So my program can take only the first page
of result.

I have not find any solution for refresh the page in the same URL
connection.
like :

URL url = new URL(remoteMachine);
URLConnection urlconn = url.openConnection();

if (urlconn.getContent() instanceof InputStream) {
BufferedReader in = new BufferedReader(new
InputStreamReader(urlconn.getInputStream()));
etc .........

I hope its possible to refresh the page in the same java url
connection. Please help me.
Tks.


No solution ? please help me
 
M

Matt Humphrey

jrichard said:
Im french, sorry for my english

I have a program who take some information of a web page. The number
of results are different in fonction on my search and are displayed on
different pages with an index like :
http://www.xxxxxxx.com/recherche?page=11
http://www.xxxxxxx.com/recherche?page=12
etc

My problem is : if i want take the information of
http://www.xxxxxxx.com/recherche?page=12, the browser display the
first page of the search. Only an refresh on the page display after
refresh the good results. So my program can take only the first page
of result.

I have not find any solution for refresh the page in the same URL
connection.
like :

URL url = new URL(remoteMachine);
URLConnection urlconn = url.openConnection();

if (urlconn.getContent() instanceof InputStream) {
BufferedReader in = new BufferedReader(new
InputStreamReader(urlconn.getInputStream()));
etc .........

I hope its possible to refresh the page in the same java url
connection. Please help me.

I'm not sure I understand what you're asking, so I'll try to reinterpret
your question. You have a program that reads data from a web page.
However, the web page only contains only the first page of the data unless
you refresh the page? I'm not sure what you mean by refresh but I think you
mean something else. It is common in web page queries to show only the
first page of results and to permit the user to press the "next" button to
get the next page of results. The next button is part of the page
itself--there is no universal way to get the next page. Essentially, the
next button sends a second request for new data. For your program to get
the next page you must find the next button in the results and read results
from that URL. Often, it will be the same URL as the original, but with a
different starting point, such as
http://www.xxxxxxx.com/recherche?page=12&start=21&length=20 which would tell
the web page to get result entries 21-40. In some cases you can send this
kind of URL to the web browser to begin with, as it
http://www.xxxxxxx.com/recherche?page=12&start=1&length=100 as way to get
all the results on one page.

I hope this helps,
Bon chance,
Matt Humphrey (e-mail address removed) http://www.iviz.com/
 
A

Andrea Desole

I'm not sure I understand what you're asking, so I'll try to reinterpret
your question. You have a program that reads data from a web page.
However, the web page only contains only the first page of the data unless
you refresh the page? I'm not sure what you mean by refresh but I think you
mean something else. It is common in web page queries to show only the
first page of results and to permit the user to press the "next" button to
get the next page of results. The next button is part of the page
itself--there is no universal way to get the next page. Essentially, the
next button sends a second request for new data. For your program to get
the next page you must find the next button in the results and read results
from that URL. Often, it will be the same URL as the original, but with a
different starting point, such as
http://www.xxxxxxx.com/recherche?page=12&start=21&length=20 which would tell
the web page to get result entries 21-40. In some cases you can send this
kind of URL to the web browser to begin with, as it
http://www.xxxxxxx.com/recherche?page=12&start=1&length=100 as way to get
all the results on one page.

Ah, now I start to understand what the question was.
Just for completeness, I would like to say that, if the problem is
really to refresh the page, then the reason is probably that you have to
keep the session, otherwise every request to the server will result as new.
When you get the first response from the server, find the cookie with
the session id (something like 'JSESSIONID'), and send it back when you
request it the second time. The server will be able to get the session
information and understand that you are requesting the page a second time
 
J

julien

I have test an beautiful package of apache developpement : httpclient.

With this package, its works fine. Tks for your help Andrea
 
A

Andrea Desole

julien said:
I have test an beautiful package of apache developpement : httpclient.
Oh, yes, I knew the package. Didn't know it could do that much
With this package, its works fine. Tks for your help Andrea
thank you for the information :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top