Search in sources :

Example 1 with VertxServerResponseToHttpServletResponse

use of org.apache.servicecomb.foundation.vertx.http.VertxServerResponseToHttpServletResponse in project incubator-servicecomb-java-chassis by apache.

the class VertxRestDispatcher method onRequest.

private void onRequest(RoutingContext context) {
    if (transport == null) {
        transport = CseContext.getInstance().getTransportManager().findTransport(Const.RESTFUL);
    }
    HttpServletRequestEx requestEx = new VertxServerRequestToHttpServletRequest(context);
    HttpServletResponseEx responseEx = new VertxServerResponseToHttpServletResponse(context.response());
    RestProducerInvocation restProducerInvocation = new RestProducerInvocation();
    context.put(RestConst.REST_PRODUCER_INVOCATION, restProducerInvocation);
    restProducerInvocation.invoke(transport, requestEx, responseEx, httpServerFilters);
}
Also used : VertxServerResponseToHttpServletResponse(org.apache.servicecomb.foundation.vertx.http.VertxServerResponseToHttpServletResponse) HttpServletResponseEx(org.apache.servicecomb.foundation.vertx.http.HttpServletResponseEx) RestProducerInvocation(org.apache.servicecomb.common.rest.RestProducerInvocation) HttpServletRequestEx(org.apache.servicecomb.foundation.vertx.http.HttpServletRequestEx) VertxServerRequestToHttpServletRequest(org.apache.servicecomb.foundation.vertx.http.VertxServerRequestToHttpServletRequest)

Example 2 with VertxServerResponseToHttpServletResponse

use of org.apache.servicecomb.foundation.vertx.http.VertxServerResponseToHttpServletResponse 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)

Example 3 with VertxServerResponseToHttpServletResponse

use of org.apache.servicecomb.foundation.vertx.http.VertxServerResponseToHttpServletResponse 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();
}
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) InvocationCreator(org.apache.servicecomb.core.invocation.InvocationCreator) HttpServletRequestEx(org.apache.servicecomb.foundation.vertx.http.HttpServletRequestEx) VertxServerRequestToHttpServletRequest(org.apache.servicecomb.foundation.vertx.http.VertxServerRequestToHttpServletRequest)

Example 4 with VertxServerResponseToHttpServletResponse

use of org.apache.servicecomb.foundation.vertx.http.VertxServerResponseToHttpServletResponse in project java-chassis by ServiceComb.

the class EdgeInvocation method init.

public void init(String microserviceName, RoutingContext context, String path, List<HttpServerFilter> httpServerFilters) {
    this.microserviceName = microserviceName;
    this.requestEx = new VertxServerRequestToHttpServletRequest(context, path);
    this.responseEx = new VertxServerResponseToHttpServletResponse(context.response());
    this.routingContext = context;
    this.httpServerFilters = httpServerFilters;
    requestEx.setAttribute(RestConst.REST_REQUEST, requestEx);
}
Also used : VertxServerResponseToHttpServletResponse(org.apache.servicecomb.foundation.vertx.http.VertxServerResponseToHttpServletResponse) VertxServerRequestToHttpServletRequest(org.apache.servicecomb.foundation.vertx.http.VertxServerRequestToHttpServletRequest)

Example 5 with VertxServerResponseToHttpServletResponse

use of org.apache.servicecomb.foundation.vertx.http.VertxServerResponseToHttpServletResponse in project incubator-servicecomb-java-chassis by apache.

the class EdgeInvocation method init.

public void init(String microserviceName, RoutingContext context, String path, List<HttpServerFilter> httpServerFilters) {
    this.microserviceName = microserviceName;
    this.requestEx = new VertxServerRequestToHttpServletRequest(context, path);
    this.responseEx = new VertxServerResponseToHttpServletResponse(context.response());
    this.httpServerFilters = httpServerFilters;
    requestEx.setAttribute(RestConst.REST_REQUEST, requestEx);
}
Also used : VertxServerResponseToHttpServletResponse(org.apache.servicecomb.foundation.vertx.http.VertxServerResponseToHttpServletResponse) VertxServerRequestToHttpServletRequest(org.apache.servicecomb.foundation.vertx.http.VertxServerRequestToHttpServletRequest)

Aggregations

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