Get status code from response (JCEF)

Having problems with building or using the JCEF Java binding? Ask your questions here.

Get status code from response (JCEF)

Postby orangeblue » Thu Oct 30, 2014 2:32 pm

I'm trying to use JCEF for a Java application that I'm building. I'm having a difficult time sifting through the Javadocs and I haven't seen any related questions online to this topic.

What I really want is the status code so I know if a webpage returned with anything other than 200. This is so if the webpage did not return successfully, then I will display an image instead. From what I can tell, I should be using CefResponse getResponse() for what I need, but how exactly do I implement this? The Detailed sample project shows a RequestHandler extending CefRequestHandlerAdapter, which is called in the MainFrame class. So do I have to follow a similar path? I wasn't sure how this could be incorporated with a CefResponse. Any insight into this would be great.
orangeblue
Newbie
 
Posts: 1
Joined: Thu Oct 30, 2014 2:18 pm

Re: Get status code from response (JCEF)

Postby magreenblatt » Thu Oct 30, 2014 3:25 pm

Are you seeking the response code for a navigation or for all resource loads in general? For navigations the CefLoadHandler.OnLoadError method will be called if the navigation fails. For other resource loads you can use JavaScript to determine if the load succeeded (via an onload handler, for example).
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm


Return to JCEF Forum

Who is online

Users browsing this forum: No registered users and 26 guests