Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/org/adblockplus/brazil/BaseRequestHandler.java

Issue 5697499218051072: Usage of new API, cleanups (reduced) (Closed)
Patch Set: Even more review issues fixed. Created April 28, 2014, 10:18 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
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
(...skipping 20 matching lines...) Expand all
31 public static final String PROXY_PORT = "proxyPort"; 31 public static final String PROXY_PORT = "proxyPort";
32 public static final String AUTH = "auth"; 32 public static final String AUTH = "auth";
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
38 protected String prefix; 38 protected String prefix;
39 39
40 @Override 40 @Override
41 public boolean init(Server server, String prefix) 41 public boolean init(final Server server, final String prefix)
42 { 42 {
43 this.prefix = prefix; 43 this.prefix = prefix;
44 44
45 Properties props = server.props; 45 final Properties props = server.props;
46 46
47 proxyHost = props.getProperty(prefix + PROXY_HOST); 47 proxyHost = props.getProperty(prefix + PROXY_HOST);
48 48
49 String s = props.getProperty(prefix + PROXY_PORT); 49 final String s = props.getProperty(prefix + PROXY_PORT);
50 try 50 try
51 { 51 {
52 proxyPort = Integer.decode(s).intValue(); 52 proxyPort = Integer.decode(s).intValue();
53 } 53 }
54 catch (Exception e) 54 catch (final Exception e)
55 { 55 {
56 } 56 }
57 57
58 auth = props.getProperty(prefix + AUTH); 58 auth = props.getProperty(prefix + AUTH);
59 59
60 shouldLogHeaders = (server.props.getProperty(prefix + "proxylog") != null); 60 shouldLogHeaders = (server.props.getProperty(prefix + "proxylog") != null);
61 61
62 return true; 62 return true;
63 } 63 }
64 64
65 /** 65 /**
66 * Dump the headers on stderr 66 * Dump the headers on stderr
67 */ 67 */
68 public static String dumpHeaders(int count, Request request, MimeHeaders heade rs, boolean sent) 68 public static String dumpHeaders(final int count, final Request request, final MimeHeaders headers, final boolean sent)
69 { 69 {
70 String prompt; 70 String prompt;
71 StringBuffer sb = new StringBuffer(); 71 final StringBuffer sb = new StringBuffer();
72 String label = " " + count; 72 String label = " " + count;
73 label = label.substring(label.length() - 4); 73 label = label.substring(label.length() - 4);
74 if (sent) 74 if (sent)
75 { 75 {
76 prompt = label + "> "; 76 prompt = label + "> ";
77 sb.append(prompt).append(request.toString()).append("\n"); 77 sb.append(prompt).append(request.toString()).append("\n");
78 } 78 }
79 else 79 else
80 { 80 {
81 prompt = label + "< "; 81 prompt = label + "< ";
82 } 82 }
83 83
84 for (int i = 0; i < headers.size(); i++) 84 for (int i = 0; i < headers.size(); i++)
85 { 85 {
86 sb.append(prompt).append(headers.getKey(i)); 86 sb.append(prompt).append(headers.getKey(i));
87 sb.append(": ").append(headers.get(i)).append("\n"); 87 sb.append(": ").append(headers.get(i)).append("\n");
88 } 88 }
89 return (sb.toString()); 89 return (sb.toString());
90 } 90 }
91 } 91 }
OLDNEW
« no previous file with comments | « src/org/adblockplus/android/updater/UpdaterService.java ('k') | src/org/adblockplus/brazil/RequestHandler.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld