public interface HttpResponder
| Modifier and Type | Method and Description |
|---|---|
void |
sendByteArray(io.netty.handler.codec.http.HttpResponseStatus status,
byte[] bytes,
io.netty.handler.codec.http.HttpHeaders headers)
Send a response containing raw bytes.
|
void |
sendBytes(io.netty.handler.codec.http.HttpResponseStatus status,
ByteBuffer buffer,
io.netty.handler.codec.http.HttpHeaders headers)
Sends a response containing raw bytes.
|
ChunkResponder |
sendChunkStart(io.netty.handler.codec.http.HttpResponseStatus status)
Respond to the client saying the response will be in chunks.
|
ChunkResponder |
sendChunkStart(io.netty.handler.codec.http.HttpResponseStatus status,
io.netty.handler.codec.http.HttpHeaders headers)
Respond to the client saying the response will be in chunks.
|
void |
sendContent(io.netty.handler.codec.http.HttpResponseStatus status,
BodyProducer bodyProducer,
io.netty.handler.codec.http.HttpHeaders headers)
Sends response back to client.
|
void |
sendContent(io.netty.handler.codec.http.HttpResponseStatus status,
io.netty.buffer.ByteBuf content,
io.netty.handler.codec.http.HttpHeaders headers)
Send response back to client.
|
void |
sendFile(File file)
Sends a file content back to client with response status 200 with content type as "application/octet-stream".
|
void |
sendFile(File file,
io.netty.handler.codec.http.HttpHeaders headers)
Sends a file content back to client with response status 200.
|
void |
sendJson(io.netty.handler.codec.http.HttpResponseStatus status,
String jsonString)
Sends json response back to the client.
|
void |
sendStatus(io.netty.handler.codec.http.HttpResponseStatus status)
Send only a status code back to client without any content.
|
void |
sendStatus(io.netty.handler.codec.http.HttpResponseStatus status,
io.netty.handler.codec.http.HttpHeaders headers)
Send only a status code back to client without any content.
|
void |
sendString(io.netty.handler.codec.http.HttpResponseStatus status,
String data)
Send a string response in UTF-8 encoding back to the http client.
|
void |
sendString(io.netty.handler.codec.http.HttpResponseStatus status,
String data,
io.netty.handler.codec.http.HttpHeaders headers)
Send a string response in UTF-8 encoding back to the http client.
|
void sendJson(io.netty.handler.codec.http.HttpResponseStatus status,
String jsonString)
application/json.status - Status of the response.jsonString - The json string to send back.void sendString(io.netty.handler.codec.http.HttpResponseStatus status,
String data)
status - status of the Http response.data - string data to be sent back.void sendString(io.netty.handler.codec.http.HttpResponseStatus status,
String data,
io.netty.handler.codec.http.HttpHeaders headers)
status - status of the Http response.data - string data to be sent back.headers - additional headers to send with the response.void sendStatus(io.netty.handler.codec.http.HttpResponseStatus status)
status - status of the Http response.void sendStatus(io.netty.handler.codec.http.HttpResponseStatus status,
io.netty.handler.codec.http.HttpHeaders headers)
status - status of the Http response.headers - additional headers to send with the response.void sendByteArray(io.netty.handler.codec.http.HttpResponseStatus status,
byte[] bytes,
io.netty.handler.codec.http.HttpHeaders headers)
status - status of the Http response.bytes - bytes to be sent back.headers - additional headers to send with the response.void sendBytes(io.netty.handler.codec.http.HttpResponseStatus status,
ByteBuffer buffer,
io.netty.handler.codec.http.HttpHeaders headers)
status - status of the Http responsebuffer - bytes to sendheaders - additional headers to send with the response.ChunkResponder sendChunkStart(io.netty.handler.codec.http.HttpResponseStatus status)
ChunkResponder returned.status - the status code to respond withChunkResponder sendChunkStart(io.netty.handler.codec.http.HttpResponseStatus status, io.netty.handler.codec.http.HttpHeaders headers)
ChunkResponder returned.status - the status code to respond withheaders - additional headers to send with the response.void sendContent(io.netty.handler.codec.http.HttpResponseStatus status,
io.netty.buffer.ByteBuf content,
io.netty.handler.codec.http.HttpHeaders headers)
status - Status of the response.content - Content to be sent back.headers - additional headers to send with the response.void sendFile(File file) throws IOException
file - The file to sendIOException - if failed to open and read the filevoid sendFile(File file, io.netty.handler.codec.http.HttpHeaders headers) throws IOException
file - The file to sendheaders - additional headers to send with the response.IOException - if failed to open and read the filevoid sendContent(io.netty.handler.codec.http.HttpResponseStatus status,
BodyProducer bodyProducer,
io.netty.handler.codec.http.HttpHeaders headers)
BodyProducer. This method
will return immediate after it is called. Invocation of methods on the given BodyProducer will be
triggered from another thread. Default content type is "application/octet-stream", but can be
overridden by the headers parameter.status - Status of the response.bodyProducer - a BodyProducer to produce response body.headers - additional headers to send with the response.Copyright 2020 Cask, Inc. Licensed under the Apache License, Version 2.0