public class ParameterizedHeaderWithValue extends Object
A utility class to parse headers that are of the format name; param1=value; param2="quoted string"
such as Content-Type, Accepts, Content-Disposition etc.
More explicitly, a header that starts with a value, then has an optional list of semi-colon separated name/value pairs.
ParameterizedHeader
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
static List<ParameterizedHeaderWithValue> |
fromString(String input)
Converts headers that are values followed by optional parameters into a list of values with parameters.
|
int |
hashCode() |
String |
parameter(String name) |
String |
parameter(String name,
String defaultValue) |
Map<String,String> |
parameters() |
String |
toString()
Converts the HeaderValue into a string, suitable for printing in an HTTP header.
|
String |
value() |
public String value()
public String parameter(String name)
name
- The name of the parameter to getpublic String parameter(String name, String defaultValue)
name
- The name of the parameter to getdefaultValue
- The value to return if no parameter was setpublic static List<ParameterizedHeaderWithValue> fromString(String input)
Converts headers that are values followed by optional parameters into a list of values with parameters.
Null or blank strings return an empty list.
input
- The value to parseIllegalArgumentException
- The value cannot be parsedpublic String toString()
Copyright © 2017–2019. All rights reserved.