Package org.greenbytes.http.sfv
Implementation of IETF
RFC 9651: Structured Field Values for HTTP.
Includes a Parser and object equivalents of the defined data types
(see Type).
Here's a minimal example:
{
Parser p = new Parser("a=?0, b, c; foo=bar");
Dictionary d = p.parseDictionary();
for (Map.Entry<String, Item<? extends Object>> e : d.get()) {
String key = e.getKey();
Item<? extends Object> item = e.getValue();
Object value = item.get();
Parameters params = item.getParams();
System.out.println(key + " -> " + value + (params.isEmpty() ? "" : (" (" + params.serialize() + ")")));
}
}
gives:
a -> false b -> true c -> true (;foo=bar)
-
Interface Summary Interface Description Item<T> Marker interface for Items.ListElement<T> Marker interface for things that can be elements of Outer Lists.NumberItem<T> Common interface for allTypes that can carry numbers.Parameterizable<T> Common interface for allTypes that can carryParameters.Type<T> Base interface for Structured Data Types. -
Class Summary Class Description BooleanItem Represents a Boolean.ByteSequenceItem Represents a Byte Sequence.CLI DateItem Represents a Date.DecimalItem Represents a Decimal.Dictionary Represents a Dictionary.DisplayStringItem Represents a Display String.InnerList Represents an Inner List.IntegerItem Represents an Integer.OuterList Represents a List.Parameters Represents the Parameters of an Item or an Inner List.Parser Implementation of the "Structured Field Values" Parser.StringItem Represents a String.TokenItem Represents a Token.Utils Common utility methods. -
Exception Summary Exception Description ParseException IllegalArgumentException, augmented with details.