Search in sources :

Example 1 with VertxServerRequestToHttpServletRequest

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

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

the class TestHttpServerRequestUtils method VertxServerRequestToHttpServletRequest.

@Test
public void VertxServerRequestToHttpServletRequest(@Mocked RoutingContext context, @Mocked HttpServerRequest request) {
    HttpServerRequestWrapper wrapper = new HttpServerRequestWrapper(request);
    new Expectations() {

        {
            context.request();
            result = wrapper;
        }
    };
    VertxServerRequestToHttpServletRequest reqEx = new VertxServerRequestToHttpServletRequest(context, "abc");
    Assert.assertEquals("abc", reqEx.getRequestURI());
}
Also used : Expectations(mockit.Expectations) VertxServerRequestToHttpServletRequest(org.apache.servicecomb.foundation.vertx.http.VertxServerRequestToHttpServletRequest) Test(org.junit.Test)

Example 3 with VertxServerRequestToHttpServletRequest

use of org.apache.servicecomb.foundation.vertx.http.VertxServerRequestToHttpServletRequest 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)3 VertxServerResponseToHttpServletResponse (org.apache.servicecomb.foundation.vertx.http.VertxServerResponseToHttpServletResponse)2 Expectations (mockit.Expectations)1 RestProducerInvocation (org.apache.servicecomb.common.rest.RestProducerInvocation)1 HttpServletRequestEx (org.apache.servicecomb.foundation.vertx.http.HttpServletRequestEx)1 HttpServletResponseEx (org.apache.servicecomb.foundation.vertx.http.HttpServletResponseEx)1 Test (org.junit.Test)1