Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 625331049A for ; Thu, 15 Jan 2015 14:28:50 +0000 (UTC) Received: (qmail 75647 invoked by uid 500); 15 Jan 2015 14:28:52 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 75587 invoked by uid 500); 15 Jan 2015 14:28:52 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 75578 invoked by uid 99); 15 Jan 2015 14:28:52 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Jan 2015 14:28:52 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id DC482A443B0; Thu, 15 Jan 2015 14:28:51 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sergeyb@apache.org To: commits@cxf.apache.org Message-Id: <5d975be032484c449005b63cfd4d06dc@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: cxf git commit: Removing caching MBR/MBW, there were meant for using with Camel but it is unlikely anyone uses them Date: Thu, 15 Jan 2015 14:28:51 +0000 (UTC) Repository: cxf Updated Branches: refs/heads/3.0.x-fixes e3a54d8cf -> a46de68ef Removing caching MBR/MBW, there were meant for using with Camel but it is unlikely anyone uses them Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/a46de68e Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/a46de68e Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/a46de68e Branch: refs/heads/3.0.x-fixes Commit: a46de68efc1b722140a85ae0a012f7ce4ef34c57 Parents: e3a54d8 Author: Sergey Beryozkin Authored: Thu Jan 15 14:26:43 2015 +0000 Committer: Sergey Beryozkin Committed: Thu Jan 15 14:28:17 2015 +0000 ---------------------------------------------------------------------- .../provider/CachingMessageBodyReader.java | 101 ------------------ .../provider/CachingMessageBodyWriter.java | 103 ------------------- 2 files changed, 204 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/a46de68e/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/CachingMessageBodyReader.java ---------------------------------------------------------------------- diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/CachingMessageBodyReader.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/CachingMessageBodyReader.java deleted file mode 100644 index 7cfcea6..0000000 --- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/CachingMessageBodyReader.java +++ /dev/null @@ -1,101 +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.jaxrs.provider; - -import java.io.IOException; -import java.io.InputStream; -import java.lang.annotation.Annotation; -import java.lang.reflect.Type; -import java.util.Collections; -import java.util.List; - -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.ext.MessageBodyReader; -import javax.ws.rs.ext.Provider; - -import org.apache.cxf.jaxrs.utils.ExceptionUtils; - -@Provider -public class CachingMessageBodyReader extends AbstractCachingMessageProvider - implements MessageBodyReader { - - private List> delegatingReaders; - - public boolean isReadable(Class type, Type gType, Annotation[] anns, MediaType mt) { - if (delegatingReaders != null) { - return getDelegatingReader(type, gType, anns, mt) != null; - } else { - return isProviderKeyNotSet(); - } - } - - private MessageBodyReader getDelegatingReader(Class type, Type gType, Annotation[] anns, MediaType mt) { - for (MessageBodyReader reader: delegatingReaders) { - if (reader.isReadable(type, gType, anns, mt)) { - return reader; - } - } - return null; - } - - public T readFrom(Class type, Type gType, Annotation[] anns, MediaType mt, - MultivaluedMap theheaders, InputStream is) - throws IOException, WebApplicationException { - this.setObject( - getReader(type, gType, anns, mt).readFrom(type, gType, anns, mt, theheaders, is)); - return getObject(); - } - - - protected MessageBodyReader getReader(Class type, Type gType, Annotation[] anns, MediaType mt) { - if (delegatingReaders != null) { - return getDelegatingReader(type, gType, anns, mt); - } - MessageBodyReader r = null; - - mc.put(ACTIVE_JAXRS_PROVIDER_KEY, this); - try { - @SuppressWarnings("unchecked") - Class actualType = (Class)type; - r = mc.getProviders().getMessageBodyReader(actualType, gType, anns, mt); - } finally { - mc.put(ACTIVE_JAXRS_PROVIDER_KEY, null); - } - - if (r == null) { - org.apache.cxf.common.i18n.Message message = - new org.apache.cxf.common.i18n.Message("NO_MSG_READER", BUNDLE, type); - LOG.severe(message.toString()); - throw ExceptionUtils.toNotAcceptableException(null, null); - } - return r; - } - - public void setDelegatingReader(MessageBodyReader reader) { - this.delegatingReaders = Collections.singletonList(reader); - } - - public void setDelegatingReaders(List> readers) { - this.delegatingReaders = readers; - } - -} http://git-wip-us.apache.org/repos/asf/cxf/blob/a46de68e/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/CachingMessageBodyWriter.java ---------------------------------------------------------------------- diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/CachingMessageBodyWriter.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/CachingMessageBodyWriter.java deleted file mode 100644 index 74c48b5..0000000 --- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/CachingMessageBodyWriter.java +++ /dev/null @@ -1,103 +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.jaxrs.provider; - -import java.io.IOException; -import java.io.OutputStream; -import java.lang.annotation.Annotation; -import java.lang.reflect.Type; -import java.util.Collections; -import java.util.List; - -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.ext.MessageBodyWriter; -import javax.ws.rs.ext.Provider; - -import org.apache.cxf.jaxrs.utils.ExceptionUtils; - -@Provider -public class CachingMessageBodyWriter extends AbstractCachingMessageProvider - implements MessageBodyWriter { - - private List> delegatingWriters; - - public long getSize(T t, Class type, Type gType, Annotation[] anns, MediaType mediaType) { - return -1; - } - - public boolean isWriteable(Class type, Type gType, Annotation[] anns, MediaType mt) { - if (delegatingWriters != null) { - return getDelegatingWriter(type, gType, anns, mt) != null; - } else { - return isProviderKeyNotSet(); - } - } - - private MessageBodyWriter getDelegatingWriter(Class type, Type gType, Annotation[] anns, MediaType mt) { - for (MessageBodyWriter writer: delegatingWriters) { - if (writer.isWriteable(type, gType, anns, mt)) { - return writer; - } - } - return null; - } - - public void writeTo(T obj, Class type, Type gType, Annotation[] anns, MediaType mt, - MultivaluedMap theheaders, OutputStream os) - throws IOException, WebApplicationException { - this.setObject(obj); - getWriter(type, gType, anns, mt).writeTo(getObject(), type, gType, anns, mt, theheaders, os); - } - - - protected MessageBodyWriter getWriter(Class type, Type gType, Annotation[] anns, MediaType mt) { - if (delegatingWriters != null) { - return getDelegatingWriter(type, gType, anns, mt); - } - MessageBodyWriter w = null; - - mc.put(ACTIVE_JAXRS_PROVIDER_KEY, this); - try { - @SuppressWarnings("unchecked") - Class actualType = (Class)type; - w = mc.getProviders().getMessageBodyWriter(actualType, gType, anns, mt); - } finally { - mc.put(ACTIVE_JAXRS_PROVIDER_KEY, null); - } - - if (w == null) { - org.apache.cxf.common.i18n.Message message = - new org.apache.cxf.common.i18n.Message("NO_MSG_WRITER", BUNDLE, type); - LOG.severe(message.toString()); - throw ExceptionUtils.toInternalServerErrorException(null, null); - } - return w; - } - - public void setDelegatingWriter(MessageBodyWriter writer) { - this.delegatingWriters = Collections.singletonList(writer); - } - - public void setDelegatingWriters(List> writers) { - this.delegatingWriters = writers; - } -}