I am developing a public REST API service using Netty. I am expecting some users will submit percent-encoded URL, for example with %20 for space.I need to unescape the percent-ecoded URL.
Is there a built in Netty API for this? Or is there any third party Java API for it?
I did search for a solution but could not find one.
Thanks in advance.
Netty has own class for that - io.netty.handler.codec.http.QueryStringDecoder
. It is also preferred against java.net.URLDecoder
as it is much faster.
Usage example:
//netty http request object
HttpRequest httpRequest = ...;
QueryStringDecoder decoder = new QueryStringDecoder(httpRequest.uri());
decoder.parameters().get("value");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.