001    /*
002     * Copyright 1999-2002,2004 The Apache Software Foundation.
003     * 
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     * 
008     *      http://www.apache.org/licenses/LICENSE-2.0
009     * 
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    
017    package org.apache.commons.latka.http;
018    
019    /**
020     * A class that holds proxy details for a session. 
021     * At the moment this is a placeholder for two simple properties that may
022     * get added to as time goes by
023     *
024     * @author  dion
025     * @version $Id: Proxy.java 155424 2005-02-26 13:09:29Z dirkv $
026     */
027    public class Proxy {
028        
029        /** the host to use as a proxy */
030        private String _host;
031        /** the port to send proxied requests on */
032        private int _port;
033        /** the port number that represents port is unassigned */
034        public static final int PORT_UNSPECIFIED = -1;
035        
036        /**
037         * Creates a new instance of Proxy
038         */
039        public Proxy() {
040            this(null, Proxy.PORT_UNSPECIFIED);
041        }
042        
043        /** 
044         * Create a proxy given a host name and port number .
045         *
046         * @param host the host name of the proxy to be used.
047         * @param port the port to send proxied requests on.
048         */
049        public Proxy(String host, int port) {
050            setHost(host);
051            setPort(port);
052        }
053        
054        /**
055         * Getter for property host.
056         *
057         * @return the host name of the proxy to be used.
058         */
059        public String getHost() {
060            return _host;
061        }
062        
063        /**
064         * Setter for property host.
065         *
066         * @param host the host name of the proxy to be used.
067         */
068        public void setHost(String host) {
069            _host = host;
070        }
071        
072        /**
073         * Getter for property port.
074         *
075         * @return the port to send proxied requests on.
076         */
077        public int getPort() {
078            return _port;
079        }
080        
081        /**
082         * Setter for property port.
083         *
084         * @param port the port to send proxied requests on.
085         */
086        public void setPort(int port) {
087            _port = port;
088        }
089        
090    }