Repository: cxf Updated Branches: refs/heads/master a5be50145 -> a5300df97
[CXF-5705] Removing ClientKey after all Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/8ff6a885 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/8ff6a885 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/8ff6a885 Branch: refs/heads/master Commit: 8ff6a885822a2a005c5327b4e7ab0333dae055a1 Parents: fc4f04e Author: Sergey Beryozkin <[email protected]> Authored: Wed Apr 30 12:01:46 2014 +0100 Committer: Sergey Beryozkin <[email protected]> Committed: Wed Apr 30 14:21:31 2014 +0100 ---------------------------------------------------------------------- .../apache/cxf/jaxrs/utils/InjectionUtils.java | 12 ++- .../rs/security/oauth2/common/ClientKey.java | 82 -------------------- 2 files changed, 10 insertions(+), 84 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/8ff6a885/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java ---------------------------------------------------------------------- diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java index 193097c..2a3114c 100644 --- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java +++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java @@ -92,7 +92,6 @@ import org.apache.cxf.jaxrs.provider.ServerProviderFactory; import org.apache.cxf.message.Exchange; import org.apache.cxf.message.Message; import org.apache.cxf.message.MessageUtils; -import org.apache.cxf.phase.PhaseInterceptorChain; public final class InjectionUtils { @@ -1254,12 +1253,21 @@ public final class InjectionUtils { } } public static Object convertStringToPrimitive(String value, Class<?> cls) { + return convertStringToPrimitive(value, cls, new Annotation[]{}); + } + public static Object convertStringToPrimitive(String value, Class<?> cls, Annotation[] anns) { + Message m = JAXRSUtils.getCurrentMessage(); + if (m != null) { + ParamConverter<?> pc = ServerProviderFactory.getInstance(m).createParameterHandler(cls, anns); + if (pc != null) { + return pc.fromString(value); + } + } if (String.class == cls) { return value; } else if (cls.isPrimitive()) { return PrimitiveUtils.read(value, cls); } else if (cls.isEnum()) { - Message m = PhaseInterceptorChain.getCurrentMessage(); if (m == null || !MessageUtils.getContextualBoolean(m, ENUM_CONVERSION_CASE_SENSITIVE, false)) { value = value.toUpperCase(); } http://git-wip-us.apache.org/repos/asf/cxf/blob/8ff6a885/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/ClientKey.java ---------------------------------------------------------------------- diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/ClientKey.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/ClientKey.java deleted file mode 100644 index 4c888ca..0000000 --- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/ClientKey.java +++ /dev/null @@ -1,82 +0,0 @@ -/** - * 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.rs.security.oauth2.common; - -import java.io.Serializable; - -public class ClientKey implements Serializable { - private static final long serialVersionUID = 6151645789585333184L; - public enum Type { - PASSWORD, - X509CERTIFICATE - } - - private String key; - private Type type; - - public ClientKey() { - - } - - public ClientKey(String password) { - this(password, Type.PASSWORD); - } - - public ClientKey(Type type) { - this(null, type); - } - - public ClientKey(String key, Type type) { - this.key = key; - this.type = type; - } - - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } - - public Type getType() { - return type; - } - - public void setType(Type type) { - this.type = type; - } - - public int hashCode() { - return (key == null ? 37 : key.hashCode()) * type.hashCode(); - } - public boolean equals(Object obj) { - if (obj instanceof ClientKey) { - ClientKey other = (ClientKey)obj; - if (this.key == null && other.key != null - || this.key != null && other.key == null) { - return false; - } - return this.key.equals(other.key) && this.type.equals(other.type); - } else { - return false; - } - - } -}
