[jboss-cvs] JBossAS SVN: r79470 - trunk/tomcat/src/main/org/jboss/web/tomcat/metadata.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Oct 14 12:42:38 EDT 2008


Author: remy.maucherat at jboss.com
Date: 2008-10-14 12:42:38 -0400 (Tue, 14 Oct 2008)
New Revision: 79470

Modified:
   trunk/tomcat/src/main/org/jboss/web/tomcat/metadata/ContextXMLObjectModelFactory.java
Log:
- Handle SessionCookie (actually one of the most in demand features).
- Forgot the attributes of the root element. Ooops.

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/metadata/ContextXMLObjectModelFactory.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/metadata/ContextXMLObjectModelFactory.java	2008-10-14 16:33:57 UTC (rev 79469)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/metadata/ContextXMLObjectModelFactory.java	2008-10-14 16:42:38 UTC (rev 79470)
@@ -42,6 +42,17 @@
    public Object newRoot(Object root, UnmarshallingContext ctx, String namespaceURI, String localName, Attributes attrs)
    {
       ContextMetaData metaData = new ContextMetaData();
+      if(attrs != null)
+      {
+         for(int i = 0; i <attrs.getLength(); i++)
+         {
+            String key = attrs.getLocalName(i);
+            String value = attrs.getValue(i);
+            if( metaData.getAttributes() == null)
+               metaData.setAttributes(new HashMap<String, Object>());
+            metaData.getAttributes().put(key, value);
+         }
+      }
       return metaData;
    }
    
@@ -104,8 +115,6 @@
       Set<String> excludeAttributes = new HashSet<String>();
       Object child = null;
 
-      // TODO child.setName(attrs.getValue("name"));
-      
       if(parent instanceof ContextMetaData)
       {
          // <Valve/>         
@@ -120,8 +129,13 @@
          // <SessionCookie/>
          else if("SessionCookie".equals(localName))
          {
-            child = new SessionCookieMetaData();
-            // FIXME: attributes
+            SessionCookieMetaData sessionCookie = new SessionCookieMetaData();
+            sessionCookie.setComment(getAttribute("comment", null, attrs));
+            sessionCookie.setDomain(getAttribute("domain", null, attrs));
+            sessionCookie.setPath(getAttribute("path", null, attrs));
+            sessionCookie.setHttpOnly(Boolean.parseBoolean(getAttribute("httpOnly", null, attrs)));
+            sessionCookie.setSecure(Boolean.parseBoolean(getAttribute("secure", null, attrs)));
+            child = sessionCookie;
          }
          // <Resources/>
          else if("Resources".equals(localName))




More information about the jboss-cvs-commits mailing list