aboutsummaryrefslogtreecommitdiffstats
path: root/container-core/src/main/java/com/yahoo/container/jdisc/ExtendedResponse.java
blob: 208794998a695fa3c9dde05454e603553d88be26 (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.jdisc;

import com.yahoo.container.handler.Coverage;
import com.yahoo.container.handler.Timing;
import com.yahoo.container.logging.HitCounts;
import com.yahoo.jdisc.handler.CompletionHandler;
import com.yahoo.jdisc.handler.ContentChannel;

import java.io.IOException;
import java.io.OutputStream;

/**
 * An HTTP response supporting async rendering and extended information for logging.
 *
 * @author Steinar Knutsen
 */
public abstract class ExtendedResponse extends AsyncHttpResponse {

    public ExtendedResponse(int status) {
        super(status);
    }

    @Override
    public abstract void render(OutputStream output, ContentChannel networkChannel, CompletionHandler handler)
        throws IOException;

    /**
     * @return user name performing the request
     */
    public String getUser() {
        return null;
    }

    /**
     * The parsed query or some other normal form for the query/request
     * resulting in this Response. Never null. This default implementation
     * returns null though.
     */
    public String getParsedQuery() {
        return null;
    }

    /**
     * Returns timing information about the processing leading to this response.
     * This default implementation returns null.
     *
     * @see com.yahoo.container.handler.Timing
     * @return a Timing instance or null
     */
    public Timing getTiming() {
        return null;
    }

    /**
     * Returns the completeness of the scan of the total known data for this
     * response. This default implementation returns null.
     *
     * @see Coverage
     * @return coverage information or null
     */
    public Coverage getCoverage() {
        return null;
    }

    /**
     * Returns the number of "hits" in this. This default implementation returns
     * null.
     *
     * @return a Counts instance or null
     */
    public HitCounts getHitCounts() {
        return null;
    }

}