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 */
017package org.apache.activemq.transport.http;
018
019import java.net.URI;
020
021import org.apache.activemq.transport.TransportThreadSupport;
022import org.apache.activemq.transport.util.TextWireFormat;
023
024/**
025 * A useful base class for HTTP Transport implementations.
026 *
027 *
028 */
029public abstract class HttpTransportSupport extends TransportThreadSupport {
030    private TextWireFormat textWireFormat;
031    private URI remoteUrl;
032    private String proxyHost;
033    private int proxyPort = 8080;
034    private String proxyUser;
035    private String proxyPassword;
036
037    public HttpTransportSupport(TextWireFormat textWireFormat, URI remoteUrl) {
038        this.textWireFormat = textWireFormat;
039        this.remoteUrl = remoteUrl;
040    }
041
042    public String toString() {
043        return "HTTP Reader " + getRemoteUrl();
044    }
045
046    // Properties
047    // -------------------------------------------------------------------------
048    public String getRemoteAddress() {
049        return remoteUrl.toString();
050    }
051
052    public URI getRemoteUrl() {
053        return remoteUrl;
054    }
055
056    public TextWireFormat getTextWireFormat() {
057        return textWireFormat;
058    }
059
060    public void setTextWireFormat(TextWireFormat textWireFormat) {
061        this.textWireFormat = textWireFormat;
062    }
063
064    public String getProxyHost() {
065        return proxyHost;
066    }
067
068    public void setProxyHost(String proxyHost) {
069        this.proxyHost = proxyHost;
070    }
071
072    public int getProxyPort() {
073        return proxyPort;
074    }
075
076    public void setProxyPort(int proxyPort) {
077        this.proxyPort = proxyPort;
078    }
079
080    public String getProxyUser() {
081       return proxyUser;
082    }
083
084    public void setProxyUser(String proxyUser) {
085       this.proxyUser = proxyUser;
086    }
087
088    public String getProxyPassword() {
089       return proxyPassword;
090    }
091
092    public void setProxyPassword(String proxyPassword) {
093       this.proxyPassword = proxyPassword;
094    }
095}