I am building an application in Netty which will allow people to download and upload file. But before that they should be able to log into the server. Once they log in they can download or upload the file.
Issue I am having is how will I know the data I have received is a string(username password string) or a chunked file(as I send files as ChunkedFile) or any other java object. How will I properly get them to original form. I know we can use encoder and decoders but there are no proper example available which shows anything close to the problem I am having?
Thanks
Send a POST http request with Headers
// Prepare the HTTP request.
FullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, uriJson.toASCIIString());
request.headers().set(CONTENT_TYPE, "text/plain; charset=UTF-8");
ByteBuf buf = Unpooled.copiedBuffer(data, CharsetUtil.UTF_8);
request.content().writeBytes(buf);
request.headers().set(CONTENT_LENGTH,request.content().readableBytes());
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.