Search in sources :

Example 1 with RestVertxProducerInvocationCreator

use of org.apache.servicecomb.common.rest.RestVertxProducerInvocationCreator in project incubator-servicecomb-java-chassis by apache.

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);
}
Also used : RestProducerInvocationFlow(org.apache.servicecomb.common.rest.RestProducerInvocationFlow) VertxServerResponseToHttpServletResponse(org.apache.servicecomb.foundation.vertx.http.VertxServerResponseToHttpServletResponse) HttpServletResponseEx(org.apache.servicecomb.foundation.vertx.http.HttpServletResponseEx) RestVertxProducerInvocationCreator(org.apache.servicecomb.common.rest.RestVertxProducerInvocationCreator) InvocationCreator(org.apache.servicecomb.core.invocation.InvocationCreator) VertxRestInvocation(org.apache.servicecomb.common.rest.VertxRestInvocation) HttpServletRequestEx(org.apache.servicecomb.foundation.vertx.http.HttpServletRequestEx) VertxServerRequestToHttpServletRequest(org.apache.servicecomb.foundation.vertx.http.VertxServerRequestToHttpServletRequest) RestVertxProducerInvocationCreator(org.apache.servicecomb.common.rest.RestVertxProducerInvocationCreator)

Example 2 with RestVertxProducerInvocationCreator

use of org.apache.servicecomb.common.rest.RestVertxProducerInvocationCreator 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);
}
Also used : RestProducerInvocationFlow(org.apache.servicecomb.common.rest.RestProducerInvocationFlow) VertxServerResponseToHttpServletResponse(org.apache.servicecomb.foundation.vertx.http.VertxServerResponseToHttpServletResponse) HttpServletResponseEx(org.apache.servicecomb.foundation.vertx.http.HttpServletResponseEx) RestVertxProducerInvocationCreator(org.apache.servicecomb.common.rest.RestVertxProducerInvocationCreator) InvocationCreator(org.apache.servicecomb.core.invocation.InvocationCreator) VertxRestInvocation(org.apache.servicecomb.common.rest.VertxRestInvocation) HttpServletRequestEx(org.apache.servicecomb.foundation.vertx.http.HttpServletRequestEx) VertxServerRequestToHttpServletRequest(org.apache.servicecomb.foundation.vertx.http.VertxServerRequestToHttpServletRequest) RestVertxProducerInvocationCreator(org.apache.servicecomb.common.rest.RestVertxProducerInvocationCreator)

Aggregations

RestProducerInvocationFlow (org.apache.servicecomb.common.rest.RestProducerInvocationFlow)2 RestVertxProducerInvocationCreator (org.apache.servicecomb.common.rest.RestVertxProducerInvocationCreator)2 VertxRestInvocation (org.apache.servicecomb.common.rest.VertxRestInvocation)2 InvocationCreator (org.apache.servicecomb.core.invocation.InvocationCreator)2 HttpServletRequestEx (org.apache.servicecomb.foundation.vertx.http.HttpServletRequestEx)2 HttpServletResponseEx (org.apache.servicecomb.foundation.vertx.http.HttpServletResponseEx)2 VertxServerRequestToHttpServletRequest (org.apache.servicecomb.foundation.vertx.http.VertxServerRequestToHttpServletRequest)2 VertxServerResponseToHttpServletResponse (org.apache.servicecomb.foundation.vertx.http.VertxServerResponseToHttpServletResponse)2