use of com.linkedin.r2.transport.common.bridge.client.TransportCallbackAdapter in project rest.li by linkedin.
the class TransportDispatcherImpl method handleRestRequest.
@Override
public void handleRestRequest(RestRequest req, Map<String, String> wireAttrs, RequestContext requestContext, TransportCallback<RestResponse> callback) {
final URI address = req.getURI();
RestRequestHandler handler = _restHandlers.get(address);
if (handler == null) {
callback.onResponse(TransportResponseImpl.success(RestStatus.responseForStatus(RestStatus.NOT_FOUND, "No resource for URI:" + address)));
return;
}
try {
handler.handleRequest(req, requestContext, new TransportCallbackAdapter<RestResponse>(callback));
} catch (Exception e) {
callback.onResponse(TransportResponseImpl.<RestResponse>error(RestException.forError(RestStatus.INTERNAL_SERVER_ERROR, e)));
}
}
Aggregations