blob: 3283de9b7c4c0d18ff7eee6b58157a8447e003b1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.processing;
import com.yahoo.component.chain.ChainedComponent;
import com.yahoo.processing.execution.Execution;
/**
* Superclass of chainable components processing Requests to create Responses.
* <p>
* Processors typically changes the Request and/or the Response. It may also make multiple
* forward requests, in series or parallel, or manufacture the response content itself or by calling
* an external service.
* <p>
* Typical usage:
* <code>
* public class MyProcessor extends Processor {
*
* @Override
* public Response process(Request request, Execution execution) {
* // process the request here
* Response response = execution.process(request); // Pass along to get the Response
* // process (or fill in) Data/DataList items on the response here
* return response;
* }
*
* }
* </code>
*
* @author bratseth
*/
public abstract class Processor extends ChainedComponent {
/**
* Performs a processing request and returns the response
*
* @return a Response instance - never null - containing the data produced by this processor
* and those it forwards the request to
*/
public abstract Response process(Request request, Execution execution);
}
|