use of org.apache.servicecomb.foundation.vertx.http.StandardHttpServletResponseEx in project incubator-servicecomb-java-chassis by apache.
the class ServletRestDispatcher method service.
public void service(HttpServletRequest request, HttpServletResponse response) {
if (transport == null) {
transport = CseContext.getInstance().getTransportManager().findTransport(Const.RESTFUL);
}
// 异步场景
final AsyncContext asyncCtx = request.startAsync();
asyncCtx.addListener(restAsyncListener);
asyncCtx.setTimeout(ServletConfig.getServerTimeout());
HttpServletRequestEx requestEx = new StandardHttpServletRequestEx(request);
HttpServletResponseEx responseEx = new StandardHttpServletResponseEx(response);
RestServletProducerInvocation restProducerInvocation = new RestServletProducerInvocation();
restProducerInvocation.invoke(transport, requestEx, responseEx, httpServerFilters);
}
use of org.apache.servicecomb.foundation.vertx.http.StandardHttpServletResponseEx 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.foundation.vertx.http.StandardHttpServletResponseEx in project java-chassis by ServiceComb.
the class TestAbstractRestInvocation method setup.
@Before
public void setup() {
ConfigUtil.installDynamicConfig();
scbEngine = SCBBootstrap.createSCBEngineForTest().addProducerMeta("sid1", new TestPathSchema()).run();
operationMeta = scbEngine.getProducerMicroserviceMeta().operationMetas().get("test.sid1.dynamicId");
restOperation = RestMetaUtils.getRestOperationMeta(operationMeta);
new MockUp<System>() {
@Mock
long nanoTime() {
return nanoTime;
}
};
if (responseEx == null) {
responseEx = new StandardHttpServletResponseEx(servletResponse);
}
invocation = new Invocation(endpoint, operationMeta, operationMeta.buildBaseConsumerRuntimeType(), arguments);
initRestInvocation();
List<HttpServerFilter> httpServerFilters = SPIServiceUtils.getSortedService(HttpServerFilter.class);
restInvocation.setHttpServerFilters(httpServerFilters);
}
Aggregations