public interface HttpServiceResponder
Modifier and Type | Method and Description |
---|---|
void |
send(int status,
ByteBuffer content,
String contentType,
Iterable<? extends Map.Entry<String,String>> headers)
Sends response back to client.
|
void |
send(int status,
ByteBuffer content,
String contentType,
Map<String,String> headers)
Sends response back to client.
|
void |
send(int status,
HttpContentProducer producer,
String contentType)
Sends response back to client with response body produced by the given
HttpContentProducer . |
void |
send(int status,
HttpContentProducer producer,
String contentType,
Iterable<? extends Map.Entry<String,String>> headers)
Sends response back to client with response body produced by the given
HttpContentProducer . |
void |
send(int status,
HttpContentProducer producer,
String contentType,
Map<String,String> headers)
Sends response back to client with response body produced by the given
HttpContentProducer . |
void |
send(int status,
org.apache.twill.filesystem.Location location,
String contentType)
Sends response back to client using content in the given
Location as the response
body. |
void |
send(int status,
org.apache.twill.filesystem.Location location,
String contentType,
Iterable<? extends Map.Entry<String,String>> headers)
Sends response back to client using content in the given
Location as the response
body. |
void |
send(int status,
org.apache.twill.filesystem.Location location,
String contentType,
Map<String,String> headers)
Sends response back to client using content in the given
Location as the response
body. |
void |
sendError(int status,
String errorMessage)
Sends an error message back to the client with the specified status code.
|
void |
sendJson(int status,
Object object)
Sends JSON response back to the client.
|
void |
sendJson(int status,
Object object,
Type type,
com.google.gson.Gson gson)
Sends JSON response back to the client using the given
Gson object. |
void |
sendJson(Object object)
Sends JSON response back to the client with a default status.
|
void |
sendStatus(int status)
Sends only a status code back to client without any content.
|
void |
sendStatus(int status,
Iterable<? extends Map.Entry<String,String>> headers)
Sends a status code and headers back to client without any content.
|
void |
sendStatus(int status,
Map<String,String> headers)
Sends a status code and headers back to client without any content.
|
void |
sendString(int status,
String data,
Charset charset)
Sends a string response back to the HTTP client.
|
void |
sendString(String data)
Sends a UTF-8 encoded string response back to the HTTP client with a default response status.
|
void sendJson(Object object)
object
- object that will be serialized into JSON and sent back as contentvoid sendJson(int status, Object object)
status
- status of the HTTP responseobject
- object that will be serialized into JSON and sent back as contentvoid sendJson(int status, Object object, Type type, com.google.gson.Gson gson)
Gson
object.status
- status of the HTTP responseobject
- the object that will be serialized into JSON and sent back as contenttype
- the type of objectgson
- the Gson object for serializationvoid sendString(String data)
data
- the string data to be sent backvoid sendString(int status, String data, Charset charset)
status
- status of the HTTP responsedata
- the data to be sent backcharset
- the Charset used to encode the stringvoid sendStatus(int status)
status
- status of the HTTP responsevoid sendStatus(int status, Map<String,String> headers)
status
- status of the HTTP responseheaders
- headers to sendvoid sendStatus(int status, Iterable<? extends Map.Entry<String,String>> headers)
status
- status of the HTTP responseheaders
- headers to send; each Map.Entry
contains the header name
and value to be sent, allowing multiple values for the same header namevoid sendError(int status, String errorMessage)
status
- status of the HTTP responseerrorMessage
- error message sent back to the clientvoid send(int status, ByteBuffer content, String contentType, Map<String,String> headers)
status
- status of the HTTP responsecontent
- content to be sent backcontentType
- type of contentheaders
- headers to be sent backvoid send(int status, ByteBuffer content, String contentType, Iterable<? extends Map.Entry<String,String>> headers)
status
- status of the HTTP responsecontent
- content to be sent backcontentType
- type of contentheaders
- headers to send; each Map.Entry
contains the header name
and value to be sent, allowing multiple values for the same header namevoid send(int status, HttpContentProducer producer, String contentType)
HttpContentProducer
.status
- status of the HTTP responseproducer
- a HttpContentProducer
to produce content to be sent backcontentType
- type of contentvoid send(int status, HttpContentProducer producer, String contentType, Map<String,String> headers)
HttpContentProducer
.status
- status of the HTTP responseproducer
- a HttpContentProducer
to produce content to be sent backcontentType
- type of contentheaders
- headers to be sent backvoid send(int status, HttpContentProducer producer, String contentType, Iterable<? extends Map.Entry<String,String>> headers)
HttpContentProducer
.status
- status of the HTTP responseproducer
- a HttpContentProducer
to produce content to be sent backcontentType
- type of contentheaders
- headers to send; each Map.Entry
contains the header name
and value to be sent, allowing multiple values for the same header namevoid send(int status, org.apache.twill.filesystem.Location location, String contentType) throws IOException
Location
as the response
body.status
- status of the HTTP responselocation
- location containing the response bodycontentType
- type of contentIOException
- if failed to open an InputStream
from the given Location
.void send(int status, org.apache.twill.filesystem.Location location, String contentType, Map<String,String> headers) throws IOException
Location
as the response
body.status
- status of the HTTP responselocation
- location containing the response bodycontentType
- type of contentheaders
- headers to be sent backIOException
- if failed to open an InputStream
from the given Location
.void send(int status, org.apache.twill.filesystem.Location location, String contentType, Iterable<? extends Map.Entry<String,String>> headers) throws IOException
Location
as the response
body.status
- status of the HTTP responselocation
- location containing the response bodycontentType
- type of contentheaders
- headers to send; each Map.Entry
contains the header name
and value to be sent, allowing multiple values for the same header nameIOException
- if failed to open an InputStream
from the given Location
.Copyright © 2024 Cask Data, Inc. Licensed under the Apache License, Version 2.0.