Need to emulate browser behviour from a java class

S

shacoof

I am trying to use the URL class in order to emulate browser behavior.
the scenario I'm working on is as follow :
call a web-application - page a
read page a , inside the page I find an <img src=.../some-servlet>
I just need the img so I write just this tag to the out stream (e.g.
the html that the page create).
When the browser get the html with the img tag it perform the call, but
the img is not returned properly.
I believe that this is happening because the application return data
using cookies mechanism or something like that, this data is lost
because it didn't pass to the html.

How can I solve the problem ?
 
R

Roedy Green

I am trying to use the URL class in order to emulate browser behavior.
the scenario I'm working on is as follow :
call a web-application - page a
read page a , inside the page I find an <img src=.../some-servlet>
I just need the img so I write just this tag to the out stream (e.g.
the html that the page create).
When the browser get the html with the img tag it perform the call, but
the img is not returned properly.
I believe that this is happening because the application return data
using cookies mechanism or something like that, this data is lost
because it didn't pass to the html.

How can I solve the problem ?

The general way to solve the problem is to get a packet sniffer and
watch you browser solve them. Then you emulate what it does.

See http://mindprod.com/jgloss/sniffer.html
http://mindprod.com/jgloss/cgi.html
http://mindprod.com/jgloss/screenscraping.html
http://mindprod.com/jgloss/http.html
 

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,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top