You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sc...@apache.org on 2007/07/16 23:29:04 UTC

svn commit: r556742 - /webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/TransportHeadersAdapter.java

Author: scheu
Date: Mon Jul 16 14:28:59 2007
New Revision: 556742

URL: http://svn.apache.org/viewvc?view=rev&rev=556742
Log:
AXIS2-2974
Contributor: Lin Sun
Typo fixes.

(Committer Scheu: Also did some reformatting)

Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/TransportHeadersAdapter.java

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/TransportHeadersAdapter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/TransportHeadersAdapter.java?view=diff&rev=556742&r1=556741&r2=556742
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/TransportHeadersAdapter.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/TransportHeadersAdapter.java Mon Jul 16 14:28:59 2007
@@ -35,25 +35,27 @@
 
 /**
  * The JAX-WS exposes transport properties whose value is Map<String, List<String>>.  The
- * String is the content-id and DataHandler is the data handler representing the attachment.
+ * String is the content-id and DataHandler is the data handler representing the TransportHeaders.
  * 
  * The JAX-WS MessageContext stores transport properties in an Map object located on the AXIS2
  * MessageContext.
  * 
- * This class, TransportHeadersAdapter, is an adapter between the Map<String, List<String>> interface needed
- * by the properties and the actual implementation.  All useful function is delegated through the MessageContext, so 
- * that we only have one copy of the information.  
+ * This class, TransportHeadersAdapter, is an adapter between the Map<String, List<String>> 
+ * interface needed by the properties and the actual implementation.  
+ * All useful function is delegated through the MessageContext, 
+ * so that we only have one copy of the information.  
  * 
- * To use this class, invoke the install method.  This will create an TransportHeadersAdapter (if necessary) and install it
- * on the property JAX-WS standard attachment property.  (See BaseMessageContext.)
+ * To use this class, invoke the install method.  This will create an TransportHeadersAdapter 
+ * (if necessary) and install it on the property JAX-WS standard TransportHeaders properties.  
+ * (See BaseMessageContext.)
  */
 public class TransportHeadersAdapter implements Map {
 
     private static final Log log = LogFactory.getLog(TransportHeadersAdapter.class);
-    
-    MessageContext mc;    // MessageContext which provides the backing implementation
-    String propertyName;  // The name of the JAX-WS property
-    
+
+    MessageContext mc; // MessageContext which provides the backing implementation
+    String propertyName; // The name of the JAX-WS property
+
     /**
      * @param mc
      * @param propertyName
@@ -64,48 +66,49 @@
     }
 
     /**
-     * Add the AttachmentAdapter as the property for the inbound or
-     * outbound attachment property
+     * Add the TransportHeadersAdapter as the property for TransportHeaders
      * @param mc MessageContext
      */
     public static void install(MessageContext mc) {
-        
+
         boolean isRequest = (mc.getMEPContext().getRequestMessageContext() == mc);
-        
+
         // The property is either a request or response
-        String propertyName = (isRequest) ?
-                javax.xml.ws.handler.MessageContext.HTTP_REQUEST_HEADERS :
-                javax.xml.ws.handler.MessageContext.HTTP_RESPONSE_HEADERS;
-        
-        
+        String propertyName =
+                (isRequest) ? javax.xml.ws.handler.MessageContext.HTTP_REQUEST_HEADERS
+                        : javax.xml.ws.handler.MessageContext.HTTP_RESPONSE_HEADERS;
+
+
         if (log.isDebugEnabled()) {
-            log.debug("Installing AttachmentsAdapter for " + propertyName);
+            log.debug("Installing TransportHeadersAdapter for " + propertyName);
         }
-        
+
         // See if there is an existing map
         Object map = mc.getProperty(propertyName);
-        
-        // Reuse existing AttachmentsAdapter
+
+        // Reuse existing TransportHeadersAdapter
         if (map instanceof TransportHeadersAdapter) {
             if (log.isDebugEnabled()) {
-                log.debug("An TransportHeadersAdapter is already installed.  Reusing the existing one.");
+                log.debug("An TransportHeadersAdapter is already installed.  " +
+                                "Reusing the existing one.");
             }
             return;
-        } 
-        
-        // Create a new AttachmentsAdapter and set it on the property 
+        }
+
+        // Create a new TransportHeadersAdapter and set it on the property 
         TransportHeadersAdapter tha = new TransportHeadersAdapter(mc, propertyName);
-        
+
         if (map != null) {
             if (log.isDebugEnabled()) {
-                log.debug("The TransportHeaders in the existing map (" + propertyName + ") are copied to the TransportHeadersAdapter.");
+                log.debug("The TransportHeaders in the existing map (" + propertyName
+                        + ") are copied to the TransportHeadersAdapter.");
             }
             // Copy the existing Map contents to this new adapter
             tha.putAll((Map) map);
         }
         mc.setProperty(propertyName, tha);
     }
-    
+
     /**
      * Get/Create the implementation map from the Axis2 properties
      * @param mc
@@ -120,7 +123,7 @@
         }
         return map;
     }
-    
+
     /**
      * Convert intput into a List
      * @param o
@@ -136,17 +139,18 @@
             l.add(o);
             return l;
         } else {
-            throw ExceptionFactory.makeWebServiceException("Cannot convert from " + o.getClass() + " to List<String>");
+            throw ExceptionFactory.makeWebServiceException("Cannot convert from " + o.getClass()
+                    + " to List<String>");
         }
     }
-    
+
     private static String convertToString(Object o) {
         if (o == null) {
             return null;
         } else if (o instanceof String) {
             return (String) o;
         } else if (o instanceof List) {
-           
+
             List l = (List) o;
             if (l.size() == 0) {
                 return null;
@@ -154,10 +158,11 @@
                 return (String) l.get(0);
             }
         }
-        throw ExceptionFactory.makeWebServiceException("Cannot convert from " + o.getClass() + " to String");
+        throw ExceptionFactory.makeWebServiceException("Cannot convert from " + o.getClass()
+                + " to String");
     }
-    
-    
+
+
     public int size() {
         return getDelegateMap(mc).size();
     }
@@ -197,7 +202,7 @@
     }
 
     public void putAll(Map t) {
-        for(Object key: t.keySet()) {
+        for (Object key : t.keySet()) {
             Object value = t.get(key);
             if (log.isDebugEnabled()) {
                 log.debug("put via putAll (" + key + " , " + value + ")");
@@ -211,7 +216,7 @@
     }
 
     public Set keySet() {
-       return getDelegateMap(mc).keySet();
+        return getDelegateMap(mc).keySet();
     }
 
     public Collection values() {
@@ -225,5 +230,4 @@
         tempMap.putAll(this);
         return tempMap.entrySet();
     }
-
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org