Repository: cxf Updated Branches: refs/heads/master 4361c6052 -> 523ba71d2
[CXF-6215] Adding a DefaultMethod HTTP method annotation Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/523ba71d Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/523ba71d Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/523ba71d Branch: refs/heads/master Commit: 523ba71d2690759e3b8e7f87a7ca1a9866c03a45 Parents: 4361c60 Author: Sergey Beryozkin <[email protected]> Authored: Thu Jan 22 10:05:28 2015 +0000 Committer: Sergey Beryozkin <[email protected]> Committed: Thu Jan 22 10:05:28 2015 +0000 ---------------------------------------------------------------------- .../org/apache/cxf/jaxrs/ext/DefaultMethod.java | 33 ++++++++++++++++++++ .../org/apache/cxf/jaxrs/utils/JAXRSUtils.java | 4 ++- 2 files changed, 36 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/523ba71d/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/DefaultMethod.java ---------------------------------------------------------------------- diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/DefaultMethod.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/DefaultMethod.java new file mode 100644 index 0000000..c996a15 --- /dev/null +++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/DefaultMethod.java @@ -0,0 +1,33 @@ +/** + * 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. + */ +package org.apache.cxf.jaxrs.ext; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import javax.ws.rs.HttpMethod; + +@Target({ElementType.METHOD }) +@Retention(RetentionPolicy.RUNTIME) +@HttpMethod("DefaultMethod") +public @interface DefaultMethod { + +} http://git-wip-us.apache.org/repos/asf/cxf/blob/523ba71d/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java ---------------------------------------------------------------------- diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java index d26cccc..2996973 100644 --- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java +++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java @@ -91,6 +91,7 @@ import org.apache.cxf.helpers.DOMUtils; import org.apache.cxf.interceptor.Fault; import org.apache.cxf.jaxrs.JAXRSServiceImpl; import org.apache.cxf.jaxrs.ext.ContextProvider; +import org.apache.cxf.jaxrs.ext.DefaultMethod; import org.apache.cxf.jaxrs.ext.MessageContext; import org.apache.cxf.jaxrs.ext.MessageContextImpl; import org.apache.cxf.jaxrs.ext.ProtocolHeaders; @@ -620,7 +621,8 @@ public final class JAXRSUtils { private static boolean matchHttpMethod(String expectedMethod, String httpMethod) { if (expectedMethod.equalsIgnoreCase(httpMethod) - || headMethodPossible(expectedMethod, httpMethod)) { + || headMethodPossible(expectedMethod, httpMethod) + || expectedMethod.equals(DefaultMethod.class.getSimpleName())) { return true; } return false;
