If you are an author of an extension and you would like to use my application now it is possible.
When your application would like to open a request data in Advanced REST client you have two possibilities:
- using chrome message passing system
- using webIntents (you don't need to have a chrome extension)
You just need to pass request object with following data:
"payload" (required) - message payload:
- "create" to open new application window with values;
- other payloads may be available in future
"data" - (required) javascript object with any of values:
- url - (String) request URL to set
- method - (String) request method to set
- headers - (String) an RFC string representing request headers example:
>>> User-Agent: X-Extension
X-header: header value; second value <<< - payload - (String) data to pass into payload field. Only for http methods that carry payload data
- encoding - (String) data form encoding
Example of usage:
var message = { 'payload': 'create', 'data': { 'url': 'http://www.google.com/', 'method': 'GET','headers': "User-Agent: Chrome-Extension\nX-extension-id: SomeID" } };Via extensions message passing system:chrome.extension.sendMessage("hgmloofddffdnphfgcellkdfbfbjeloo", message, function(response) {}); Using webIntents: window.Intent = window.Intent || window.WebKitIntent; window.navigator.startActivity = window.navigator.startActivity || window.navigator.webkitStartActivity; var params = { "action": "http://webintents.org/view", "type": "application/restclient+data" , "data": message }; var i = new WebKitIntent(params); var onSuccess = function(data) { console.log(data); }; var onFailure = function() { console.log('intent error'); }; navigator.webkitStartActivity(i, onSuccess, onFailure);For more information check trunk: http://code.google.com/p/chrome-rest-client/source/browse/trunk/RestClient/war/extension/background.js
No comments:
Post a Comment