MCPcopy Create free account
hub / github.com/adblockplus/adblockplusandroid / ChainHandler

Class ChainHandler

src/sunlabs/brazil/server/ChainHandler.java:193–410  ·  view source on GitHub ↗

Allows multiple handlers to be invoked sequentially for a single HTTP request. A list of handlers is supplied when this ChainHandler is initialized. When an HTTP request is received by this ChainHandler , each of the handlers from the list is called in turn until one of th

Source from the content-addressed store, hash-verified

191 * @version 2.5
192 */
193public class ChainHandler
194 implements Handler
195{
196 private static final String HANDLERS = "handlers";
197 private static final String EXIT_ON_ERROR = "exitOnError";
198
199 /**
200 * The array of handlers that will be invoked to handle
201 * the request.
202 */
203 public Handler[] handlers;
204
205 /**
206 * The names of the above <code>handlers</code> as specified by the
207 * configuration parameters. Used for logging the names of each
208 * <code>Handler</code> as it is invoked.
209 */
210 public String[] names;
211
212 /**
213 * The prefix used to initialize this <code>ChainHandler</code>, used
214 * for logging.
215 */
216 public String prefix;
217
218 /**
219 * The URL that must match for this handler to run
220 */
221 public MatchString isMine;
222
223 /**
224 * The name (if any) of the property to receive the name of the handler
225 * that handled the request.
226 */
227 public String report;
228
229 /**
230 * A flag to require the successfull initialization of all
231 * handlers.
232 */
233 public boolean exitOnError = false;
234
235 /**
236 * Initializes this <code>ChainHandler</code> by initializing all the
237 * "wrapped" handlers in the list of handlers. If a wrapped handler
238 * cannot be initialized, this method logs a message and skips it. If no
239 * handlers were specified, or no handlers were successfully initialized,
240 * then the initialization of this <code>ChainHandler</code> is
241 * considered to have failed.
242 *
243 * @param server
244 * The HTTP server that created this <code>ChainHandler</code>.
245 *
246 * @param prefix
247 * The prefix for this <code>ChainHandler</code>'s properties.
248 *
249 * @return <code>true</code> if at least one of the wrapped handlers
250 * was successfully initialized.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected