Repeat request with JCEF

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Repeat request with JCEF

Postby raker » Tue Nov 18, 2014 2:18 am

Hi,
maybe I will describe some scenario.
When page is loading some additional requests are made. There are simply XHR.
I would like to grab one of that request and periodicaly repet them and read response.
I know how to grab request, but I don't know how to repeat them and access to response content.
Please help.
Important is that the request should be done with my cef browser instance because of cookies. User is logged and only with sended cookies with session id I will receive correct response.

Thanks for advice!
raker
Techie
 
Posts: 14
Joined: Fri Jul 12, 2013 6:18 am

Re: Repeat request with JCEF

Postby magreenblatt » Tue Nov 18, 2014 12:15 pm

You can make the request by executing JavaScript in the page via CefBrowser.executeJavaScript, for example.
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm

Re: Repeat request with JCEF

Postby raker » Tue Nov 18, 2014 3:10 pm

I was wondering about CefBrowser.loadRequest. That method won't repeat request?
raker
Techie
 
Posts: 14
Joined: Fri Jul 12, 2013 6:18 am

Re: Repeat request with JCEF

Postby magreenblatt » Tue Nov 18, 2014 3:25 pm

raker wrote:I was wondering about CefBrowser.loadRequest. That method won't repeat request?

It will cause navigation in a frame. That doesn't sound like what you want.
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm

Re: Repeat request with JCEF

Postby raker » Tue Nov 18, 2014 3:44 pm

No it's do not :).
But when I exec javascript code how to request response read in java application?
raker
Techie
 
Posts: 14
Joined: Fri Jul 12, 2013 6:18 am

Re: Repeat request with JCEF

Postby magreenblatt » Tue Nov 18, 2014 4:23 pm

What do you want to do with the response? You mention XHR in the original post, and now you're talking about using the response from Java. If you want to execute the request and read the response from Java use CefURLRequest.
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm

Re: Repeat request with JCEF

Postby raker » Wed Nov 19, 2014 3:31 am

Hi again,
thanks for Your fast reply.

One question again.
Could You provide simple example how to fire CefURLRequest?

Big thanks for Your help.
raker
Techie
 
Posts: 14
Joined: Fri Jul 12, 2013 6:18 am

Re: Repeat request with JCEF

Postby magreenblatt » Wed Nov 19, 2014 10:43 am

See Tests -> URL Request in the JCEF detailed sample application.
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm

Re: Repeat request with JCEF

Postby raker » Mon Nov 24, 2014 10:05 am

Hi Again.
I'm almost done but have got another question.
CefURLRequest.create method use as arguments use CefRequest and CefUrlRequestClient.
My browser that I logged in to service dont use CefUrlRequestClient but CefClient. Should I in some way bind CefClient and CefUrlRequestClient to use that same cookies?
raker
Techie
 
Posts: 14
Joined: Fri Jul 12, 2013 6:18 am

Re: Repeat request with JCEF

Postby magreenblatt » Mon Nov 24, 2014 11:12 am

CefURLRequest is not associated with a particular CefClient. Call setFlags(UR_FLAG_ALLOW_CACHED_CREDENTIALS) on the CefRequest passed to CefURLRequest.create and it will use any relevant cookies from the global cookie manager.
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 60 guests