use of org.webpieces.router.impl.proxyout.ResponseCreator.ResponseEncodingTuple in project webpieces by deanhiller.
the class ProxyStreamHandle method createResponseAndSend.
public XFuture<Void> createResponseAndSend(Http2Request request, StatusCode statusCode, String content, String extension, String defaultMime) {
if (content == null)
throw new IllegalArgumentException("content cannot be null");
ResponseEncodingTuple tuple = responseCreator.createResponse(request, statusCode, extension, defaultMime, true);
if (log.isDebugEnabled())
log.debug("content about to be sent back=" + content);
Charset encoding = tuple.mimeType.htmlResponsePayloadEncoding;
byte[] bytes = content.getBytes(encoding);
return maybeCompressAndSend(request, extension, tuple, bytes);
}
use of org.webpieces.router.impl.proxyout.ResponseCreator.ResponseEncodingTuple in project webpieces by deanhiller.
the class ProxyStreamHandle method sendRenderContent.
public XFuture<Void> sendRenderContent(RenderContentResponse resp) {
Http2Request request = originalHttp2Request;
ResponseEncodingTuple tuple = responseCreator.createContentResponse(request, resp.getStatusCode(), resp.getReason(), resp.getMimeType());
return maybeCompressAndSend(request, null, tuple, resp.getPayload());
}
Aggregations