cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r326891 - in /cocoon: blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/ blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/ trunk/src/java/org/apache/cocoon/xml/
Date Thu, 20 Oct 2005 11:33:41 GMT
Author: cziegeler
Date: Thu Oct 20 04:33:28 2005
New Revision: 326891

URL: http://svn.apache.org/viewcvs?rev=326891&view=rev
Log:
Update web.xml mapping
and fix bug in session:getxml when path is a text-element (bug 36471)

Added:
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/ResourceRef.java
  (with props)
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/ResourceRefSet.java
  (with props)
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/SecurityConstraintImpl.java
  (with props)
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/TagDefinitionSet.java
  (with props)
Modified:
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/WebApplicationDefinitionImpl.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/servletdefinitionmapping.xml
    cocoon/trunk/src/java/org/apache/cocoon/xml/IncludeXMLConsumer.java

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/WebApplicationDefinitionImpl.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/WebApplicationDefinitionImpl.java?rev=326891&r1=326890&r2=326891&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/WebApplicationDefinitionImpl.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/WebApplicationDefinitionImpl.java
Thu Oct 20 04:33:28 2005
@@ -51,16 +51,18 @@
     public String icon;
     public String distributable;
     public String sessionConfig;
-    private Collection mimeMappings = new ArrayList();
+    public String mimeMapping;
     public String welcomeFileList;
     public String errorPage;
+    public String taglib;
     public String resourceRef;
-    public String securityConstraint;
     public String loginConfig;
     public String securityRole;
     public String envEntry;
     public String ejbRef;
+    private Collection castorMimeMappings = new ArrayList();
     // </not used variables - only for castor>
+    private Collection securityConstraints = new ArrayList();
 
     private String contextPath;
     private DescriptionSet descriptions = new DescriptionSetImpl();
@@ -72,11 +74,15 @@
     private Collection servletMappings = new ArrayList();
     private ServletDefinitionList servlets = new ServletDefinitionListImpl();
     private SecurityRoleSet securityRoles = new SecurityRoleSetImpl();
-    private Collection castorTagDefinitions = new ArrayList();
 
