blob: 64bc687d4259af770fca7ac791d9afb663ab6dda (
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
|
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.http.server;
import com.yahoo.container.jdisc.HttpRequest;
import com.yahoo.messagebus.routing.Route;
import com.yahoo.vespa.http.client.config.FeedParams.DataFormat;
import com.yahoo.vespa.http.client.core.Headers;
/**
* Wrapper for the feed feederSettings read from HTTP request.
*
* @author <a href="mailto:steinar@yahoo-inc.com">Steinar Knutsen</a>
*/
public class FeederSettings {
private static final Route DEFAULT_ROUTE = Route.parse("default");
public final boolean drain;
public final Route route;
public final boolean denyIfBusy;
public final DataFormat dataFormat;
public final String priority;
public final Integer traceLevel;
public FeederSettings(HttpRequest request) {
{
String tmpDrain = request.getHeader(Headers.DRAIN);
if (tmpDrain != null) {
drain = Boolean.parseBoolean(tmpDrain);
} else {
drain = false;
}
}
{
String tmpRoute = request.getHeader(Headers.ROUTE);
if (tmpRoute != null) {
route = Route.parse(tmpRoute);
} else {
route = DEFAULT_ROUTE;
}
}
{
String tmpDenyIfBusy = request.getHeader(Headers.DENY_IF_BUSY);
if (tmpDenyIfBusy != null) {
denyIfBusy = Boolean.parseBoolean(tmpDenyIfBusy);
} else {
denyIfBusy = false;
}
}
{
String tmpDataFormat = request.getHeader(Headers.DATA_FORMAT);
if (tmpDataFormat != null) {
dataFormat = DataFormat.valueOf(tmpDataFormat);
} else {
dataFormat = DataFormat.XML_UTF8;
}
}
{
String tmpDataFormat = request.getHeader(Headers.PRIORITY);
if (tmpDataFormat != null) {
priority = tmpDataFormat;
} else {
priority = null;
}
}
{
String tmpDataFormat = request.getHeader(Headers.TRACE_LEVEL);
if (tmpDataFormat != null) {
traceLevel = Integer.valueOf(tmpDataFormat);
} else {
traceLevel = null;
}
}
}
}
|