Search in sources :

Example 1 with TagAttributeInfo

use of org.apache.jasper.deploy.TagAttributeInfo in project wildfly by wildfly.

the class UndertowDeploymentInfoService method createTldInfo.

private static TagLibraryInfo createTldInfo(final String location, final TldMetaData tldMetaData, final HashMap<String, TagLibraryInfo> ret) throws ClassNotFoundException {
    String relativeLocation = location;
    String jarPath = null;
    if (relativeLocation != null && relativeLocation.startsWith("/WEB-INF/lib/")) {
        int pos = relativeLocation.indexOf('/', "/WEB-INF/lib/".length());
        if (pos > 0) {
            jarPath = relativeLocation.substring(pos);
            if (jarPath.startsWith("/")) {
                jarPath = jarPath.substring(1);
            }
            relativeLocation = relativeLocation.substring(0, pos);
        }
    }
    TagLibraryInfo tagLibraryInfo = new TagLibraryInfo();
    tagLibraryInfo.setTlibversion(tldMetaData.getTlibVersion());
    if (tldMetaData.getJspVersion() == null) {
        tagLibraryInfo.setJspversion(tldMetaData.getVersion());
    } else {
        tagLibraryInfo.setJspversion(tldMetaData.getJspVersion());
    }
    tagLibraryInfo.setShortname(tldMetaData.getShortName());
    tagLibraryInfo.setUri(tldMetaData.getUri());
    if (tldMetaData.getDescriptionGroup() != null) {
        tagLibraryInfo.setInfo(tldMetaData.getDescriptionGroup().getDescription());
    }
    // Validator
    if (tldMetaData.getValidator() != null) {
        TagLibraryValidatorInfo tagLibraryValidatorInfo = new TagLibraryValidatorInfo();
        tagLibraryValidatorInfo.setValidatorClass(tldMetaData.getValidator().getValidatorClass());
        if (tldMetaData.getValidator().getInitParams() != null) {
            for (ParamValueMetaData paramValueMetaData : tldMetaData.getValidator().getInitParams()) {
                tagLibraryValidatorInfo.addInitParam(paramValueMetaData.getParamName(), paramValueMetaData.getParamValue());
            }
        }
        tagLibraryInfo.setValidator(tagLibraryValidatorInfo);
    }
    // Tag
    if (tldMetaData.getTags() != null) {
        for (TagMetaData tagMetaData : tldMetaData.getTags()) {
            TagInfo tagInfo = new TagInfo();
            tagInfo.setTagName(tagMetaData.getName());
            tagInfo.setTagClassName(tagMetaData.getTagClass());
            tagInfo.setTagExtraInfo(tagMetaData.getTeiClass());
            if (tagMetaData.getBodyContent() != null) {
                tagInfo.setBodyContent(tagMetaData.getBodyContent().toString());
            }
            tagInfo.setDynamicAttributes(tagMetaData.getDynamicAttributes());
            // Description group
            if (tagMetaData.getDescriptionGroup() != null) {
                DescriptionGroupMetaData descriptionGroup = tagMetaData.getDescriptionGroup();
                if (descriptionGroup.getIcons() != null && descriptionGroup.getIcons().value() != null && (descriptionGroup.getIcons().value().length > 0)) {
                    Icon icon = descriptionGroup.getIcons().value()[0];
                    tagInfo.setLargeIcon(icon.largeIcon());
                    tagInfo.setSmallIcon(icon.smallIcon());
                }
                tagInfo.setInfoString(descriptionGroup.getDescription());
                tagInfo.setDisplayName(descriptionGroup.getDisplayName());
            }
            // Variable
            if (tagMetaData.getVariables() != null) {
                for (VariableMetaData variableMetaData : tagMetaData.getVariables()) {
                    TagVariableInfo tagVariableInfo = new TagVariableInfo();
                    tagVariableInfo.setNameGiven(variableMetaData.getNameGiven());
                    tagVariableInfo.setNameFromAttribute(variableMetaData.getNameFromAttribute());
                    tagVariableInfo.setClassName(variableMetaData.getVariableClass());
                    tagVariableInfo.setDeclare(variableMetaData.getDeclare());
                    if (variableMetaData.getScope() != null) {
                        tagVariableInfo.setScope(variableMetaData.getScope().toString());
                    }
                    tagInfo.addTagVariableInfo(tagVariableInfo);
                }
            }
            // Attribute
            if (tagMetaData.getAttributes() != null) {
                for (AttributeMetaData attributeMetaData : tagMetaData.getAttributes()) {
                    TagAttributeInfo tagAttributeInfo = new TagAttributeInfo();
                    tagAttributeInfo.setName(attributeMetaData.getName());
                    tagAttributeInfo.setType(attributeMetaData.getType());
                    tagAttributeInfo.setReqTime(attributeMetaData.getRtexprvalue());
                    tagAttributeInfo.setRequired(attributeMetaData.getRequired());
                    tagAttributeInfo.setFragment(attributeMetaData.getFragment());
                    if (attributeMetaData.getDeferredValue() != null) {
                        tagAttributeInfo.setDeferredValue("true");
                        tagAttributeInfo.setExpectedTypeName(attributeMetaData.getDeferredValue().getType());
                    } else {
                        tagAttributeInfo.setDeferredValue("false");
                    }
                    if (attributeMetaData.getDeferredMethod() != null) {
                        tagAttributeInfo.setDeferredMethod("true");
                        tagAttributeInfo.setMethodSignature(attributeMetaData.getDeferredMethod().getMethodSignature());
                    } else {
                        tagAttributeInfo.setDeferredMethod("false");
                    }
                    tagInfo.addTagAttributeInfo(tagAttributeInfo);
                }
            }
            tagLibraryInfo.addTagInfo(tagInfo);
        }
    }
    // Tag files
    if (tldMetaData.getTagFiles() != null) {
        for (TagFileMetaData tagFileMetaData : tldMetaData.getTagFiles()) {
            TagFileInfo tagFileInfo = new TagFileInfo();
            tagFileInfo.setName(tagFileMetaData.getName());
            tagFileInfo.setPath(tagFileMetaData.getPath());
            tagLibraryInfo.addTagFileInfo(tagFileInfo);
        }
    }
    // Function
    if (tldMetaData.getFunctions() != null) {
        for (FunctionMetaData functionMetaData : tldMetaData.getFunctions()) {
            FunctionInfo functionInfo = new FunctionInfo();
            functionInfo.setName(functionMetaData.getName());
            functionInfo.setFunctionClass(functionMetaData.getFunctionClass());
            functionInfo.setFunctionSignature(functionMetaData.getFunctionSignature());
            tagLibraryInfo.addFunctionInfo(functionInfo);
        }
    }
    if (jarPath == null && relativeLocation == null) {
        if (!ret.containsKey(tagLibraryInfo.getUri())) {
            ret.put(tagLibraryInfo.getUri(), tagLibraryInfo);
        }
    } else if (jarPath == null) {
        tagLibraryInfo.setLocation("");
        tagLibraryInfo.setPath(relativeLocation);
        if (!ret.containsKey(tagLibraryInfo.getUri())) {
            ret.put(tagLibraryInfo.getUri(), tagLibraryInfo);
        }
        ret.put(relativeLocation, tagLibraryInfo);
    } else {
        tagLibraryInfo.setLocation(relativeLocation);
        tagLibraryInfo.setPath(jarPath);
        if (!ret.containsKey(tagLibraryInfo.getUri())) {
            ret.put(tagLibraryInfo.getUri(), tagLibraryInfo);
        }
        if (jarPath.equals("META-INF/taglib.tld")) {
            ret.put(relativeLocation, tagLibraryInfo);
        }
    }
    return tagLibraryInfo;
}
Also used : ParamValueMetaData(org.jboss.metadata.javaee.spec.ParamValueMetaData) FunctionMetaData(org.jboss.metadata.web.spec.FunctionMetaData) TagFileInfo(org.apache.jasper.deploy.TagFileInfo) AttributeMetaData(org.jboss.metadata.web.spec.AttributeMetaData) TagLibraryValidatorInfo(org.apache.jasper.deploy.TagLibraryValidatorInfo) TagAttributeInfo(org.apache.jasper.deploy.TagAttributeInfo) TagMetaData(org.jboss.metadata.web.spec.TagMetaData) TagVariableInfo(org.apache.jasper.deploy.TagVariableInfo) FunctionInfo(org.apache.jasper.deploy.FunctionInfo) SecurityConstraint(io.undertow.servlet.api.SecurityConstraint) ControlPoint(org.wildfly.extension.requestcontroller.ControlPoint) TagFileMetaData(org.jboss.metadata.web.spec.TagFileMetaData) TagInfo(org.apache.jasper.deploy.TagInfo) Icon(org.jboss.annotation.javaee.Icon) DescriptionGroupMetaData(org.jboss.metadata.javaee.spec.DescriptionGroupMetaData) TagLibraryInfo(org.apache.jasper.deploy.TagLibraryInfo) VariableMetaData(org.jboss.metadata.web.spec.VariableMetaData)

