I\'m using Netty, and I\'ve got to accept and parse http POST requests. As far as I can tell, Netty doesn\'t have built-in support for POSTs, only GETs. (It\'s a fairly low-leve
You can use HttpPostRequestDecoder in Netty 4.x. It supports all kinds of POST body. Netty 4.x is marked as alpha at the moment, but very stable. See BodyParser in Xitrum.
If you only need to parse simple body, you can still use QueryStringDecoder in Netty 3.x by treating the POST body like the part after "?" in URL, like this:
QueryStringDecoder decoder = new QueryStringDecoder("?" +
request.getContent.toString(org.jboss.netty.util.CharsetUtil.UTF_8));
Which version of netty are you using? Netty's HttpRequest supports POST method. Not aware of any library which could parse bytes to map of params. This is usually what a servlet container does. Take a look at tomcat's source on how they have implemented processParameters() method http://svn.apache.org/repos/asf/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/Parameters.java
Netty has an advanced POST request decoder (HttpPostRequestDecoder) which can decode Http Attributes, FileUpload Content with chunked encoding.
Here is an simple form decoding example
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
HttpRequest request = (HttpRequest) e.getMessage();
HttpPostRequestDecoder decoder = new HttpPostRequestDecoder(new DefaultHttpDataFactory(false), request);
InterfaceHttpData data = decoder.getBodyHttpData("fromField1");
if (data.getHttpDataType() == HttpDataType.Attribute) {
Attribute attribute = (Attribute) data;
String value = attribute.getValue()
System.out.println("fromField1 :" + value);
}
}