LEFT | RIGHT |
(no file at all) | |
| 1 package org.adblockplus.brazil; |
| 2 |
| 3 import java.util.Properties; |
| 4 |
| 5 import sunlabs.brazil.server.Handler; |
| 6 import sunlabs.brazil.server.Server; |
| 7 |
| 8 public abstract class BaseRequestHandler implements Handler |
| 9 { |
| 10 |
| 11 public static final String PROXY_HOST = "proxyHost"; |
| 12 public static final String PROXY_PORT = "proxyPort"; |
| 13 public static final String AUTH = "auth"; |
| 14 protected String proxyHost; |
| 15 protected int proxyPort = 80; |
| 16 protected String auth; |
| 17 |
| 18 protected String prefix; |
| 19 |
| 20 @Override |
| 21 public boolean init(Server server, String prefix) |
| 22 { |
| 23 this.prefix = prefix; |
| 24 |
| 25 Properties props = server.props; |
| 26 |
| 27 proxyHost = props.getProperty(prefix + PROXY_HOST); |
| 28 |
| 29 String s = props.getProperty(prefix + PROXY_PORT); |
| 30 try |
| 31 { |
| 32 proxyPort = Integer.decode(s).intValue(); |
| 33 } |
| 34 catch (Exception e) |
| 35 { |
| 36 } |
| 37 |
| 38 auth = props.getProperty(prefix + AUTH); |
| 39 |
| 40 return true; |
| 41 } |
| 42 |
| 43 } |
LEFT | RIGHT |