1 /*
2 * Copyright 1999-2002,2004 The Apache Software Foundation.
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.apache.commons.latka.http;
18
19 /**
20 * A class that holds proxy details for a session.
21 * At the moment this is a placeholder for two simple properties that may
22 * get added to as time goes by
23 *
24 * @author dion
25 * @version $Id: Proxy.java 155424 2005-02-26 13:09:29Z dirkv $
26 */
27 public class Proxy {
28
29 /** the host to use as a proxy */
30 private String _host;
31 /** the port to send proxied requests on */
32 private int _port;
33 /** the port number that represents port is unassigned */
34 public static final int PORT_UNSPECIFIED = -1;
35
36 /**
37 * Creates a new instance of Proxy
38 */
39 public Proxy() {
40 this(null, Proxy.PORT_UNSPECIFIED);
41 }
42
43 /**
44 * Create a proxy given a host name and port number .
45 *
46 * @param host the host name of the proxy to be used.
47 * @param port the port to send proxied requests on.
48 */
49 public Proxy(String host, int port) {
50 setHost(host);
51 setPort(port);
52 }
53
54 /**
55 * Getter for property host.
56 *
57 * @return the host name of the proxy to be used.
58 */
59 public String getHost() {
60 return _host;
61 }
62
63 /**
64 * Setter for property host.
65 *
66 * @param host the host name of the proxy to be used.
67 */
68 public void setHost(String host) {
69 _host = host;
70 }
71
72 /**
73 * Getter for property port.
74 *
75 * @return the port to send proxied requests on.
76 */
77 public int getPort() {
78 return _port;
79 }
80
81 /**
82 * Setter for property port.
83 *
84 * @param port the port to send proxied requests on.
85 */
86 public void setPort(int port) {
87 _port = port;
88 }
89
90 }