axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r778244 - /webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java
Date Sun, 24 May 2009 22:24:48 GMT
Author: veithen
Date: Sun May 24 22:24:48 2009
New Revision: 778244

URL: http://svn.apache.org/viewvc?rev=778244&view=rev
Log:
Use MessageContext#getModuleParameter so that includeOptionalHeaders and disableAddressingForOutMessages
can be specified in a <moduleConfig> element.

Modified:
    webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java

Modified: webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java?rev=778244&r1=778243&r2=778244&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java
(original)
+++ webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java
Sun May 24 22:24:48 2009
@@ -41,8 +41,6 @@
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.description.AxisEndpoint;
 import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.HandlerDescription;
-import org.apache.axis2.description.Parameter;
 import org.apache.axis2.handlers.AbstractHandler;
 import org.apache.axis2.util.JavaUtils;
 import org.apache.axis2.util.LoggingControl;
@@ -60,36 +58,17 @@
 
     private static final Log log = LogFactory.getLog(AddressingOutHandler.class);
 
-    private boolean includeOptionalHeaders;
-    private boolean disableAddressing;
-
-    public void init(HandlerDescription arg0) {
-        super.init(arg0);
-
-        //Determine whether to include optional addressing headers in the output message.
-        //The default is not to include any headers that can be safely omitted.
-        Parameter param = arg0.getParameter(INCLUDE_OPTIONAL_HEADERS);
-        String value = Utils.getParameterValue(param);
-        includeOptionalHeaders = JavaUtils.isTrueExplicitly(value);
-
-        if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
-            log.debug("includeOptionalHeaders=" + includeOptionalHeaders);
-        }
-
-        //Determine whether to disable the handler by default.
-        param = arg0.getParameter(DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
-        value = Utils.getParameterValue(param);
-        disableAddressing = JavaUtils.isTrueExplicitly(value);
-
-        if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
-            log.debug("disableAddressing=" + disableAddressing);
-        }
-    }
-
+    // TODO: This is required for MessageContext#getModuleParameter.
+    //       Not clear why there is no way to automatically determine this!
+    private static final String MODULE_NAME = "addressing";
+    
     public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
         //determine whether outbound addressing has been disabled or not.
         boolean disableAddressing =
-            msgContext.isPropertyTrue(DISABLE_ADDRESSING_FOR_OUT_MESSAGES, this.disableAddressing);
+            msgContext.isPropertyTrue(DISABLE_ADDRESSING_FOR_OUT_MESSAGES)
+             || JavaUtils.isTrueExplicitly(Utils.getParameterValue(
+                     msgContext.getModuleParameter(DISABLE_ADDRESSING_FOR_OUT_MESSAGES,
+                     MODULE_NAME, handlerDesc)));
 
         if (disableAddressing) {
             if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
@@ -110,7 +89,10 @@
 
         // Determine whether to include optional addressing headers in the output.
         boolean includeOptionalHeaders =
-            msgContext.isPropertyTrue(INCLUDE_OPTIONAL_HEADERS, this.includeOptionalHeaders);
+            msgContext.isPropertyTrue(INCLUDE_OPTIONAL_HEADERS)
+             || JavaUtils.isTrueExplicitly(Utils.getParameterValue(
+                     msgContext.getModuleParameter(INCLUDE_OPTIONAL_HEADERS, MODULE_NAME,
+                     handlerDesc)));
 
         if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
             log.debug("includeOptionalHeaders=" + includeOptionalHeaders);



Mime
View raw message