use of org.apache.hc.core5.http.message.BasicHttpResponse in project httpcomponents-core by apache.
the class BasicResponseBuilder method build.
@Override
public BasicHttpResponse build() {
final BasicHttpResponse result = new BasicHttpResponse(getStatus());
result.setVersion(getVersion());
result.setHeaders(getHeaders());
return result;
}
use of org.apache.hc.core5.http.message.BasicHttpResponse in project httpcomponents-core by apache.
the class AsyncPushBuilder method build.
@Override
public AsyncPushProducer build() {
final HttpResponse response = new BasicHttpResponse(getStatus());
response.setVersion(getVersion());
response.setHeaders(getHeaders());
return new BasicPushProducer(response, entityProducer);
}
use of org.apache.hc.core5.http.message.BasicHttpResponse in project httpcomponents-core by apache.
the class AsyncResponseBuilder method build.
@Override
public AsyncResponseProducer build() {
final BasicHttpResponse response = new BasicHttpResponse(getStatus());
response.setVersion(getVersion());
response.setHeaders(getHeaders());
return new BasicResponseProducer(response, entityProducer);
}
use of org.apache.hc.core5.http.message.BasicHttpResponse in project httpcomponents-core by apache.
the class AsyncServerExpectationFilter method handle.
@Override
public final AsyncDataConsumer handle(final HttpRequest request, final EntityDetails entityDetails, final HttpContext context, final AsyncFilterChain.ResponseTrigger responseTrigger, final AsyncFilterChain chain) throws HttpException, IOException {
if (entityDetails != null) {
final Header h = request.getFirstHeader(HttpHeaders.EXPECT);
if (h != null && HeaderElements.CONTINUE.equalsIgnoreCase(h.getValue())) {
final boolean verified = verify(request, context);
if (verified) {
responseTrigger.sendInformation(new BasicHttpResponse(HttpStatus.SC_CONTINUE));
} else {
final HttpResponse expectationFailed = new BasicHttpResponse(HttpStatus.SC_EXPECTATION_FAILED);
final AsyncEntityProducer responseContentProducer = generateResponseContent(expectationFailed);
responseTrigger.submitResponse(expectationFailed, responseContentProducer);
return null;
}
}
}
return chain.proceed(request, entityDetails, context, responseTrigger);
}
use of org.apache.hc.core5.http.message.BasicHttpResponse in project httpcomponents-core by apache.
the class BasicAsyncServerExpectationDecorator method handleRequest.
@Override
public final void handleRequest(final HttpRequest request, final EntityDetails entityDetails, final ResponseChannel responseChannel, final HttpContext context) throws HttpException, IOException {
if (entityDetails != null) {
final Header h = request.getFirstHeader(HttpHeaders.EXPECT);
if (h != null && HeaderElements.CONTINUE.equalsIgnoreCase(h.getValue())) {
final AsyncResponseProducer producer = verify(request, context);
if (producer != null) {
responseProducerRef.set(producer);
producer.sendResponse(responseChannel, context);
return;
}
responseChannel.sendInformation(new BasicHttpResponse(HttpStatus.SC_CONTINUE), context);
}
}
handler.handleRequest(request, entityDetails, responseChannel, context);
}
Aggregations