Example 2 with TagAttributeInfo

use of org.apache.jasper.deploy.TagAttributeInfo in project wildfly by wildfly.

the class UndertowDeploymentProcessor method createTldInfo.

private static TagLibraryInfo createTldInfo(final String location, final TldMetaData tldMetaData, final HashMap<String, TagLibraryInfo> ret) {
    String relativeLocation = location;
    String jarPath = null;
    if (relativeLocation != null && relativeLocation.startsWith("/WEB-INF/lib/")) {
        int pos = relativeLocation.indexOf('/', "/WEB-INF/lib/".length());
        if (pos > 0) {
            jarPath = relativeLocation.substring(pos);
            if (jarPath.startsWith("/")) {
                jarPath = jarPath.substring(1);
            }
            relativeLocation = relativeLocation.substring(0, pos);
        }
    }
    TagLibraryInfo tagLibraryInfo = new TagLibraryInfo();
    if (tldMetaData.getListeners() != null) {
        for (ListenerMetaData l : tldMetaData.getListeners()) {
            tagLibraryInfo.addListener(l.getListenerClass());
        }
    }
    tagLibraryInfo.setTlibversion(tldMetaData.getTlibVersion());
    if (tldMetaData.getJspVersion() == null) {
        tagLibraryInfo.setJspversion(tldMetaData.getVersion());
    } else {
        tagLibraryInfo.setJspversion(tldMetaData.getJspVersion());
    }
    tagLibraryInfo.setShortname(tldMetaData.getShortName());
    tagLibraryInfo.setUri(tldMetaData.getUri());
    if (tldMetaData.getDescriptionGroup() != null) {
        tagLibraryInfo.setInfo(tldMetaData.getDescriptionGroup().getDescription());
    }
    // Validator
    if (tldMetaData.getValidator() != null) {
        TagLibraryValidatorInfo tagLibraryValidatorInfo = new TagLibraryValidatorInfo();
        tagLibraryValidatorInfo.setValidatorClass(tldMetaData.getValidator().getValidatorClass());
        if (tldMetaData.getValidator().getInitParams() != null) {
            for (ParamValueMetaData paramValueMetaData : tldMetaData.getValidator().getInitParams()) {
                tagLibraryValidatorInfo.addInitParam(paramValueMetaData.getParamName(), paramValueMetaData.getParamValue());
            }
        }
        tagLibraryInfo.setValidator(tagLibraryValidatorInfo);
    }
    // Tag
    if (tldMetaData.getTags() != null) {
        for (TagMetaData tagMetaData : tldMetaData.getTags()) {
            TagInfo tagInfo = new TagInfo();
            tagInfo.setTagName(tagMetaData.getName());
            tagInfo.setTagClassName(tagMetaData.getTagClass());
            tagInfo.setTagExtraInfo(tagMetaData.getTeiClass());
            if (tagMetaData.getBodyContent() != null) {
                tagInfo.setBodyContent(tagMetaData.getBodyContent().toString());
            }
            tagInfo.setDynamicAttributes(tagMetaData.getDynamicAttributes());
            // Description group
            if (tagMetaData.getDescriptionGroup() != null) {
                DescriptionGroupMetaData descriptionGroup = tagMetaData.getDescriptionGroup();
                if (descriptionGroup.getIcons() != null && descriptionGroup.getIcons().value() != null && (descriptionGroup.getIcons().value().length > 0)) {
                    Icon icon = descriptionGroup.getIcons().value()[0];
                    tagInfo.setLargeIcon(icon.largeIcon());
                    tagInfo.setSmallIcon(icon.smallIcon());
                }
                tagInfo.setInfoString(descriptionGroup.getDescription());
                tagInfo.setDisplayName(descriptionGroup.getDisplayName());
            }
            // Variable
            if (tagMetaData.getVariables() != null) {
                for (VariableMetaData variableMetaData : tagMetaData.getVariables()) {
                    TagVariableInfo tagVariableInfo = new TagVariableInfo();
                    tagVariableInfo.setNameGiven(variableMetaData.getNameGiven());
                    tagVariableInfo.setNameFromAttribute(variableMetaData.getNameFromAttribute());
                    tagVariableInfo.setClassName(variableMetaData.getVariableClass());
                    tagVariableInfo.setDeclare(variableMetaData.getDeclare());
                    if (variableMetaData.getScope() != null) {
                        tagVariableInfo.setScope(variableMetaData.getScope().toString());
                    }
                    tagInfo.addTagVariableInfo(tagVariableInfo);
                }
            }
            // Attribute
            if (tagMetaData.getAttributes() != null) {
                for (AttributeMetaData attributeMetaData : tagMetaData.getAttributes()) {
                    TagAttributeInfo tagAttributeInfo = new TagAttributeInfo();
                    tagAttributeInfo.setName(attributeMetaData.getName());
                    tagAttributeInfo.setType(attributeMetaData.getType());
                    tagAttributeInfo.setReqTime(attributeMetaData.getRtexprvalue());
                    tagAttributeInfo.setRequired(attributeMetaData.getRequired());
                    tagAttributeInfo.setFragment(attributeMetaData.getFragment());
                    if (attributeMetaData.getDeferredValue() != null) {
                        tagAttributeInfo.setDeferredValue("true");
                        tagAttributeInfo.setExpectedTypeName(attributeMetaData.getDeferredValue().getType());
                    } else {
                        tagAttributeInfo.setDeferredValue("false");
                    }
                    if (attributeMetaData.getDeferredMethod() != null) {
                        tagAttributeInfo.setDeferredMethod("true");
                        tagAttributeInfo.setMethodSignature(attributeMetaData.getDeferredMethod().getMethodSignature());
                    } else {
                        tagAttributeInfo.setDeferredMethod("false");
                    }
                    tagInfo.addTagAttributeInfo(tagAttributeInfo);
                }
            }
            tagLibraryInfo.addTagInfo(tagInfo);
        }
    }
    // Tag files
    if (tldMetaData.getTagFiles() != null) {
        for (TagFileMetaData tagFileMetaData : tldMetaData.getTagFiles()) {
            TagFileInfo tagFileInfo = new TagFileInfo();
            tagFileInfo.setName(tagFileMetaData.getName());
            tagFileInfo.setPath(tagFileMetaData.getPath());
            tagLibraryInfo.addTagFileInfo(tagFileInfo);
        }
    }
    // Function
    if (tldMetaData.getFunctions() != null) {
        for (FunctionMetaData functionMetaData : tldMetaData.getFunctions()) {
            FunctionInfo functionInfo = new FunctionInfo();
            functionInfo.setName(functionMetaData.getName());
            functionInfo.setFunctionClass(functionMetaData.getFunctionClass());
            functionInfo.setFunctionSignature(functionMetaData.getFunctionSignature());
            tagLibraryInfo.addFunctionInfo(functionInfo);
        }
    }
    if (jarPath == null && relativeLocation == null) {
        if (!ret.containsKey(tagLibraryInfo.getUri())) {
            ret.put(tagLibraryInfo.getUri(), tagLibraryInfo);
        }
    } else if (jarPath == null) {
        tagLibraryInfo.setLocation("");
        tagLibraryInfo.setPath(relativeLocation);
        if (!ret.containsKey(tagLibraryInfo.getUri())) {
            ret.put(tagLibraryInfo.getUri(), tagLibraryInfo);
        }
        ret.put(relativeLocation, tagLibraryInfo);
    } else {
        tagLibraryInfo.setLocation(relativeLocation);
        tagLibraryInfo.setPath(jarPath);
        if (!ret.containsKey(tagLibraryInfo.getUri())) {
            ret.put(tagLibraryInfo.getUri(), tagLibraryInfo);
        }
        if (jarPath.equals("META-INF/taglib.tld")) {
            ret.put(relativeLocation, tagLibraryInfo);
        }
    }
    return tagLibraryInfo;
}
Also used : ParamValueMetaData(org.jboss.metadata.javaee.spec.ParamValueMetaData) FunctionMetaData(org.jboss.metadata.web.spec.FunctionMetaData) TagFileInfo(org.apache.jasper.deploy.TagFileInfo) AttributeMetaData(org.jboss.metadata.web.spec.AttributeMetaData) TagLibraryValidatorInfo(org.apache.jasper.deploy.TagLibraryValidatorInfo) TagAttributeInfo(org.apache.jasper.deploy.TagAttributeInfo) TagMetaData(org.jboss.metadata.web.spec.TagMetaData) TagVariableInfo(org.apache.jasper.deploy.TagVariableInfo) FunctionInfo(org.apache.jasper.deploy.FunctionInfo) ControlPoint(org.wildfly.extension.requestcontroller.ControlPoint) TagFileMetaData(org.jboss.metadata.web.spec.TagFileMetaData) ListenerMetaData(org.jboss.metadata.web.spec.ListenerMetaData) TagInfo(org.apache.jasper.deploy.TagInfo) Icon(org.jboss.annotation.javaee.Icon) DescriptionGroupMetaData(org.jboss.metadata.javaee.spec.DescriptionGroupMetaData) TagLibraryInfo(org.apache.jasper.deploy.TagLibraryInfo) VariableMetaData(org.jboss.metadata.web.spec.VariableMetaData)

