use of org.wso2.transport.http.netty.message.HTTPCarbonMessage in project ballerina by ballerina-lang.
the class Options method createOutboundRequestMsg.
protected HTTPCarbonMessage createOutboundRequestMsg(Context context) {
HTTPCarbonMessage outboundRequestMsg = super.createOutboundRequestMsg(context);
outboundRequestMsg.setProperty(HttpConstants.HTTP_METHOD, HttpConstants.HTTP_METHOD_OPTIONS);
Tracer tracer = TraceUtil.getParentTracer(context.getParentWorkerExecutionContext());
HttpUtil.injectHeaders(outboundRequestMsg, tracer.getProperties());
tracer.addTags(HttpUtil.extractTraceTags(outboundRequestMsg));
return outboundRequestMsg;
}
use of org.wso2.transport.http.netty.message.HTTPCarbonMessage in project ballerina by ballerina-lang.
the class Patch method createOutboundRequestMsg.
protected HTTPCarbonMessage createOutboundRequestMsg(Context context) {
HTTPCarbonMessage outboundRequestMsg = super.createOutboundRequestMsg(context);
outboundRequestMsg.setProperty(HttpConstants.HTTP_METHOD, HttpConstants.HTTP_METHOD_PATCH);
Tracer tracer = TraceUtil.getParentTracer(context.getParentWorkerExecutionContext());
HttpUtil.injectHeaders(outboundRequestMsg, tracer.getProperties());
tracer.addTags(HttpUtil.extractTraceTags(outboundRequestMsg));
return outboundRequestMsg;
}
use of org.wso2.transport.http.netty.message.HTTPCarbonMessage in project ballerina by ballerina-lang.
the class Put method createOutboundRequestMsg.
protected HTTPCarbonMessage createOutboundRequestMsg(Context context) {
HTTPCarbonMessage outboundRequestMsg = super.createOutboundRequestMsg(context);
outboundRequestMsg.setProperty(HttpConstants.HTTP_METHOD, HttpConstants.HTTP_METHOD_PUT);
Tracer tracer = TraceUtil.getParentTracer(context.getParentWorkerExecutionContext());
HttpUtil.injectHeaders(outboundRequestMsg, tracer.getProperties());
tracer.addTags(HttpUtil.extractTraceTags(outboundRequestMsg));
return outboundRequestMsg;
}
use of org.wso2.transport.http.netty.message.HTTPCarbonMessage in project ballerina by ballerina-lang.
the class Promise method execute.
@Override
public void execute(Context context) {
BStruct connectionStruct = (BStruct) context.getRefArgument(0);
HTTPCarbonMessage inboundRequestMsg = HttpUtil.getCarbonMsg(connectionStruct, null);
HttpUtil.serverConnectionStructCheck(inboundRequestMsg);
BStruct pushPromiseStruct = (BStruct) context.getRefArgument(1);
Http2PushPromise http2PushPromise = HttpUtil.getPushPromise(pushPromiseStruct, HttpUtil.createHttpPushPromise(pushPromiseStruct));
HttpResponseFuture outboundRespStatusFuture = HttpUtil.pushPromise(inboundRequestMsg, http2PushPromise);
BValue[] outboundResponseStatus = handleResponseStatus(context, outboundRespStatusFuture);
context.setReturnValues(outboundResponseStatus);
}
use of org.wso2.transport.http.netty.message.HTTPCarbonMessage in project ballerina by ballerina-lang.
the class PushPromisedResponse method execute.
@Override
public void execute(Context context) {
BStruct connectionStruct = (BStruct) context.getRefArgument(0);
HTTPCarbonMessage inboundRequestMsg = HttpUtil.getCarbonMsg(connectionStruct, null);
HttpUtil.serverConnectionStructCheck(inboundRequestMsg);
BStruct pushPromiseStruct = (BStruct) context.getRefArgument(1);
Http2PushPromise http2PushPromise = HttpUtil.getPushPromise(pushPromiseStruct, null);
if (http2PushPromise == null) {
throw new BallerinaException("invalid push promise");
}
BStruct outboundResponseStruct = (BStruct) context.getRefArgument(2);
HTTPCarbonMessage outboundResponseMsg = HttpUtil.getCarbonMsg(outboundResponseStruct, HttpUtil.createHttpCarbonMessage(false));
HttpUtil.prepareOutboundResponse(context, inboundRequestMsg, outboundResponseMsg, outboundResponseStruct);
BValue[] outboundResponseStatus = pushResponseRobust(context, inboundRequestMsg, outboundResponseStruct, outboundResponseMsg, http2PushPromise);
context.setReturnValues(outboundResponseStatus);
}
Aggregations