add map helpers to HttpParameters

This commit is contained in:
Jörg Prante 2023-04-06 14:40:30 +02:00
parent 845260a14e
commit 9435cc649b

View file

@ -1,6 +1,7 @@
package org.xbib.netty.http.common; package org.xbib.netty.http.common;
import io.netty.handler.codec.http.HttpHeaderValues; import io.netty.handler.codec.http.HttpHeaderValues;
import java.util.Map;
import org.xbib.datastructures.common.MultiMap; import org.xbib.datastructures.common.MultiMap;
import org.xbib.datastructures.common.Pair; import org.xbib.datastructures.common.Pair;
import org.xbib.datastructures.common.TreeMultiMap; import org.xbib.datastructures.common.TreeMultiMap;
@ -32,6 +33,7 @@ public class HttpParameters {
private static final Logger logger = Logger.getLogger(HttpParameters.class.getName()); private static final Logger logger = Logger.getLogger(HttpParameters.class.getName());
private static final char EQUAL_CHAR = '='; private static final char EQUAL_CHAR = '=';
private static final char AMPERSAND_CHAR = '&'; private static final char AMPERSAND_CHAR = '&';
private final MultiMap<String, String> multiMap; private final MultiMap<String, String> multiMap;
@ -60,6 +62,14 @@ public class HttpParameters {
this.encoding = charset; this.encoding = charset;
} }
public MultiMap<String, String> asMultiMap() {
return multiMap;
}
public Map<String, Collection<String>> asMap() {
return multiMap.asMap();
}
public CharSequence getContentType() { public CharSequence getContentType() {
return contentType; return contentType;
} }