01: package pygmy.core;
02:
03: import java.util.Properties;
04: import java.net.Socket;
05:
06: public abstract class Request {
07:
08: private Properties requestProperties;
09: private boolean isInternal = false;
10: protected Socket connection;
11:
12: public Request(Socket connection, Properties serverConfig) {
13: this .connection = connection;
14: this .requestProperties = new ChainableProperties(serverConfig);
15: }
16:
17: public String getProperty(String key, String defaultValue) {
18: return requestProperties.getProperty(key, defaultValue);
19: }
20:
21: public void putProperty(String key, String value) {
22: requestProperties.put(key, value);
23: }
24:
25: public boolean isInternal() {
26: return isInternal;
27: }
28:
29: protected void setIsInternal(boolean isItInternal) {
30: isInternal = isItInternal;
31: }
32:
33: public String getLocalAddr() {
34: return connection.getLocalAddress().getHostAddress();
35: }
36:
37: public int getLocalPort() {
38: return connection.getLocalPort();
39: }
40:
41: public String getRemoteAddr() {
42: return connection.getInetAddress().getHostAddress();
43: }
44:
45: public int getRemotePort() {
46: return connection.getPort();
47: }
48: }
|