summaryrefslogtreecommitdiffstats
path: root/application/src/test/java/com/yahoo/application/container/processors/Rot13Processor.java
blob: 3cd1de85475579e8c8e9364928138dc51ac0db2c (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
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.application.container.processors;

import com.yahoo.processing.Processor;
import com.yahoo.processing.Request;
import com.yahoo.processing.Response;
import com.yahoo.processing.execution.Execution;
import com.yahoo.processing.test.ProcessorLibrary;

import static com.yahoo.application.container.docprocs.Rot13DocumentProcessor.rot13;

/**
 * @author Einar M R Rosenvinge
 */
public class Rot13Processor extends Processor {

    @SuppressWarnings("unchecked")
    @Override
    public Response process(Request request, Execution execution) {
        Object fooObj = request.properties().get("title");

        Response response = new Response(request);
        if (fooObj != null) {
            response.data().add(new ProcessorLibrary.StringData(request, rot13(fooObj.toString())));
        }
        return response;
    }

}