-    /* (non-Javadoc)
-     * @see org.apache.pluto.om.servlet.WebApplicationDefinition#getId()
-     */
+    // modified by YCLI: START :: to handle multiple taglib tags and resource-ref tag
+    // private TagDefinition castorTagDefinition = new TagDefinition();
+    private TagDefinitionSet taglibs = new TagDefinitionSet();
+    private ResourceRefSet castorResourceRef = new ResourceRefSet();
+    // modified by YCLI: END
+
+    // WebApplicationDefinition implementation.
+    
     public ObjectID getId() {
         if (this.objectId == null) {
             this.objectId = ObjectIDImpl.createFromString(id);
@@ -195,11 +201,6 @@
 
     // additional methods.
 
-    public void setCastorId(String id) {
-        this.id = id;
-        objectId = null;
-    }
-
     public String getCastorId() {
         if (id.length() > 0) {
             return getId().toString();
@@ -230,15 +231,19 @@
     public Collection getServletMappings() {
         return servletMappings;
     }
-
-    protected void setContextRoot(String contextRoot) {
-        // PATCH for IBM WebSphere
-        if (contextRoot != null && contextRoot.endsWith(".war") ) {
-            this.contextPath = contextRoot.substring(0, contextRoot.length()-4);
-        } else {
-            this.contextPath = contextRoot;
-        }
+    public void setCastorId(String id) {        
+        setId(id);
     }
+    
+    protected void setContextRoot(String contextPath)
+    {
+        // Test for IBM WebSphere 
+        if (contextPath != null && contextPath.endsWith(".war"))
+        {
+            contextPath = contextPath.substring(0, contextPath.length()-4);
+        }
+        this.contextPath = contextPath;
+    }    
 
     public void setDescriptions(DescriptionSet descriptions) {
         this.descriptions = descriptions;
@@ -256,29 +261,56 @@
         this.displayNames = castorDisplayNames;
     }
 
+    public void setId(String id) {
+        this.id = id;
+        objectId = null;
+    }
+
+     // modified by YCLI: START :: handling multiple taglib tags and resource-ref tag
+
     /**
-     *
+     * @return Custom tag definitions configured in the webapp.
      */
+    public TagDefinitionSet getTagDefinitionSet() {
+        return taglibs;
+    }
+
     public Collection getCastorTagDefinitions() {
-        return castorTagDefinitions;
+        return taglibs;
     }
 
-    /**
-     * @param definition
-     */
-    public void setCastorTagDefinitions(Collection definition) {
-        castorTagDefinitions = definition;
+    public void setCastorTagDefinitions(TagDefinitionSet taglibs) {
+        this.taglibs = taglibs;
+    }
+
+    public ResourceRefSet getCastorResourceRefSet() {
+        return castorResourceRef;
+    }
+
+    public void setCastorResourceRefSet(ResourceRefSet resourceRefs) {
+        castorResourceRef = resourceRefs;
     }
+    // modified by YCLI: END
+
     /**
-     * @return Returns the mimeMappings.
+     * @return Returns the castorMimeMappings.
      */
-    public Collection getMimeMappings() {
-        return mimeMappings;
+    public Collection getCastorMimeMappings() {
+        return castorMimeMappings;
+    }
+
+    public Collection getSecurityConstraints() {
+        return securityConstraints;
     }
+
     /**
-     * @param mimeMappings The mimeMappings to set.
+     * @param castorMimeMappings The castorMimeMappings to set.
      */
-    public void setMimeMappings(Collection mimeMappings) {
-        this.mimeMappings = mimeMappings;
+    public void setCastorMimeMappings(Collection castorMimeMappings) {
+        this.castorMimeMappings = castorMimeMappings;
+    }
+
+    public void setSecurityConstraints(Collection securityConstraints) {
+        this.securityConstraints = securityConstraints;
     }
 }

Added: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/ResourceRef.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/ResourceRef.java?rev=326891&view=auto
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/ResourceRef.java
(added)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/ResourceRef.java
Thu Oct 20 04:33:28 2005
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2003-2005 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.
+ */
+package org.apache.cocoon.portal.pluto.om.common;
+
+/**
+ *
+ * @version $Id$
+ */
+public class ResourceRef  {
+
+    private String description = "my description";
+    private String name = "name";
+    private String type = "type";
+    private String auth = "container";
+    private String sharing = "shareable";
+
+    /**
+     * @return description of the resource reference.
+     */
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * @return name of the reference.
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Retrieve the type of resource referenced by this
+     * resource reference.
+     * @return the resource type.
+     */
+    public String getType() {
+        return type;
+    }
+
+    /**
+     *
+     * @return the authorization type of the resource.
+     */
+    public String getAuth() {
+        return auth;
+    }
+
+    public String getSharing() {
+        return sharing;
+    }
+
+    /**
+     * @param string the resource reference description.
+     */
+    public void setDescription(String string) {
+        description = string;
+    }
+
+    /**
+     * @param string the name of the resource reference
+     */
+    public void setName(String string) {
+        name = string;
+    }
+
+    public void setType(String string) {
+        type = string;
+    }
+
+    public void setAuth(String string) {
+        auth = string;
+    }
+
+    public void setSharing(String string) {
+        sharing = string;
+    }
+}

Propchange: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/ResourceRef.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/ResourceRef.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/ResourceRefSet.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/ResourceRefSet.java?rev=326891&view=auto
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/ResourceRefSet.java
(added)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/ResourceRefSet.java
Thu Oct 20 04:33:28 2005
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2003-2005 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.
+ */
+package org.apache.cocoon.portal.pluto.om.common;
+
+import java.util.Iterator;
+
+/**
+ * Resource Reference Set as defined by the web.xml as
+ * &lt;resourse-ref&gt;.
+ *
+ * @version $Id$
+ */
+public class ResourceRefSet
+    extends AbstractSupportSet
+    implements java.io.Serializable, Support {
+
+    /**
+     *  Retrieve the Resource Reference
+     */
+    public ResourceRef get(String name) {
+        Iterator it = this.iterator();
+        while(it.hasNext()) {
+            ResourceRef ref = (ResourceRef)it.next();
+            if(ref.getName().equals(name)) {
+                return ref;
+            }
+        }
+        return null;
+    }
+
+    public ResourceRef add(ResourceRef ref) {
+        return this.add(ref);
+    }
+
+    public ResourceRef remove(ResourceRef ref) {
+        Iterator it = this.iterator();
+        while(it.hasNext()) {
+            ResourceRef internal = (ResourceRef)it.next();
+            if(internal.equals(ref)) {
+                it.remove();
+                return internal;
+            }
+        }
+        return null;
+    }
+}

Propchange: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/ResourceRefSet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/ResourceRefSet.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/SecurityConstraintImpl.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/SecurityConstraintImpl.java?rev=326891&view=auto
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/SecurityConstraintImpl.java
(added)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/SecurityConstraintImpl.java
Thu Oct 20 04:33:28 2005
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2003-2005 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.
+ */
+package org.apache.cocoon.portal.pluto.om.common;
+
+/**
+ * Security Constraint Mapping.
+ *
+ * @version $Id$
+ */
+public class SecurityConstraintImpl {
+    // empty class
+}

Propchange: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/SecurityConstraintImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/SecurityConstraintImpl.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/TagDefinitionSet.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/TagDefinitionSet.java?rev=326891&view=auto
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/TagDefinitionSet.java
(added)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/TagDefinitionSet.java
Thu Oct 20 04:33:28 2005
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2003-2005 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.
+ */
+package org.apache.cocoon.portal.pluto.om.common;
+
+import java.util.Locale;
+
+/**
+ *
+ * @version $Id$
+ */
+public class TagDefinitionSet extends AbstractSupportSet
+    implements java.io.Serializable, Support {
+
+    // DescriptionSet implemenation.
+    public TagDefinition get(Locale locale) {        
+	    return null;
+    }
+
+    /**
+     * @see org.apache.cocoon.portal.pluto.om.common.Support#postBuild(java.lang.Object)
+     */
+    public void postBuild(Object parameter) throws Exception {
+        // nothing to do
+    }
+
+    /**
+     * @see org.apache.cocoon.portal.pluto.om.common.Support#postLoad(java.lang.Object)
+     */
+    public void postLoad(Object parameter) throws Exception {
+        // nothing to do
+    }
+
+    /**
+     * @see org.apache.cocoon.portal.pluto.om.common.Support#postStore(java.lang.Object)
+     */
+    public void postStore(Object parameter) throws Exception {
+        // nothing to do
+    }
+
+    /**
+     * @see org.apache.cocoon.portal.pluto.om.common.Support#preBuild(java.lang.Object)
+     */
+    public void preBuild(Object parameter) throws Exception {
+        // nothing to do
+    }
+
+    /**
+     * @see org.apache.cocoon.portal.pluto.om.common.Support#preStore(java.lang.Object)
+     */
+    public void preStore(Object parameter) throws Exception {
+        // nothing to do
+    }
+}

Propchange: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/TagDefinitionSet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/common/TagDefinitionSet.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/servletdefinitionmapping.xml
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/servletdefinitionmapping.xml?rev=326891&r1=326890&r2=326891&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/servletdefinitionmapping.xml
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/om/servletdefinitionmapping.xml
Thu Oct 20 04:33:28 2005
@@ -40,6 +40,30 @@
 
   </class>
 
+  <class name="org.apache.cocoon.portal.pluto.om.common.ResourceRef">
+
+    <field name="description" type="java.lang.String" required="false">
+      <bind-xml name="description" node="element"/>
+    </field>
+
+    <field name="name" type="java.lang.String" required="false">
+      <bind-xml name="res-ref-name" node="element"/>
+    </field>
+
+    <field name="type" type="java.lang.String" required="false">
+      <bind-xml name="res-type" node="element"/>
+    </field>
+
+    <field name="auth" type="java.lang.String" required="false">
+      <bind-xml name="res-auth" node="element"/>
+    </field>
+
+    <field name="sharing" type="java.lang.String" required="false">
+      <bind-xml name="res-sharing-scope" node="element"/>
+    </field>
+
+  </class>
+
   <class name="org.apache.cocoon.portal.pluto.om.common.MimeType">
 
     <field name="extension" type="java.lang.String" required="true">
@@ -52,6 +76,10 @@
 
   </class>
 
+  <class name="org.apache.cocoon.portal.pluto.om.common.SecurityConstraintImpl">
+
+  </class>
+
   <class name="org.apache.cocoon.portal.pluto.om.common.DescriptionImpl">
 
     <field name="description" type="java.lang.String">
@@ -173,6 +201,7 @@
     <field name="castorId" type="java.lang.String">
       <bind-xml name="id" node="attribute"/>
     </field>
+
     <field name="castorDisplayNames" 
          type="org.apache.cocoon.portal.pluto.om.common.DisplayNameImpl"
          collection="collection">
@@ -207,6 +236,12 @@
        <bind-xml name="taglib" node="element" />
     </field>
 
+    <field name="castorResourceRefSet"
+           type="org.apache.cocoon.portal.pluto.om.common.ResourceRef"
+           collection="collection">
+        <bind-xml name="resource-ref" node="element"/>
+    </field>
+
     <!-- only for completion, not used in class file -->
     <field name="icon" transient="true" direct="true">
         <bind-xml name="icon" node="element"/>
@@ -217,7 +252,7 @@
     <field name="sessionConfig" transient="true" direct="true">
         <bind-xml name="session-config" node="element"/>
     </field>
-    <field name="mimeMappings"
+    <field name="castorMimeMappings"
     	transient="true"
     	required="false"
     	type="org.apache.cocoon.portal.pluto.om.common.MimeType"
@@ -231,12 +266,14 @@
         <bind-xml name="error-page" node="element"/>
     </field>
     
-    <field name="resourceRef" transient="true" direct="true">
-        <bind-xml name="resource-ref" node="element"/>
-    </field>
-    <field name="securityConstraint" transient="true" direct="true">
+      <field name="securityConstraints"
+          transient="true"
+          required="false"
+          type="org.apache.cocoon.portal.pluto.om.common.SecurityConstraintImpl"
+          collection="collection">
         <bind-xml name="security-constraint" node="element"/>
     </field>
+
     <field name="loginConfig" transient="true" direct="true">
         <bind-xml name="login-config" node="element"/>
     </field>
@@ -258,4 +295,4 @@
     </field>
   </class>
   
-</mapping>
\ No newline at end of file
+</mapping>

Modified: cocoon/trunk/src/java/org/apache/cocoon/xml/IncludeXMLConsumer.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/xml/IncludeXMLConsumer.java?rev=326891&r1=326890&r2=326891&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/xml/IncludeXMLConsumer.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/xml/IncludeXMLConsumer.java Thu Oct 20 04:33:28
2005
@@ -98,17 +98,22 @@
                                    LexicalHandler lexicalHandler)
     throws SAXException {
         if (node != null) {
-            try {
-                IncludeXMLConsumer filter = new IncludeXMLConsumer(contentHandler, lexicalHandler);
-                Transformer transformer = FACTORY.newTransformer();
-                DOMSource source = new DOMSource(node);
-                SAXResult result = new SAXResult(filter);
-                result.setLexicalHandler(filter);
-                transformer.transform(source, result);
-            } catch (TransformerConfigurationException e) {
-                throw new SAXException("TransformerConfigurationException", e);
-            } catch (TransformerException e) {
-                throw new SAXException("TransformerException", e);
+            if (node.getNodeType() == Node.TEXT_NODE){
+                String value = node.getNodeValue();
+                contentHandler.characters(value.toCharArray(), 0, value.length());
+            } else {
+                try {
+                    IncludeXMLConsumer filter = new IncludeXMLConsumer(contentHandler, lexicalHandler);
+                    Transformer transformer = FACTORY.newTransformer();
+                    DOMSource source = new DOMSource(node);
+                    SAXResult result = new SAXResult(filter);
+                    result.setLexicalHandler(filter);
+                    transformer.transform(source, result);
+                } catch (TransformerConfigurationException e) {
+                    throw new SAXException("TransformerConfigurationException", e);
+                } catch (TransformerException e) {
+                    throw new SAXException("TransformerException", e);
+                }
             }
         }
     }



Mime
View raw message