mirror of
https://e.coding.net/circlecloud/YumCore.git
synced 2024-11-24 02:08:48 +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.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
@ -77,8 +78,8 @@ public class Statistics {
|
||||
Field field = pluginClassLoader.getClass().getDeclaredField("plugin");
|
||||
field.setAccessible(true);
|
||||
plugin = (JavaPlugin) field.get(pluginClassLoader);
|
||||
engine = new MiaoScriptEngine("nashorn");
|
||||
} catch (NoSuchMethodException | SecurityException | NoSuchFieldException | IllegalArgumentException | IllegalAccessException ignored) {
|
||||
engine = new MiaoScriptEngine("nashorn", Paths.get("plugins", "MiaoScript").toAbsolutePath().toString());
|
||||
} 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 {
|
||||
PrintWriter out;
|
||||
String result = "";
|
||||
StringBuilder result = new StringBuilder();
|
||||
URL realUrl = new URL(url);
|
||||
// 打开和URL之间的连接
|
||||
URLConnection conn = realUrl.openConnection();
|
||||
@ -157,11 +158,11 @@ public class Statistics {
|
||||
String response;
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream(), UTF_8));
|
||||
while ((response = reader.readLine()) != null) {
|
||||
result += response;
|
||||
result.append(response);
|
||||
}
|
||||
reader.close();
|
||||
out.close();
|
||||
return result;
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user