Skip to end of metadata
Go to start of metadata

public static FB::HttpStreamResponsePtr FB::SimpleStreamHelper::SynchronousPost ( const FB::BrowserHostPtr host,
const FB::URI uri,
const std::string &  postdata,
const bool  cache = true,
const size_t  bufferSize = 128*1024 
) [static]

Do not call from the main thread! Starts a Synchronous HTTP POST request.

Call this static method to make a synchronous HTTP POST request through the browser from a thread that you have started. *IMPORTANT*: This must *never* be called on the main thread!

 void FBTestPluginAPI::getURL(const std::string& url, const FB::JSObjectPtr& callback)
 {
     FB::HttpStreamResponsePtr resp = FB::SimpleStreamHelper::SynchronousPost(m_host, FB::URI::fromString(url));
     if (resp->success) {
         std::string dstr(reinterpret_cast<const char*>(resp->data.get()), size);
     } else {
         // The request failed
     }
 }
 }
Parameters:
host const FB::BrowserHostPtr& BrowserHostPtr to use to create the stream
uri const FB::URI& URI to request
postdata const std::string& Post data to send
cache const bool true if cache can be used
bufferSize const size_t Specifies the size of the buffer to use internally
Returns:
FB::HttpStreamResponsePtr
Since:
1.6RC2
See also:
SynchronousGet
FB::URI
FB::HttpStreamResponse
Deprecated:
1.7 use SynchronousRequest

Definition at line 137 of file SimpleStreamHelper.cpp.

References FB::BrowserStreamRequest::setBufferSize(), FB::BrowserStreamRequest::setCacheable(), and SynchronousRequest().

00139 {
00140     FB::BrowserStreamRequest req(uri, "POST");
00141     req.setCacheable(cache);
00142     req.setBufferSize(bufferSize);
00143     req.setPostData(postdata);
00144     return SynchronousRequest(host, req);
00145 }

Here is the call graph for this function:


Generated on 20 Jun 2013 for FireBreath by  doxygen 1.6.1
Labels
  • None