Netty-http-response

Source: Internet
Author: User

Cookies can be set in response to return non-HTML pages, such as JPG or zip.

Setting Cookieresponse's eader explains which cookies the browser needs to remember. See.
Io.netty.handler.codec.http.DefaultCookie.Defaultcookie(string name, String value)
Create a cookie.
Httpheaders Io.netty.handler.codec.http.HttpMessage.Headers()
Returns the header of an HTTP message.
Httpheaders io.netty.handler.codec.http.HttpHeaders.Set(charsequence name, Object value)
Sets the key-value pair for the header.
Charsequence Io.netty.handler.codec.http.HttpHeaders.Names.Set_cookie
A string constant with the content "Set-cookie".
String Io.netty.handler.codec.http.ClientCookieEncoder.encode(Cookie cookie)
The cookie structure is encoded as a string so that it is placed in the HttpResponse header.
Sample

Back to other content such as pictures 1. Setting the head
Response.headers ().Set(Content_Type, "MAGE/JPEG; Charset=utf-8 ");//description content as Picture
2. Writing binary data
Bytebuf Io.netty.buffer.ByteBuf.writebytes(Bytebuf src)
The byte is first converted to Bytebuf, and then the binary data is written by this method.

Netty-http-response

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.