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 D6067920E for ; Fri, 6 Apr 2012 16:14:47 +0000 (UTC) Received: (qmail 68043 invoked by uid 500); 6 Apr 2012 16:14:47 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 67984 invoked by uid 500); 6 Apr 2012 16:14:47 -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 67919 invoked by uid 99); 6 Apr 2012 16:14:47 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Apr 2012 16:14:47 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Apr 2012 16:14:44 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id AEBBE2388980; Fri, 6 Apr 2012 16:14:24 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1310438 - /cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/common/gzip/GZIPFeature.java Date: Fri, 06 Apr 2012 16:14:24 -0000 To: commits@cxf.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120406161424.AEBBE2388980@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dkulp Date: Fri Apr 6 16:14:24 2012 New Revision: 1310438 URL: http://svn.apache.org/viewvc?rev=1310438&view=rev Log: Convert to native style line feeds in git Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/common/gzip/GZIPFeature.java Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/common/gzip/GZIPFeature.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/common/gzip/GZIPFeature.java?rev=1310438&r1=1310437&r2=1310438&view=diff ============================================================================== --- cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/common/gzip/GZIPFeature.java (original) +++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/common/gzip/GZIPFeature.java Fri Apr 6 16:14:24 2012 @@ -1,93 +1,93 @@ -/** - * 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.transport.common.gzip; - -import java.util.List; - -import org.apache.cxf.Bus; -import org.apache.cxf.common.injection.NoJSR250Annotations; -import org.apache.cxf.feature.AbstractFeature; -import org.apache.cxf.interceptor.Interceptor; -import org.apache.cxf.interceptor.InterceptorProvider; -import org.apache.cxf.message.Message; - -/** - * This class is used to control GZIP compression of messages. - * Attaching this feature to an endpoint will allow the endpoint to handle - * compressed requests, and will cause outgoing responses to be compressed if - * the client indicates (via the Accept-Encoding header) that it can handle - * them. - *
- * 
- *   
- *     
- *   
- * 
- * ]]>
- * 
- * Attaching this feature to a client will cause outgoing request messages - * to be compressed and incoming compressed responses to be uncompressed. - * Accept-Encoding header is sent to let the service know - * that your client can accept compressed responses. - */ -@NoJSR250Annotations -public class GZIPFeature extends AbstractFeature { - private static final GZIPInInterceptor IN = new GZIPInInterceptor(); - private static final GZIPOutInterceptor OUT = new GZIPOutInterceptor(); - - /** - * The compression threshold to pass to the outgoing interceptor. - */ - int threshold = -1; - - @Override - protected void initializeProvider(InterceptorProvider provider, Bus bus) { - provider.getInInterceptors().add(IN); - if (threshold == -1) { - provider.getOutInterceptors().add(OUT); - provider.getOutFaultInterceptors().add(OUT); - } else { - GZIPOutInterceptor out = new GZIPOutInterceptor(); - out.setThreshold(threshold); - remove(provider.getOutInterceptors()); - remove(provider.getOutFaultInterceptors()); - provider.getOutInterceptors().add(out); - provider.getOutFaultInterceptors().add(out); - } - } - - private void remove(List> outInterceptors) { - int x = outInterceptors.size(); - while (x > 0) { - --x; - if (outInterceptors.get(x) instanceof GZIPOutInterceptor) { - outInterceptors.remove(x); - } - } - } - - public void setThreshold(int threshold) { - this.threshold = threshold; - } - - public int getThreshold() { - return threshold; - } -} +/** + * 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.transport.common.gzip; + +import java.util.List; + +import org.apache.cxf.Bus; +import org.apache.cxf.common.injection.NoJSR250Annotations; +import org.apache.cxf.feature.AbstractFeature; +import org.apache.cxf.interceptor.Interceptor; +import org.apache.cxf.interceptor.InterceptorProvider; +import org.apache.cxf.message.Message; + +/** + * This class is used to control GZIP compression of messages. + * Attaching this feature to an endpoint will allow the endpoint to handle + * compressed requests, and will cause outgoing responses to be compressed if + * the client indicates (via the Accept-Encoding header) that it can handle + * them. + *
+ * 
+ *   
+ *     
+ *   
+ * 
+ * ]]>
+ * 
+ * Attaching this feature to a client will cause outgoing request messages + * to be compressed and incoming compressed responses to be uncompressed. + * Accept-Encoding header is sent to let the service know + * that your client can accept compressed responses. + */ +@NoJSR250Annotations +public class GZIPFeature extends AbstractFeature { + private static final GZIPInInterceptor IN = new GZIPInInterceptor(); + private static final GZIPOutInterceptor OUT = new GZIPOutInterceptor(); + + /** + * The compression threshold to pass to the outgoing interceptor. + */ + int threshold = -1; + + @Override + protected void initializeProvider(InterceptorProvider provider, Bus bus) { + provider.getInInterceptors().add(IN); + if (threshold == -1) { + provider.getOutInterceptors().add(OUT); + provider.getOutFaultInterceptors().add(OUT); + } else { + GZIPOutInterceptor out = new GZIPOutInterceptor(); + out.setThreshold(threshold); + remove(provider.getOutInterceptors()); + remove(provider.getOutFaultInterceptors()); + provider.getOutInterceptors().add(out); + provider.getOutFaultInterceptors().add(out); + } + } + + private void remove(List> outInterceptors) { + int x = outInterceptors.size(); + while (x > 0) { + --x; + if (outInterceptors.get(x) instanceof GZIPOutInterceptor) { + outInterceptors.remove(x); + } + } + } + + public void setThreshold(int threshold) { + this.threshold = threshold; + } + + public int getThreshold() { + return threshold; + } +}