| Index: src/org/adblockplus/brazil/BaseRequestHandler.java |
| =================================================================== |
| new file mode 100644 |
| --- /dev/null |
| +++ b/src/org/adblockplus/brazil/BaseRequestHandler.java |
| @@ -0,0 +1,43 @@ |
| +package org.adblockplus.brazil; |
| + |
| +import java.util.Properties; |
| + |
| +import sunlabs.brazil.server.Handler; |
| +import sunlabs.brazil.server.Server; |
| + |
| +public abstract class BaseRequestHandler implements Handler |
| +{ |
| + |
| + public static final String PROXY_HOST = "proxyHost"; |
| + public static final String PROXY_PORT = "proxyPort"; |
| + public static final String AUTH = "auth"; |
| + protected String proxyHost; |
| + protected int proxyPort = 80; |
| + protected String auth; |
| + |
| + protected String prefix; |
| + |
| + @Override |
| + public boolean init(Server server, String prefix) |
| + { |
| + this.prefix = prefix; |
|
Felix Dahlke
2012/11/13 07:40:35
Indentation is off here.
|
| + |
| + Properties props = server.props; |
| + |
| + proxyHost = props.getProperty(prefix + PROXY_HOST); |
| + |
| + String s = props.getProperty(prefix + PROXY_PORT); |
| + try |
| + { |
| + proxyPort = Integer.decode(s).intValue(); |
| + } |
| + catch (Exception e) |
| + { |
| + } |
| + |
| + auth = props.getProperty(prefix + AUTH); |
| + |
| + return true; |
| + } |
| + |
| +} |