You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-dev@portals.apache.org by bl...@apache.org on 2004/04/26 14:02:01 UTC
cvs commit: jakarta-pluto/portal/src/java/org/apache/pluto/portalImpl Deploy.java
blumm 2004/04/26 05:02:01
Modified: portal/src/java/org/apache/pluto/portalImpl/om/servlet/impl
WebApplicationDefinitionImpl.java
portal/src/webapp/WEB-INF/data/xml
servletdefinitionmapping.xml
portal/src/java/org/apache/pluto/portalImpl Deploy.java
Added: portal/src/java/org/apache/pluto/portalImpl/om/servlet/impl
TagDefinitionImpl.java
Log:
PR:26389
This fix allows multiple taglibs in a web.xml of a portlet application.
Revision Changes Path
1.4 +15 -6 jakarta-pluto/portal/src/java/org/apache/pluto/portalImpl/om/servlet/impl/WebApplicationDefinitionImpl.java
Index: WebApplicationDefinitionImpl.java
===================================================================
RCS file: /home/cvs/jakarta-pluto/portal/src/java/org/apache/pluto/portalImpl/om/servlet/impl/WebApplicationDefinitionImpl.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- WebApplicationDefinitionImpl.java 2 Mar 2004 14:49:02 -0000 1.3
+++ WebApplicationDefinitionImpl.java 26 Apr 2004 12:02:01 -0000 1.4
@@ -55,7 +55,6 @@
public String mimeMapping = null;
public String welcomeFileList = null;
public String errorPage = null;
- public String taglib = null;
public String resourceRef = null;
public String securityConstraint = null;
public String loginConfig = null;
@@ -74,7 +73,7 @@
private Collection servletMappings = new ArrayList();
private ServletDefinitionList servlets = new ServletDefinitionListImpl();
private SecurityRoleSet securityRoles = new org.apache.pluto.portalImpl.om.common.impl.SecurityRoleSetImpl();
- private TagDefinition castorTagDefinition = new TagDefinition();
+ private Collection castorTagDefinitions = new ArrayList();
// WebApplicationDefinition implementation.
@@ -292,6 +291,16 @@
while (iterator.hasNext()) {
buffer.append(((ServletMappingImpl)iterator.next()).toString(indent+2));
}
+
+ iterator = castorTagDefinitions.iterator();
+ if (iterator.hasNext()) {
+ StringUtils.newLine(buffer,indent);
+ buffer.append("CastorTagDefinitions:");
+ }
+ while (iterator.hasNext()) {
+ buffer.append(((TagDefinitionImpl)iterator.next()).toString(indent+2));
+ }
+
StringUtils.newLine(buffer,indent);
buffer.append("contextPath='"); buffer.append(contextPath); buffer.append("'");
StringUtils.newLine(buffer,indent);
@@ -302,14 +311,14 @@
/**
* @return
*/
- public TagDefinition getCastorTagDefinition() {
- return castorTagDefinition;
+ public Collection getCastorTagDefinitions() {
+ return castorTagDefinitions;
}
/**
* @param definition
*/
- public void setCastorTagDefinition(TagDefinition definition) {
- castorTagDefinition = definition;
+ public void setCastorTagDefinitions(Collection definition) {
+ castorTagDefinitions = definition;
}
}
1.1 jakarta-pluto/portal/src/java/org/apache/pluto/portalImpl/om/servlet/impl/TagDefinitionImpl.java
Index: TagDefinitionImpl.java
===================================================================
/*
* Copyright 2003,2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* (C) Copyright IBM Corp. 2003
*/
package org.apache.pluto.portalImpl.om.servlet.impl;
import org.apache.pluto.util.StringUtils;
public class TagDefinitionImpl implements java.io.Serializable {
private String uri ="http://java.sun.com/portlet";
private String location = "/WEB-INF/tld/portlet.tld";
public TagDefinitionImpl()
{
super();
}
/**
* @return
*/
public String getLocation() {
return location;
}
/**
* @return
*/
public String getUri() {
return uri;
}
/**
* @param string
*/
public void setLocation(String string) {
location = string;
}
/**
* @param string
*/
public void setUri(String string) {
uri = string;
}
// internal methods used for debugging purposes only
public String toString()
{
return toString(0);
}
public String toString(int indent)
{
StringBuffer buffer = new StringBuffer(50);
StringUtils.newLine(buffer,indent);
buffer.append(getClass().toString()); buffer.append(":");
StringUtils.newLine(buffer,indent);
buffer.append("{");
StringUtils.newLine(buffer,indent);
buffer.append("taglib-uri='"); buffer.append(this.getUri()); buffer.append("'");
StringUtils.newLine(buffer,indent);
buffer.append("taglib-location='"); buffer.append(this.getLocation()); buffer.append("'");
StringUtils.newLine(buffer,indent);
buffer.append("}");
return buffer.toString();
}
}
1.4 +5 -3 jakarta-pluto/portal/src/webapp/WEB-INF/data/xml/servletdefinitionmapping.xml
Index: servletdefinitionmapping.xml
===================================================================
RCS file: /home/cvs/jakarta-pluto/portal/src/webapp/WEB-INF/data/xml/servletdefinitionmapping.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- servletdefinitionmapping.xml 2 Mar 2004 15:01:23 -0000 1.3
+++ servletdefinitionmapping.xml 26 Apr 2004 12:02:01 -0000 1.4
@@ -29,7 +29,7 @@
</field>
</class>
- <class name="org.apache.pluto.portalImpl.om.servlet.impl.TagDefinition">
+ <class name="org.apache.pluto.portalImpl.om.servlet.impl.TagDefinitionImpl">
<field name="uri" type="java.lang.String" required="true">
<bind-xml name="taglib-uri" node="element"/>
@@ -191,7 +191,9 @@
<bind-xml name="servlet-mapping" node="element"/>
</field>
- <field name="castorTagDefinition" type="org.apache.pluto.portalImpl.om.servlet.impl.TagDefinition">
+ <field name="castorTagDefinitions"
+ type="org.apache.pluto.portalImpl.om.servlet.impl.TagDefinitionImpl"
+ collection="collection">
<bind-xml name="taglib" node="element" />
</field>
@@ -242,4 +244,4 @@
</field>
</class>
-</mapping>
\ No newline at end of file
+</mapping>
1.6 +9 -1 jakarta-pluto/portal/src/java/org/apache/pluto/portalImpl/Deploy.java
Index: Deploy.java
===================================================================
RCS file: /home/cvs/jakarta-pluto/portal/src/java/org/apache/pluto/portalImpl/Deploy.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Deploy.java 3 Mar 2004 11:58:29 -0000 1.5
+++ Deploy.java 26 Apr 2004 12:02:01 -0000 1.6
@@ -51,8 +51,9 @@
import org.apache.pluto.portalImpl.om.common.impl.DisplayNameImpl;
import org.apache.pluto.portalImpl.om.common.impl.DisplayNameSetImpl;
import org.apache.pluto.portalImpl.om.portlet.impl.PortletApplicationDefinitionImpl;
-import org.apache.pluto.portalImpl.om.servlet.impl.ServletMappingImpl;
import org.apache.pluto.portalImpl.om.servlet.impl.ServletDefinitionImpl;
+import org.apache.pluto.portalImpl.om.servlet.impl.ServletMappingImpl;
+import org.apache.pluto.portalImpl.om.servlet.impl.TagDefinitionImpl;
import org.apache.pluto.portalImpl.om.servlet.impl.WebApplicationDefinitionImpl;
import org.apache.pluto.portalImpl.xml.Constants;
import org.apache.pluto.portalImpl.xml.XmlParser;
@@ -189,6 +190,7 @@
XmlParser.parseWebXml(new FileInputStream(webXml));
Unmarshaller unmarshallerWeb = new Unmarshaller(mappingWebXml);
+ unmarshallerWeb.setIgnoreExtraElements(true);
webApp =
(WebApplicationDefinitionImpl) unmarshallerWeb.unmarshal(
webDocument);
@@ -361,6 +363,12 @@
}
}
+
+ TagDefinitionImpl portletTagLib =
+ new TagDefinitionImpl();
+ Collection taglibs = webApp.getCastorTagDefinitions();
+ taglibs.add(portletTagLib);
+
if (debug) {
System.out.println(webApp);