public class PreferHeader extends Object
Modifier and Type | Class and Description |
---|---|
static class |
PreferHeader.PreferBuilder
Builder for PreferHeader
|
Modifier and Type | Field and Description |
---|---|
static String |
HANDLING_LENIENT |
static String |
HANDLING_STRICT |
static org.slf4j.Logger |
log |
static String |
PREFERENCE_HANDLING |
static String |
PREFERENCE_RESPOND_ASYNC |
static String |
PREFERENCE_RETURN |
static String |
PREFERENCE_WAIT |
static String |
RETURN_MINIMAL |
static String |
RETURN_PARAM_INCLUDE |
static String |
RETURN_PARAM_OMIT |
static String |
RETURN_REPRESENTATION |
Modifier and Type | Method and Description |
---|---|
static PreferHeader.PreferBuilder |
fromPrefer(PreferHeader prefer)
Create a PreferBuilder initialized with the provided PreferHeader.
|
Map<String,String> |
getParams()
Get the parameters of the prefer-header.
|
String |
getParamValue(String param)
Get the parameter value of the prefer-header,
e,g,
val2 from Prefer: foo="bar"; a1="val1"; a2="val2" for header.getParamValue("a2") . |
String |
getPreference()
Get the preference,
e.g.
|
String |
getPreferenceValue()
Get the value of the preference,
e.g.
|
static PreferHeader.PreferBuilder |
prefer(String preference)
Create a PreferBuilder for an arbitrary preference
|
static PreferHeader.PreferBuilder |
preferHandlingLenient()
Create and initialize a PreferBuilder for a
Prefer: handling="lenient" header. |
static PreferHeader.PreferBuilder |
preferHandlingStrict()
Create and initialize a PreferBuilder for a
Prefer: handling="strict" header. |
static PreferHeader.PreferBuilder |
preferRespondAsync()
Create and initialize a PreferBuilder for a
Prefer: respond-async header. |
static PreferHeader.PreferBuilder |
preferReturnMinimal()
Create and initialize a PreferBuilder for a
Prefer: return="minimal" header. |
static PreferHeader.PreferBuilder |
preferReturnRepresentation()
Create and initialize a PreferBuilder for a
Prefer: return="representation" header. |
static PreferHeader.PreferBuilder |
preferWait(int seconds)
Create and initialize a PreferBuilder for a
Prefer: wait="X" header. |
String |
toString() |
static PreferHeader |
valueOf(String headerValue)
Parse a PreferHeader.
|
public static final String PREFERENCE_RESPOND_ASYNC
public static final String PREFERENCE_RETURN
public static final String RETURN_REPRESENTATION
public static final String RETURN_MINIMAL
public static final String PREFERENCE_WAIT
public static final String PREFERENCE_HANDLING
public static final String HANDLING_STRICT
public static final String HANDLING_LENIENT
public static final String RETURN_PARAM_INCLUDE
public static final String RETURN_PARAM_OMIT
public static org.slf4j.Logger log
public String getPreference()
foo
from Prefer: foo="bar"
public String getPreferenceValue()
bar
from Prefer: foo="bar"
.public Map<String,String> getParams()
public String getParamValue(String param)
val2
from Prefer: foo="bar"; a1="val1"; a2="val2"
for header.getParamValue("a2")
.param
- the param to get the value ofnull
public static PreferHeader valueOf(String headerValue)
headerValue
- the header value to parsepublic static PreferHeader.PreferBuilder preferRespondAsync()
Prefer: respond-async
header.public static PreferHeader.PreferBuilder preferReturnRepresentation()
Prefer: return="representation"
header.public static PreferHeader.PreferBuilder preferReturnMinimal()
Prefer: return="minimal"
header.public static PreferHeader.PreferBuilder preferWait(int seconds)
Prefer: wait="X"
header.seconds
- seconds to wait, the X in the example.public static PreferHeader.PreferBuilder preferHandlingStrict()
Prefer: handling="strict"
header.public static PreferHeader.PreferBuilder preferHandlingLenient()
Prefer: handling="lenient"
header.public static PreferHeader.PreferBuilder fromPrefer(PreferHeader prefer)
prefer
- the PreferHeader used for initialisationpublic static PreferHeader.PreferBuilder prefer(String preference)
preference
- the preferenceCopyright © 2012–2018 The Apache Software Foundation. All rights reserved.