You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2009/03/24 20:30:15 UTC
svn commit: r757974 - in /cxf/branches/2.1.x-fixes: ./
rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/
rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/
Author: dkulp
Date: Tue Mar 24 19:30:13 2009
New Revision: 757974
URL: http://svn.apache.org/viewvc?rev=757974&view=rev
Log:
Merged revisions 757935 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r757935 | dkulp | 2009-03-24 14:22:48 -0400 (Tue, 24 Mar 2009) | 2 lines
[CXF-1766, CXF-2117] Support proper wildcards for handler chains
........
Modified:
cxf/branches/2.1.x-fixes/ (props changed)
cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java
cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java
cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/handlers.xml
Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar 24 19:30:13 2009
@@ -1 +1 @@
-/cxf/trunk:753380,753397,753421,754585,755365,757859,757899
+/cxf/trunk:753380,753397,753421,754585,755365,757859,757899,757935
Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java?rev=757974&r1=757973&r2=757974&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java Tue Mar 24 19:30:13 2009
@@ -216,13 +216,39 @@
}
if (localPart.contains("*")) {
//wildcard pattern matching
- return Pattern.matches(localPart, comp.getLocalPart());
+ return Pattern.matches(mapPattern(localPart), comp.getLocalPart());
} else if (!localPart.equals(comp.getLocalPart())) {
return false;
}
return true;
}
+ private String mapPattern(String s) {
+ StringBuilder buf = new StringBuilder(s);
+ for (int x = 0; x < buf.length(); x++) {
+ switch (buf.charAt(x)) {
+ case '*':
+ buf.insert(x, '.');
+ x++;
+ break;
+ case '.':
+ case '\\':
+ case '^':
+ case '$':
+ case '{':
+ case '}':
+ case '(':
+ case ')':
+ buf.insert(x, '\\');
+ x++;
+ break;
+ default:
+ //nothing to do
+ }
+ }
+ return buf.toString();
+ }
+
private void processHandlerElement(Element el, List<Handler> chain) {
try {
JAXBContext ctx = getContextForPortComponentHandlerType();
Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java?rev=757974&r1=757973&r2=757974&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java Tue Mar 24 19:30:13 2009
@@ -88,6 +88,19 @@
assertEquals(3, handlers.size());
}
+ @Test
+ public void testFindHandlerChainAnnotationPerPortServiceBindingWildcard() {
+ HandlerTestImpl handlerTestImpl = new HandlerTestImpl();
+ AnnotationHandlerChainBuilder chainBuilder = new AnnotationHandlerChainBuilder();
+ QName portQName = new QName("http://apache.org/handler_test", "SoapPortWildcard");
+ QName serviceQName = new QName("http://apache.org/handler_test", "SoapServiceWildcard");
+ String bindingID = "BindingUnknow";
+ List<Handler> handlers = chainBuilder
+ .buildHandlerChainFromClass(handlerTestImpl.getClass(), portQName, serviceQName, bindingID);
+ assertNotNull(handlers);
+ assertEquals(7, handlers.size());
+ }
+
public static class TestLogicalHandler implements LogicalHandler {
Map config;
boolean initCalled;
Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/handlers.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/handlers.xml?rev=757974&r1=757973&r2=757974&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/handlers.xml (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/handlers.xml Tue Mar 24 19:30:13 2009
@@ -1,61 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
+ <!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to you under the Apache License, Version
+ 2.0 (the "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ applicable law or agreed to in writing, software distributed under the
+ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+ CONDITIONS OF ANY KIND, either express or implied. See the License for
+ the specific language governing permissions and limitations under the
+ License.
+ -->
+<handler-chains xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:cfg="http://cxf.apache.org/configuration/cfg" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee">
+ <handler-chain>
+ <handler>
+ <handler-name>lh3</handler-name>
+ <handler-class>
+ org.apache.cxf.jaxws.handler.AnnotationHandlerChainBuilderTest$TestProtocolHandler
+ </handler-class>
+ <init-param>
+ <param-name>token</param-name>
+ <param-value>String</param-value>
+ </init-param>
+ </handler>
+ </handler-chain>
+ <handler-chain>
+ <handler>
+ <handler-name>lh1</handler-name>
+ <handler-class>
+ org.apache.cxf.jaxws.handler.AnnotationHandlerChainBuilderTest$TestLogicalHandler
+ </handler-class>
+ <init-param>
+ <param-name>token</param-name>
+ <param-value>String</param-value>
+ </init-param>
+ </handler>
+ <handler>
+ <handler-name>lh2</handler-name>
+ <handler-class>
+ org.apache.cxf.jaxws.handler.AnnotationHandlerChainBuilderTest$TestLogicalHandler
+ </handler-class>
+ <init-param>
+ <param-name>token</param-name>
+ <param-value>String</param-value>
+ </init-param>
+ </handler>
+ </handler-chain>
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<handler-chains xmlns="http://java.sun.com/xml/ns/javaee"
-xmlns:cfg="http://cxf.apache.org/configuration/cfg"
-xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
-xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-xsi:schemaLocation="http://java.sun.com/xml/ns/javaee">
- <handler-chain>
- <handler>
- <handler-name>lh3</handler-name>
- <handler-class>org.apache.cxf.jaxws.handler.AnnotationHandlerChainBuilderTest$TestProtocolHandler</handler-class>
- <init-param>
- <param-name>token</param-name>
- <param-value>String</param-value>
- </init-param>
- </handler>
- </handler-chain>
- <handler-chain>
- <handler>
- <handler-name>lh1</handler-name>
- <handler-class>org.apache.cxf.jaxws.handler.AnnotationHandlerChainBuilderTest$TestLogicalHandler</handler-class>
- <init-param>
- <param-name>token</param-name>
- <param-value>String</param-value>
- </init-param>
- </handler>
- <handler>
- <handler-name>lh2</handler-name>
- <handler-class>org.apache.cxf.jaxws.handler.AnnotationHandlerChainBuilderTest$TestLogicalHandler</handler-class>
- <init-param>
- <param-name>token</param-name>
- <param-value>String</param-value>
- </init-param>
- </handler>
- </handler-chain>
-
-
- <handler-chain>
- <port-name-pattern
- xmlns:ns1="http://apache.org/handler_test">
- ns1:SoapPort1
+ <handler-chain>
+ <port-name-pattern xmlns:ns1="http://apache.org/handler_test">
+ ns1:Soap*
</port-name-pattern>
<handler>
<handler-name>Handler1</handler-name>
@@ -70,11 +71,10 @@
</handler-class>
</handler>
</handler-chain>
-
- <handler-chain>
- <service-name-pattern
- xmlns:ns1="http://apache.org/handler_test">
- ns1:SoapService1
+
+ <handler-chain>
+ <service-name-pattern xmlns:ns1="http://apache.org/handler_test">
+ ns1:Soap*
</service-name-pattern>
<handler>
<handler-name>Handler1</handler-name>
@@ -88,23 +88,29 @@
org.apache.cxf.jaxws.handler.AnnotationHandlerChainBuilderTest$TestLogicalHandler
</handler-class>
</handler>
- </handler-chain>
-
- <!-- ====================== -->
- <!-- protocol based handlers-->
- <!-- ====================== -->
- <handler-chain>
- <!-- REVISIT: valued used by TCK, do not understand...
- <protocol-bindings>##SOAP11_HTTP</protocol-bindings>
- -->
- <protocol-bindings>http://schemas.xmlsoap.org/wsdl/soap/http</protocol-bindings>
- <handler>
- <handler-name>Handler7</handler-name>
- <handler-class>org.apache.cxf.jaxws.handler.AnnotationHandlerChainBuilderTest$TestLogicalHandler</handler-class>
- </handler>
- <handler>
- <handler-name>Handler8</handler-name>
- <handler-class>org.apache.cxf.jaxws.handler.AnnotationHandlerChainBuilderTest$TestProtocolHandler</handler-class>
- </handler>
- </handler-chain>
+ </handler-chain>
+
+ <!-- ====================== -->
+ <!-- protocol based handlers-->
+ <!-- ====================== -->
+ <handler-chain>
+ <!--
+ REVISIT: valued used by TCK, do not understand...
+ <protocol-bindings>##SOAP11_HTTP</protocol-bindings>
+ -->
+ <protocol-bindings>http://schemas.xmlsoap.org/wsdl/soap/http
+ </protocol-bindings>
+ <handler>
+ <handler-name>Handler7</handler-name>
+ <handler-class>
+ org.apache.cxf.jaxws.handler.AnnotationHandlerChainBuilderTest$TestLogicalHandler
+ </handler-class>
+ </handler>
+ <handler>
+ <handler-name>Handler8</handler-name>
+ <handler-class>
+ org.apache.cxf.jaxws.handler.AnnotationHandlerChainBuilderTest$TestProtocolHandler
+ </handler-class>
+ </handler>
+ </handler-chain>
</handler-chains>