[jboss-cvs] JBossAS SVN: r93220 - trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Sep 4 21:06:43 EDT 2009
Author: remy.maucherat at jboss.com
Date: 2009-09-04 21:06:43 -0400 (Fri, 04 Sep 2009)
New Revision: 93220
Modified:
trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/JBossContextConfig.java
Log:
- Add the TLD processing code (with a big bug until metadata is updated).
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/JBossContextConfig.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/JBossContextConfig.java 2009-09-04 18:33:23 UTC (rev 93219)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/JBossContextConfig.java 2009-09-05 01:06:43 UTC (rev 93220)
@@ -44,7 +44,12 @@
import org.apache.catalina.core.StandardContext;
import org.apache.catalina.deploy.JspPropertyGroup;
import org.apache.catalina.deploy.SessionCookie;
+import org.apache.catalina.deploy.jsp.FunctionInfo;
+import org.apache.catalina.deploy.jsp.TagAttributeInfo;
+import org.apache.catalina.deploy.jsp.TagInfo;
import org.apache.catalina.deploy.jsp.TagLibraryInfo;
+import org.apache.catalina.deploy.jsp.TagLibraryValidatorInfo;
+import org.apache.catalina.deploy.jsp.TagVariableInfo;
import org.apache.catalina.startup.ContextConfig;
import org.apache.catalina.startup.WebAnnotationSet;
import org.apache.tomcat.util.IntrospectionUtils;
@@ -65,6 +70,7 @@
import org.jboss.metadata.web.jboss.JBossServletMetaData;
import org.jboss.metadata.web.jboss.JBossServletsMetaData;
import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.metadata.web.spec.AttributeMetaData;
import org.jboss.metadata.web.spec.AuthConstraintMetaData;
import org.jboss.metadata.web.spec.CookieConfigMetaData;
import org.jboss.metadata.web.spec.DispatcherType;
@@ -72,6 +78,7 @@
import org.jboss.metadata.web.spec.FilterMappingMetaData;
import org.jboss.metadata.web.spec.FilterMetaData;
import org.jboss.metadata.web.spec.FiltersMetaData;
+import org.jboss.metadata.web.spec.FunctionMetaData;
import org.jboss.metadata.web.spec.JspConfigMetaData;
import org.jboss.metadata.web.spec.JspPropertyGroupMetaData;
import org.jboss.metadata.web.spec.ListenerMetaData;
@@ -83,9 +90,11 @@
import org.jboss.metadata.web.spec.ServletMappingMetaData;
import org.jboss.metadata.web.spec.SessionConfigMetaData;
import org.jboss.metadata.web.spec.SessionTrackingModeType;
+import org.jboss.metadata.web.spec.TagMetaData;
import org.jboss.metadata.web.spec.TaglibMetaData;
import org.jboss.metadata.web.spec.TldMetaData;
import org.jboss.metadata.web.spec.TransportGuaranteeType;
+import org.jboss.metadata.web.spec.VariableMetaData;
import org.jboss.metadata.web.spec.WebResourceCollectionMetaData;
import org.jboss.metadata.web.spec.WebResourceCollectionsMetaData;
import org.jboss.metadata.web.spec.WelcomeFileListMetaData;
@@ -797,31 +806,158 @@
ArrayList<TagLibraryInfo> tagLibraries = new ArrayList<TagLibraryInfo>();
String base = deploymentUnitLocal.get().getName();
+ int pos = base.indexOf(':');
+ if (pos > 0)
+ {
+ base = base.substring(pos);
+ }
Iterator<String> locationInterator = tldMetaDataMap.keySet().iterator();
while (locationInterator.hasNext())
{
String location = locationInterator.next();
+ TldMetaData tldMetaData = tldMetaDataMap.get(location);
+ pos = location.indexOf(':');
+ if (pos > 0)
+ {
+ location = location.substring(pos);
+ }
if (!location.startsWith(base))
{
// If there is only one TLD, it will also get mapped as this attachement
continue;
}
- TldMetaData tldMetaData = tldMetaDataMap.get(location);
String relativeLocation = "/" + location.substring(base.length());
String jarPath = null;
if (relativeLocation.startsWith("/WEB-INF/lib/"))
{
- int pos = relativeLocation.indexOf('/', "/WEB-INF/lib/".length());
+ 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);
}
}
System.out.println("Add TLD: " + relativeLocation + " " + jarPath + " [" + tldMetaData + "]");
+
+ TagLibraryInfo tagLibraryInfo = new TagLibraryInfo();
+ tagLibraryInfo.setTlibversion(tldMetaData.getTlibVersion());
+ tagLibraryInfo.setJspversion(tldMetaData.getJspVersion());
+ tagLibraryInfo.setShortname(tldMetaData.getShortName());
+ tagLibraryInfo.setUri(tldMetaData.getUri());
+ // Listener
+ if (tldMetaData.getListeners() != null)
+ {
+ for (ListenerMetaData listener : tldMetaData.getListeners())
+ {
+ tagLibraryInfo.addListener(listener.getListenerClass());
+ }
+ }
+ // 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());
+ // 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());
+ 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());
+ // FIXME: the commented out block is the right one ...
+ /*if (attributeMetaData.getDeferredValue() != null)
+ tagAttributeInfo.setDeferredValue(attributeMetaData.getDeferredValue().getType());
+ if (attributeMetaData.getDeferredMethod() != null)
+ tagAttributeInfo.setDeferredMethod(attributeMetaData.getDeferredMethod().getMethodSignature());*/
+ if (attributeMetaData.getDeferredValue() != null)
+ tagAttributeInfo.setDeferredValue(attributeMetaData.getDeferredValue().getMethodSignature());
+ if (attributeMetaData.getDeferredMethod() != null)
+ tagAttributeInfo.setDeferredMethod(attributeMetaData.getDeferredMethod().getType());
+ tagInfo.addTagAttributeInfo(tagAttributeInfo);
+ }
+ }
+ tagLibraryInfo.addTagInfo(tagInfo);
+ }
+ }
+ // 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)
+ {
+ tagLibraryInfo.setLocation("");
+ tagLibraryInfo.setPath(relativeLocation);
+ tagLibraries.add(tagLibraryInfo);
+ context.addJspTagLibrary(tagLibraryInfo);
+ context.addJspTagLibrary(relativeLocation, tagLibraryInfo);
+ }
+ else
+ {
+ tagLibraryInfo.setLocation(relativeLocation);
+ tagLibraryInfo.setPath(jarPath);
+ tagLibraries.add(tagLibraryInfo);
+ context.addJspTagLibrary(tagLibraryInfo);
+ if (jarPath.equals("META-INF/taglib.tld"))
+ {
+ context.addJspTagLibrary(relativeLocation, tagLibraryInfo);
+ }
+ }
+
}
-
+
// Add additional TLDs URIs from explicit web config
String taglibs[] = context.findTaglibs();
for (int i = 0; i < taglibs.length; i++) {
More information about the jboss-cvs-commits
mailing list