LEFT | RIGHT |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 | 17 |
18 package org.adblockplus.brazil; | 18 package org.adblockplus.brazil; |
19 | 19 |
20 import java.util.Properties; | 20 import java.util.Properties; |
21 | 21 |
22 import sunlabs.brazil.server.Handler; | 22 import sunlabs.brazil.server.Handler; |
23 import sunlabs.brazil.server.Request; | 23 import sunlabs.brazil.server.Request; |
24 import sunlabs.brazil.server.Server; | 24 import sunlabs.brazil.server.Server; |
25 import sunlabs.brazil.util.http.MimeHeaders; | 25 import sunlabs.brazil.util.http.MimeHeaders; |
26 | 26 |
27 public abstract class BaseRequestHandler implements Handler | 27 public abstract class BaseRequestHandler implements Handler |
28 { | 28 { |
| 29 |
29 public static final String PROXY_HOST = "proxyHost"; | 30 public static final String PROXY_HOST = "proxyHost"; |
30 public static final String PROXY_PORT = "proxyPort"; | 31 public static final String PROXY_PORT = "proxyPort"; |
31 public static final String AUTH = "auth"; | 32 public static final String AUTH = "auth"; |
32 | |
33 protected String proxyHost; | 33 protected String proxyHost; |
34 protected int proxyPort = 80; | 34 protected int proxyPort = 80; |
35 protected String auth; | 35 protected String auth; |
36 protected boolean shouldLogHeaders; | 36 protected boolean shouldLogHeaders; |
| 37 |
37 protected String prefix; | 38 protected String prefix; |
38 | 39 |
39 @Override | 40 @Override |
40 public boolean init(final Server server, final String prefix) | 41 public boolean init(final Server server, final String prefix) |
41 { | 42 { |
42 this.prefix = prefix; | 43 this.prefix = prefix; |
43 | 44 |
44 final Properties props = server.props; | 45 final Properties props = server.props; |
45 | 46 |
46 proxyHost = props.getProperty(prefix + PROXY_HOST); | 47 proxyHost = props.getProperty(prefix + PROXY_HOST); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 } | 82 } |
82 | 83 |
83 for (int i = 0; i < headers.size(); i++) | 84 for (int i = 0; i < headers.size(); i++) |
84 { | 85 { |
85 sb.append(prompt).append(headers.getKey(i)); | 86 sb.append(prompt).append(headers.getKey(i)); |
86 sb.append(": ").append(headers.get(i)).append("\n"); | 87 sb.append(": ").append(headers.get(i)).append("\n"); |
87 } | 88 } |
88 return (sb.toString()); | 89 return (sb.toString()); |
89 } | 90 } |
90 } | 91 } |
LEFT | RIGHT |