rewitten ULR

P

pjpf1

A servlet recieves a GET request and returns the results to a browser
and a rewritten URL appears in the address field.
How would I get such a rewritten address if I am using java to fetch
pages rather than an internet browser?
(J2SE 1.4.2)

Thanks,

pj . . .
 
D

Daniel Pitts

A servlet recieves a GET request and returns the results to a browser
and a rewritten URL appears in the address field.
How would I get such a rewritten address if I am using java to fetch
pages rather than an internet browser?
(J2SE 1.4.2)

Thanks,

pj . . .

Often, the GET request returns a 301 or 302 redirect, which the
browser gracefully follows. I'm not sure you'll be able to do it
easily with the built-in URL libraries, however, I wouldn't be
surprised if you could using apache's HttpClient (google it)

Otherwise, you can open a URL connect, and figure out what to do from
there... Read the javadocs.
 
P

pjpf1

Often, the GET request returns a 301 or 302 redirect, which the
browser gracefully follows. I'm not sure you'll be able to do it
easily with the built-in URL libraries, however, I wouldn't be
surprised if you could using apache's HttpClient (google it)

Otherwise, you can open a URL connect, and figure out what to do from
there... Read the javadocs.

Thank you, I had been looking at URLConnection only. I see more
utility in HttpURLConnection class. Thanks for the Apache Tip. I
believe java follows redirects by default.

pj . . .
 

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

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top