mirror of
https://e.coding.net/circlecloud/YumCore.git
synced 2024-11-21 01:38:51 +00:00
feat: use MiaoScript as engineRoot
Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
parent
616f499f91
commit
5e31acf5ee
@ -24,6 +24,7 @@ import java.net.URLConnection;
|
|||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -77,8 +78,8 @@ public class Statistics {
|
|||||||
Field field = pluginClassLoader.getClass().getDeclaredField("plugin");
|
Field field = pluginClassLoader.getClass().getDeclaredField("plugin");
|
||||||
field.setAccessible(true);
|
field.setAccessible(true);
|
||||||
plugin = (JavaPlugin) field.get(pluginClassLoader);
|
plugin = (JavaPlugin) field.get(pluginClassLoader);
|
||||||
engine = new MiaoScriptEngine("nashorn");
|
engine = new MiaoScriptEngine("nashorn", Paths.get("plugins", "MiaoScript").toAbsolutePath().toString());
|
||||||
} catch (NoSuchMethodException | SecurityException | NoSuchFieldException | IllegalArgumentException | IllegalAccessException ignored) {
|
} catch (NoSuchMethodException | SecurityException | NoSuchFieldException | IllegalArgumentException | IllegalAccessException | UnsupportedOperationException ignored) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,7 +136,7 @@ public class Statistics {
|
|||||||
*/
|
*/
|
||||||
public static String postData(String url, String param) throws IOException {
|
public static String postData(String url, String param) throws IOException {
|
||||||
PrintWriter out;
|
PrintWriter out;
|
||||||
String result = "";
|
StringBuilder result = new StringBuilder();
|
||||||
URL realUrl = new URL(url);
|
URL realUrl = new URL(url);
|
||||||
// 打开和URL之间的连接
|
// 打开和URL之间的连接
|
||||||
URLConnection conn = realUrl.openConnection();
|
URLConnection conn = realUrl.openConnection();
|
||||||
@ -157,11 +158,11 @@ public class Statistics {
|
|||||||
String response;
|
String response;
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream(), UTF_8));
|
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream(), UTF_8));
|
||||||
while ((response = reader.readLine()) != null) {
|
while ((response = reader.readLine()) != null) {
|
||||||
result += response;
|
result.append(response);
|
||||||
}
|
}
|
||||||
reader.close();
|
reader.close();
|
||||||
out.close();
|
out.close();
|
||||||
return result;
|
return result.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user