Reputation: 451
I am using web client. and login successfully through web client. but when i send second request for getting data . I got an Exception
com.gargoylesoftware.htmlunit.UnexpectedPage@6d8d73`
but when i pass url thruogh brouser i got a data Json format.
Code:
webClient.getPage("http://ajax/stream/refresh-box?r=new&id=2323222&")
Thx in advanced
Upvotes: 8
Views: 1472
Reputation: 451
this is the which is reading different content type through web client
Page page = webClient.getPage(url);
System.out.println(page);
WebResponse response = page.getWebResponse();
if (response.getContentType().equals("application/json"))
{
pagesource = response.getContentAsString();
System.out.println(pagesource);
}
Upvotes: 2
Reputation: 11
This URL is returning an error, if I type it in the browser, check it again: "http://ajax/stream/refresh-box?r=new&id=2323222&"
BTW, why does it finish with & sign while there is no additional parameter?
I removed the & sign and still I get no page exception in the browser.
Upvotes: 0