All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.highway2urhell.transformer.Struts1Transformer Maven / Gradle / Ivy

There is a newer version: 1.0.5
Show newest version
package com.highway2urhell.transformer;

import javassist.CtClass;
import javassist.CtMethod;

public class Struts1Transformer extends AbstractLeechTransformer {

    public Struts1Transformer() {
        super("org/apache/struts/action/ActionServlet");
        addImportPackage(
                "org.apache.struts.action",
                "java.lang.reflect",
                "org.objectweb.asm",
                "org.apache.struts.config.impl",
                "java.util");
    }

    @Override
    protected void doTransform(CtClass cc) throws Exception {
        CtMethod m = cc.getDeclaredMethod("destroyConfigDigester");
        String h2hHookCode = "" +
                "ModuleConfigImpl m = (ModuleConfigImpl) configDigester.getRoot();" +
                "Field f;" +
                "List listEntryPath = new ArrayList();" +
                "try {" +
                "   f = m.getClass().getDeclaredField(\"actionConfigList\");" +
                "   f.setAccessible(true);" +
                "   List res = (ArrayList) f.get(m);" +
                "   if (res != null) {" +
                "       Iterator iter = res.iterator();" +
                "       while(iter.hasNext()){" +
                "           ActionMapping action = (ActionMapping) iter.next();" +
                "           if(action.getType() != null && !\"\".equals(action.getType())){" +
                "               try {" +
                "                  Class c = Class.forName(action.getType());" +
                "                   Method[] tabMet = c.getDeclaredMethods(); " +
                "                  for (int i=0;i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy