001 /** 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 package org.apache.activemq.transport.http; 018 019 import java.net.URI; 020 021 import org.apache.activemq.transport.TransportThreadSupport; 022 import org.apache.activemq.transport.util.TextWireFormat; 023 024 /** 025 * A useful base class for HTTP Transport implementations. 026 * 027 * @version $Revision: 1.1 $ 028 */ 029 public abstract class HttpTransportSupport extends TransportThreadSupport { 030 private TextWireFormat textWireFormat; 031 private URI remoteUrl; 032 private String proxyHost; 033 private int proxyPort = 8080; 034 035 public HttpTransportSupport(TextWireFormat textWireFormat, URI remoteUrl) { 036 this.textWireFormat = textWireFormat; 037 this.remoteUrl = remoteUrl; 038 } 039 040 public String toString() { 041 return "HTTP Reader " + getRemoteUrl(); 042 } 043 044 // Properties 045 // ------------------------------------------------------------------------- 046 public String getRemoteAddress() { 047 return remoteUrl.toString(); 048 } 049 050 public URI getRemoteUrl() { 051 return remoteUrl; 052 } 053 054 public TextWireFormat getTextWireFormat() { 055 return textWireFormat; 056 } 057 058 public void setTextWireFormat(TextWireFormat textWireFormat) { 059 this.textWireFormat = textWireFormat; 060 } 061 062 public String getProxyHost() { 063 return proxyHost; 064 } 065 066 public void setProxyHost(String proxyHost) { 067 this.proxyHost = proxyHost; 068 } 069 070 public int getProxyPort() { 071 return proxyPort; 072 } 073 074 public void setProxyPort(int proxyPort) { 075 this.proxyPort = proxyPort; 076 } 077 }