Author: remy.maucherat(a)jboss.com
Date: 2007-09-10 10:50:39 -0400 (Mon, 10 Sep 2007)
New Revision: 274
Modified:
tags/JBOSSWEB_2_0_0_GA_CP01/src/share/classes/org/apache/catalina/startup/WebRuleSet.java
Log:
- Port patch to fix service-ref element handling (JBWEB-85).
Modified:
tags/JBOSSWEB_2_0_0_GA_CP01/src/share/classes/org/apache/catalina/startup/WebRuleSet.java
===================================================================
---
tags/JBOSSWEB_2_0_0_GA_CP01/src/share/classes/org/apache/catalina/startup/WebRuleSet.java 2007-09-07
10:41:25 UTC (rev 273)
+++
tags/JBOSSWEB_2_0_0_GA_CP01/src/share/classes/org/apache/catalina/startup/WebRuleSet.java 2007-09-10
14:50:39 UTC (rev 274)
@@ -24,6 +24,8 @@
import org.apache.catalina.Context;
import org.apache.catalina.Wrapper;
+import org.apache.catalina.deploy.ContextHandler;
+import org.apache.catalina.deploy.ContextService;
import org.apache.catalina.deploy.SecurityConstraint;
import org.apache.tomcat.util.IntrospectionUtils;
import org.apache.tomcat.util.digester.CallMethodRule;
@@ -40,7 +42,7 @@
* deployment descriptor (<code>/WEB-INF/web.xml</code>) resource.</p>
*
* @author Craig R. McClanahan
- * @version $Revision: 513349 $ $Date: 2007-03-01 15:33:06 +0100 (jeu., 01 mars 2007) $
+ * @version $Revision: 550263 $ $Date: 2007-06-24 19:28:45 +0200 (dim., 24 juin 2007) $
*/
public class WebRuleSet extends RuleSetBase {
@@ -391,10 +393,7 @@
"setWsdlfile", 0);
digester.addCallMethod(prefix +
"web-app/service-ref/jaxrpc-mapping-file",
"setJaxrpcmappingfile", 0);
- digester.addCallMethod(prefix +
"web-app/service-ref/service-qname/namespaceURI",
- "setServiceqnameNamespaceURI", 0);
- digester.addCallMethod(prefix +
"web-app/service-ref/service-qname/localpart",
- "setServiceqnameLocalpart", 0);
+ digester.addRule(prefix + "web-app/service-ref/service-qname", new
ServiceQnameRule());
digester.addRule(prefix + "web-app/service-ref/port-component-ref",
new CallMethodMultiRule("addPortcomponent", 2,
1));
@@ -419,12 +418,7 @@
digester.addCallParam(prefix +
"web-app/service-ref/handler/init-param/param-value",
1);
- digester.addCallMethod(prefix +
"web-app/service-ref/handler/soap-header",
- "addSoapHeaders", 2);
- digester.addCallParam(prefix +
"web-app/service-ref/handler/soap-header/localpart",
- 0);
- digester.addCallParam(prefix +
"web-app/service-ref/handler/soap-header/namespaceURI",
- 1);
+ digester.addRule(prefix + "web-app/service-ref/handler/soap-header",
new SoapHeaderRule());
digester.addCallMethod(prefix +
"web-app/service-ref/handler/soap-role",
"addSoapRole", 0);
@@ -629,7 +623,6 @@
public void begin(String namespace, String name, Attributes attributes)
throws Exception {
- Context context = (Context) digester.peek(digester.getCount() - 1);
Object top = digester.peek();
Class paramClasses[] = new Class[1];
paramClasses[0] = "String".getClass();
@@ -826,3 +819,53 @@
}
}
+
+/**
+ * A Rule that sets soap headers on the ContextHandler.
+ *
+ */
+final class SoapHeaderRule extends Rule {
+
+ public SoapHeaderRule() {
+ }
+
+ public void body(String text)
+ throws Exception {
+ String namespaceuri = null;
+ String localpart = text;
+ int colon = text.indexOf(':');
+ if (colon >= 0) {
+ String prefix = text.substring(0,colon);
+ namespaceuri = digester.findNamespaceURI(prefix);
+ localpart = text.substring(colon+1);
+ }
+ ContextHandler contextHandler = (ContextHandler)digester.peek();
+ contextHandler.addSoapHeaders(localpart,namespaceuri);
+ }
+}
+
+/**
+ * A Rule that sets service qname on the ContextService.
+ *
+ */
+final class ServiceQnameRule extends Rule {
+
+ public ServiceQnameRule() {
+ }
+
+ public void body(String text)
+ throws Exception {
+ String namespaceuri = null;
+ String localpart = text;
+ int colon = text.indexOf(':');
+ if (colon >= 0) {
+ String prefix = text.substring(0,colon);
+ namespaceuri = digester.findNamespaceURI(prefix);
+ localpart = text.substring(colon+1);
+ }
+ ContextService contextService = (ContextService)digester.peek();
+ contextService.setServiceqnameLocalpart(localpart);
+ contextService.setServiceqnameNamespaceURI(namespaceuri);
+ }
+}
+
Show replies by date