use of org.apache.servicecomb.common.rest.RestProducerInvocationFlow in project java-chassis by ServiceComb.
the class ServletRestDispatcher method service.
public void service(HttpServletRequest request, HttpServletResponse response) {
if (transport == null) {
transport = SCBEngine.getInstance().getTransportManager().findTransport(Const.RESTFUL);
microserviceMeta = SCBEngine.getInstance().getProducerMicroserviceMeta();
}
// 异步场景
AsyncContext asyncCtx = request.startAsync();
asyncCtx.addListener(restAsyncListener);
asyncCtx.setTimeout(ServletConfig.getAsyncServletTimeout());
HttpServletRequestEx requestEx = new StandardHttpServletRequestEx(request);
HttpServletResponseEx responseEx = new StandardHttpServletResponseEx(response);
if (SCBEngine.getInstance().isFilterChainEnabled()) {
((StandardHttpServletRequestEx) requestEx).setCacheRequest(true);
InvocationCreator creator = new RestServletProducerInvocationCreator(microserviceMeta, transport.getEndpoint(), requestEx, responseEx);
new RestProducerInvocationFlow(creator, requestEx, responseEx).run();
return;
}
RestServletProducerInvocation restProducerInvocation = new RestServletProducerInvocation();
restProducerInvocation.invoke(transport, requestEx, responseEx, httpServerFilters);
}
use of org.apache.servicecomb.common.rest.RestProducerInvocationFlow in project java-chassis by ServiceComb.
the class VertxRestDispatcher method onRequest.
protected void onRequest(RoutingContext context) {
if (transport == null) {
transport = SCBEngine.getInstance().getTransportManager().findTransport(Const.RESTFUL);
microserviceMeta = SCBEngine.getInstance().getProducerMicroserviceMeta();
}
HttpServletRequestEx requestEx = new VertxServerRequestToHttpServletRequest(context);
HttpServletResponseEx responseEx = new VertxServerResponseToHttpServletResponse(context.response());
if (SCBEngine.getInstance().isFilterChainEnabled()) {
InvocationCreator creator = new RestVertxProducerInvocationCreator(context, microserviceMeta, transport.getEndpoint(), requestEx, responseEx);
new RestProducerInvocationFlow(creator, requestEx, responseEx).run();
return;
}
VertxRestInvocation vertxRestInvocation = new VertxRestInvocation();
context.put(RestConst.REST_PRODUCER_INVOCATION, vertxRestInvocation);
vertxRestInvocation.invoke(transport, requestEx, responseEx, httpServerFilters);
}
use of org.apache.servicecomb.common.rest.RestProducerInvocationFlow in project java-chassis by ServiceComb.
the class DefaultEdgeDispatcher method requestByFilter.
protected void requestByFilter(RoutingContext context, String microserviceName, String versionRule, String path) {
HttpServletRequestEx requestEx = new VertxServerRequestToHttpServletRequest(context);
HttpServletResponseEx responseEx = new VertxServerResponseToHttpServletResponse(context.response());
InvocationCreator creator = new EdgeInvocationCreator(context, requestEx, responseEx, microserviceName, versionRule, path);
new RestProducerInvocationFlow(creator, requestEx, responseEx).run();
}
Aggregations