use of org.ballerinalang.net.http.DataContext in project ballerina by ballerina-lang.
the class GetPromisedResponse method execute.
@Override
public void execute(Context context, CallableUnitCallback callback) {
DataContext dataContext = new DataContext(context, callback);
BStruct pushPromiseStruct = (BStruct) context.getRefArgument(1);
Http2PushPromise http2PushPromise = HttpUtil.getPushPromise(pushPromiseStruct, null);
if (http2PushPromise == null) {
throw new BallerinaException("invalid push promise");
}
BStruct bConnector = (BStruct) context.getRefArgument(0);
HttpClientConnector clientConnector = (HttpClientConnector) bConnector.getNativeData(HttpConstants.HTTP_CLIENT);
clientConnector.getPushResponse(http2PushPromise).setPushResponseListener(new PushResponseListener(dataContext), http2PushPromise.getPromisedStreamId());
}
use of org.ballerinalang.net.http.DataContext in project ballerina by ballerina-lang.
the class GetResponse method execute.
@Override
public void execute(Context context, CallableUnitCallback callback) {
DataContext dataContext = new DataContext(context, callback);
BStruct handleStruct = ((BStruct) context.getRefArgument(1));
ResponseHandle responseHandle = (ResponseHandle) handleStruct.getNativeData(HttpConstants.TRANSPORT_HANDLE);
if (responseHandle == null) {
throw new BallerinaException("invalid http handle");
}
BStruct bConnector = (BStruct) context.getRefArgument(0);
HttpClientConnector clientConnector = (HttpClientConnector) bConnector.getNativeData(HttpConstants.HTTP_CLIENT);
clientConnector.getResponse(responseHandle).setHttpConnectorListener(new ResponseListener(dataContext));
}
use of org.ballerinalang.net.http.DataContext in project ballerina by ballerina-lang.
the class GetNextPromise method execute.
@Override
public void execute(Context context, CallableUnitCallback callback) {
DataContext dataContext = new DataContext(context, callback);
BStruct handleStruct = ((BStruct) context.getRefArgument(1));
ResponseHandle responseHandle = (ResponseHandle) handleStruct.getNativeData(HttpConstants.TRANSPORT_HANDLE);
if (responseHandle == null) {
throw new BallerinaException("invalid http handle");
}
BStruct bConnector = (BStruct) context.getRefArgument(0);
HttpClientConnector clientConnector = (HttpClientConnector) bConnector.getNativeData(HttpConstants.HTTP_CLIENT);
clientConnector.getNextPushPromise(responseHandle).setPushPromiseListener(new PromiseListener(dataContext));
}
Aggregations