1 /* 2 * Copyright 2007 the original author or authors. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package org.springframework.ws.transport.http; 18 19 import java.net.URI; 20 21 import org.apache.commons.logging.Log; 22 import org.apache.commons.logging.LogFactory; 23 24 import org.springframework.ws.transport.WebServiceMessageSender; 25 26 /** 27 * Abstract base class for {@link org.springframework.ws.transport.WebServiceMessageSender} implementations that use 28 * HTTP. 29 * 30 * @author Arjen Poutsma 31 * @since 1.0.0 32 */ 33 public abstract class AbstractHttpWebServiceMessageSender implements WebServiceMessageSender { 34 35 /** 36 * Logger available to subclasses. 37 */ 38 protected final Log logger = LogFactory.getLog(getClass()); 39 40 private boolean acceptGzipEncoding = true; 41 42 /** 43 * Return whether to accept GZIP encoding, that is, whether to send the HTTP <code>Accept-Encoding</code> header 44 * with <code>gzip</code> as value. 45 */ 46 public boolean isAcceptGzipEncoding() { 47 return acceptGzipEncoding; 48 } 49 50 /** 51 * Set whether to accept GZIP encoding, that is, whether to send the HTTP <code>Accept-Encoding</code> header with 52 * <code>gzip</code> as value. 53 * <p/> 54 * Default is <code>true</code>. Turn this flag off if you do not want GZIP response compression even if enabled on 55 * the HTTP server. 56 */ 57 public void setAcceptGzipEncoding(boolean acceptGzipEncoding) { 58 this.acceptGzipEncoding = acceptGzipEncoding; 59 } 60 61 public boolean supports(URI uri) { 62 return uri.getScheme().equals(HttpTransportConstants.HTTP_URI_SCHEME) || 63 uri.getScheme().equals(HttpTransportConstants.HTTPS_URI_SCHEME); 64 } 65 }