Aggregations

FunctionInfo (org.apache.jasper.deploy.FunctionInfo)2 TagAttributeInfo (org.apache.jasper.deploy.TagAttributeInfo)2 TagFileInfo (org.apache.jasper.deploy.TagFileInfo)2 TagInfo (org.apache.jasper.deploy.TagInfo)2 TagLibraryInfo (org.apache.jasper.deploy.TagLibraryInfo)2 TagLibraryValidatorInfo (org.apache.jasper.deploy.TagLibraryValidatorInfo)2 TagVariableInfo (org.apache.jasper.deploy.TagVariableInfo)2 Icon (org.jboss.annotation.javaee.Icon)2 DescriptionGroupMetaData (org.jboss.metadata.javaee.spec.DescriptionGroupMetaData)2 ParamValueMetaData (org.jboss.metadata.javaee.spec.ParamValueMetaData)2 AttributeMetaData (org.jboss.metadata.web.spec.AttributeMetaData)2 FunctionMetaData (org.jboss.metadata.web.spec.FunctionMetaData)2 TagFileMetaData (org.jboss.metadata.web.spec.TagFileMetaData)2 TagMetaData (org.jboss.metadata.web.spec.TagMetaData)2 VariableMetaData (org.jboss.metadata.web.spec.VariableMetaData)2 ControlPoint (org.wildfly.extension.requestcontroller.ControlPoint)2 SecurityConstraint (io.undertow.servlet.api.SecurityConstraint)1 ListenerMetaData (org.jboss.metadata.web.spec.ListenerMetaData)1