Search in sources :

Example 1 with RestfulClientResponse

use of com.weibo.api.motan.protocol.restful.support.RestfulClientResponse in project motan by weibocom.

the class ClientFilter method filter.

@Override
public Response filter(Caller<?> caller, Request request) {
    // pass attachment
    request.setAttachment("testName", "testName");
    Response response = caller.call(request);
    assert response instanceof RestfulClientResponse;
    RestfulClientResponse rfr = (RestfulClientResponse) response;
    // obtain httpResponse 、 responseStatus、responseHeader and so on
    rfr.getHttpResponse();
    return response;
}
Also used : Response(com.weibo.api.motan.rpc.Response) RestfulClientResponse(com.weibo.api.motan.protocol.restful.support.RestfulClientResponse) RestfulClientResponse(com.weibo.api.motan.protocol.restful.support.RestfulClientResponse)

Example 2 with RestfulClientResponse

use of com.weibo.api.motan.protocol.restful.support.RestfulClientResponse in project motan by weibocom.

the class RestfulClientInvoker method invoke.

public Object invoke(Object[] args, Request req, RestfulClientResponse resp) {
    ClientInvocation request = createRequest(args, req);
    ClientResponse response = (ClientResponse) request.invoke();
    resp.setAttachments(RestfulUtil.decodeAttachments(response.getStringHeaders()));
    resp.setHttpResponse(response);
    ClientContext context = new ClientContext(request, response, entityExtractorFactory);
    return extractor.extractEntity(context);
}
Also used : RestfulClientResponse(com.weibo.api.motan.protocol.restful.support.RestfulClientResponse) ClientResponse(org.jboss.resteasy.client.jaxrs.internal.ClientResponse) ClientContext(org.jboss.resteasy.client.jaxrs.internal.proxy.extractors.ClientContext) ClientInvocation(org.jboss.resteasy.client.jaxrs.internal.ClientInvocation)

Aggregations

RestfulClientResponse (com.weibo.api.motan.protocol.restful.support.RestfulClientResponse)2 Response (com.weibo.api.motan.rpc.Response)1 ClientInvocation (org.jboss.resteasy.client.jaxrs.internal.ClientInvocation)1 ClientResponse (org.jboss.resteasy.client.jaxrs.internal.ClientResponse)1 ClientContext (org.jboss.resteasy.client.jaxrs.internal.proxy.extractors.ClientContext)1