[jboss-cvs] JBossAS SVN: r68729 - branches/Branch_4_2/server/src/main/org/jboss/metadata.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Jan 9 08:15:57 EST 2008


Author: alessio.soldano at jboss.com
Date: 2008-01-09 08:15:56 -0500 (Wed, 09 Jan 2008)
New Revision: 68729

Modified:
   branches/Branch_4_2/server/src/main/org/jboss/metadata/WebMetaData.java
Log:
[JBAS-5109] Adding context-params to the WebMetaData


Modified: branches/Branch_4_2/server/src/main/org/jboss/metadata/WebMetaData.java
===================================================================
--- branches/Branch_4_2/server/src/main/org/jboss/metadata/WebMetaData.java	2008-01-09 12:34:08 UTC (rev 68728)
+++ branches/Branch_4_2/server/src/main/org/jboss/metadata/WebMetaData.java	2008-01-09 13:15:56 UTC (rev 68729)
@@ -64,6 +64,8 @@
    /** init parameter servletName->Map **/
    private HashMap servletParams= new HashMap();
 
+   /** The web.xml context-param <String,String> **/
+   private HashMap contextParams= new HashMap();
    /** The web.xml servlet-mapping <String, String> */
    private HashMap servletMappings = new HashMap();
    /** The web.xml resource-refs <String, String> */
@@ -560,6 +562,26 @@
    }
 
    /**
+    * Get the context-param values from the web.xml descriptor
+    * @return Map<String,String> of param-name/param-value from the web-xml
+    */
+   public HashMap getContextParams()
+   {
+      return contextParams;
+   }
+
+   /**
+    * Set the context-params
+    * 
+    * @param contextParams - Map<String,String>
+    */
+   public void setContextParams(Map contextParams)
+   {
+      this.contextParams.clear();
+      this.contextParams.putAll(contextParams);
+   }
+
+   /**
     * Get the servlet-name values from the web.xml descriptor
     * @return Set<String> of the servlet-names from the servlet-mappings
     */
@@ -838,6 +860,16 @@
             runAsNames.put(servletName, runAsName);
          }
       }
+      
+      // Parse the web-app/context-param elements
+      iterator = getChildrenByTagName(webApp, "context-param");
+      while (iterator.hasNext())
+      {
+         Element contextParam = (Element)iterator.next();
+         String paramName = getElementContent(getUniqueChild(contextParam, "param-name"));
+         String paramValue = getElementContent(getUniqueChild(contextParam, "param-value"));
+         contextParams.put(paramName, paramValue);
+      }
 
       // Parse the web-app/servlet-mapping elements
       iterator = getChildrenByTagName(webApp, "servlet-mapping");
@@ -1331,4 +1363,5 @@
       }
 
    }
+
 }




More information about the jboss-cvs-commits mailing list