blob: 1c29c479190b3c95bf9fcfc5fa4b4edc68bb9dc6 (
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
|
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
//package com.yahoo.example;
import com.google.inject.Inject;
import com.yahoo.example.ExampleProcessorConfig;
import com.yahoo.processing.Processor;
import com.yahoo.processing.Request;
import com.yahoo.processing.Response;
import com.yahoo.processing.execution.Execution;
public class ExampleProcessor extends Processor {
private final String message;
@Inject
public ExampleProcessor(ExampleProcessorConfig config) {
this.message = config.message();
}
@SuppressWarnings("unchecked")
@Override
public Response process(Request request, Execution execution) {
// process the request
request.properties().set("foo", "bar");
// pass it down the chain to get a response
Response response = execution.process(request);
// process the response
response.data().add(new StringData(request, message));
// return the response up the chain
return response;
}
}
|