问题
I want to create Storage Plugin through C#(.NET) code, when Drill is install in some other system(not in local).? Is it Possible?? If yes then how.?
回答1:
I found out some solution for that:
var request = (HttpWebRequest)WebRequest.Create(url);
var postData = "name=" + name + "&config=" + config;
var data = Encoding.ASCII.GetBytes(postData);
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = data.Length;
using (var stream = request.GetRequestStream())
{
stream.Write(data, 0, data.Length);
}
var response = (HttpWebResponse)request.GetResponse();
var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
if (responseString != null)
{
var jsonObject = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(responseString);
return jsonObject.result == "success";
}
来源:https://stackoverflow.com/questions/35942826/creating-storage-plugin-throught-through-c-sharp-code-in-apache-drill