Skip navigation links

Package org.greenbytes.http.sfv

See: Description

Package org.greenbytes.http.sfv Description

Implementation of IETF RFC 8941: 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)
 
Skip navigation links

Copyright © 2021 The Apache Software Foundation. All rights reserved.