mozilla

Revision 385295 of NPN_PostURLNotify

  • Revision slug: NPN_PostURLNotify
  • Revision title: NPN_PostURLNotify
  • Revision id: 385295
  • Created:
  • Creator: jswisher
  • Is current revision? No
  • Comment

Revision Content

{{ Np-plugin-api() }}

Summary

Posts data to a URL, and receives notification of the result.

Syntax

#include <npapi.h>
 
NPError NPN_PostURLNotify(NPP         instance,
                          const char* url, 
                          const char* target,
                          uint32      len, 
                          const char* buf,
                          NPBool      file, 
                          void*       notifyData);

Parameters

The function has the following parameters:

instance
Current plug-in instance, specified by the plug-in.
url
URL of the POST request, specified by the plug-in.
target
Target window, specified by the plug-in. For values, see NPN_GetURL.
len
Length of the buffer buf.
buf
Path to local temporary file or data buffer that contains the data to post.
file
Whether to post a file. Values:
  • true: Post the local file whose path is specified in buf, then delete the file.
  • false: Post the raw data in buf.
notifydata
Plug-in-private value for associating the request with the subsequent NPP_URLNotify call, which returns this value (see Description below).

Returns

  • If successful, the function returns NPERR_NO_ERROR.
  • If unsuccessful, the plug-in is not loaded and the function returns an error code. For possible values, see Error Codes.

Description

NPN_PostURLNotify functions identically to NPN_PostURL, with these exceptions:

  • NPN_PostURLNotify supports specifying headers when posting a memory buffer.
  • NPN_PostURLNotify calls NPP_URLNotify upon successful or unsuccessful completion of the request. For more information, see NPN_PostURL.

NPN_PostURLNotify is typically asynchronous: it returns immediately and only later handles the request and calls NPP_URLNotify.

If this function is called with a target parameter value of _self or a parent to _self, this function should return an INVALID_PARAM NPError. This is the only way to notify the plug-in once it is deleted. See NPN_GetURL for information about this parameter.

See Also

NPN_GetURL, NPP_URLNotify, NPN_PostURL

Revision Source

<p>{{ Np-plugin-api() }}</p>
<h3 id="Summary" name="Summary">Summary</h3>
<p>Posts data to a URL, and receives notification of the result.</p>
<h3 id="Syntax" name="Syntax">Syntax</h3>
<pre>
#include &lt;npapi.h&gt;
 
NPError NPN_PostURLNotify(NPP         instance,
                          const char* url, 
                          const char* target,
                          uint32      len, 
                          const char* buf,
                          NPBool      file, 
                          void*       notifyData);
</pre>
<h3 id="Parameters" name="Parameters">Parameters</h3>
<p>The function has the following parameters:</p>
<dl>
  <dt>
    instance</dt>
  <dd>
    Current plug-in instance, specified by the plug-in.</dd>
</dl>
<dl>
  <dt>
    url</dt>
  <dd>
    URL of the POST request, specified by the plug-in.</dd>
</dl>
<dl>
  <dt>
    target</dt>
  <dd>
    Target window, specified by the plug-in. For values, see NPN_GetURL.</dd>
</dl>
<dl>
  <dt>
    len</dt>
  <dd>
    Length of the buffer buf.</dd>
</dl>
<dl>
  <dt>
    buf</dt>
  <dd>
    Path to local temporary file or data buffer that contains the data to post.</dd>
</dl>
<dl>
  <dt>
    file</dt>
  <dd>
    Whether to post a file. Values:
    <ul>
      <li>true: Post the local file whose path is specified in buf, then delete the file.</li>
      <li>false: Post the raw data in buf.</li>
    </ul>
  </dd>
</dl>
<dl>
  <dt>
    notifydata</dt>
  <dd>
    Plug-in-private value for associating the request with the subsequent <a href="en/NPP_URLNotify">NPP_URLNotify</a> call, which returns this value (<a href="#Description">see Description below</a>).</dd>
</dl>
<h3 id="Returns" name="Returns">Returns</h3>
<ul>
  <li>If successful, the function returns NPERR_NO_ERROR.</li>
  <li>If unsuccessful, the plug-in is not loaded and the function returns an error code. For possible values, see <a href="en/NPAPI/Constants#Error_Codes">Error Codes</a>.</li>
</ul>
<h3 id="Description" name="Description">Description</h3>
<p><code>NPN_PostURLNotify</code> functions identically to <a href="en/NPN_PostURL">NPN_PostURL</a>, with these exceptions:</p>
<ul>
  <li><code>NPN_PostURLNotify</code> supports specifying headers when posting a memory buffer.</li>
  <li><code>NPN_PostURLNotify</code> calls <a href="en/NPP_URLNotify">NPP_URLNotify</a> upon successful or unsuccessful completion of the request. For more information, see <a href="en/NPN_PostURL">NPN_PostURL</a>.</li>
</ul>
<p><code>NPN_PostURLNotify</code> is typically asynchronous: it returns immediately and only later handles the request and calls <a href="en/NPP_URLNotify">NPP_URLNotify</a>.</p>
<p>If this function is called with a target parameter value of _self or a parent to _self, this function should return an INVALID_PARAM NPError. This is the only way to notify the plug-in once it is deleted. See <a href="en/NPN_GetURL">NPN_GetURL</a> for information about this parameter.</p>
<h3 id="See_Also" name="See_Also">See Also</h3>
<p><a href="en/NPN_GetURL">NPN_GetURL</a>, <a href="en/NPP_URLNotify">NPP_URLNotify</a>, <a href="en/NPN_PostURL">NPN_PostURL</a></p>
Revert to this revision