Search in sources :

Example 6 with RestBindingParam

use of com.alipay.sofa.rpc.boot.runtime.param.RestBindingParam in project sofa-boot by alipay.

the class RestBindingConverter method convert.

@Override
public RpcBinding convert(SofaService sofaServiceAnnotation, SofaServiceBinding sofaServiceBindingAnnotation, BindingConverterContext bindingConverterContext) {
    RpcBindingParam bindingParam = new RestBindingParam();
    convertServiceAnnotation(bindingParam, sofaServiceAnnotation, sofaServiceBindingAnnotation, bindingConverterContext);
    return new RestBinding(bindingParam, bindingConverterContext.getApplicationContext(), bindingConverterContext.isInBinding());
}
Also used : RestBindingParam(com.alipay.sofa.rpc.boot.runtime.param.RestBindingParam) RestBinding(com.alipay.sofa.rpc.boot.runtime.binding.RestBinding) RpcBindingParam(com.alipay.sofa.rpc.boot.runtime.param.RpcBindingParam)

Example 7 with RestBindingParam

use of com.alipay.sofa.rpc.boot.runtime.param.RestBindingParam in project sofa-boot by sofastack.

the class RestBindingConverter method convert.

@Override
public RpcBinding convert(SofaReference sofaReferenceAnnotation, SofaReferenceBinding sofaReferenceBindingAnnotation, BindingConverterContext bindingConverterContext) {
    RpcBindingParam bindingParam = new RestBindingParam();
    convertReferenceAnnotation(bindingParam, sofaReferenceBindingAnnotation, bindingConverterContext);
    return new RestBinding(bindingParam, bindingConverterContext.getApplicationContext(), bindingConverterContext.isInBinding());
}
Also used : RestBindingParam(com.alipay.sofa.rpc.boot.runtime.param.RestBindingParam) RestBinding(com.alipay.sofa.rpc.boot.runtime.binding.RestBinding) RpcBindingParam(com.alipay.sofa.rpc.boot.runtime.param.RpcBindingParam)

Example 8 with RestBindingParam

use of com.alipay.sofa.rpc.boot.runtime.param.RestBindingParam in project sofa-boot by sofastack.

the class RestBindingConverter method convert.

@Override
public RpcBinding convert(SofaService sofaServiceAnnotation, SofaServiceBinding sofaServiceBindingAnnotation, BindingConverterContext bindingConverterContext) {
    RpcBindingParam bindingParam = new RestBindingParam();
    convertServiceAnnotation(bindingParam, sofaServiceAnnotation, sofaServiceBindingAnnotation, bindingConverterContext);
    return new RestBinding(bindingParam, bindingConverterContext.getApplicationContext(), bindingConverterContext.isInBinding());
}
Also used : RestBindingParam(com.alipay.sofa.rpc.boot.runtime.param.RestBindingParam) RestBinding(com.alipay.sofa.rpc.boot.runtime.binding.RestBinding) RpcBindingParam(com.alipay.sofa.rpc.boot.runtime.param.RpcBindingParam)

Example 9 with RestBindingParam

use of com.alipay.sofa.rpc.boot.runtime.param.RestBindingParam in project sofa-boot by sofastack.

the class BoltSwaggerServiceApplicationListener method onApplicationEvent.

@Override
public void onApplicationEvent(ApplicationStartedEvent applicationStartedEvent) {
    List<BindingParam> bindingParams = new ArrayList<>();
    bindingParams.add(new RestBindingParam());
    ServiceParam serviceParam = new ServiceParam();
    serviceParam.setInterfaceType(SwaggerRestService.class);
    serviceParam.setInstance(new SwaggerRestServiceImpl());
    serviceParam.setBindingParams(bindingParams);
    ServiceClient serviceClient = clientFactory.getClient(ServiceClient.class);
    serviceClient.service(serviceParam);
}
Also used : SwaggerRestServiceImpl(com.alipay.sofa.rpc.doc.swagger.rest.SwaggerRestServiceImpl) RestBindingParam(com.alipay.sofa.rpc.boot.runtime.param.RestBindingParam) ServiceClient(com.alipay.sofa.runtime.api.client.ServiceClient) ArrayList(java.util.ArrayList) BindingParam(com.alipay.sofa.runtime.api.client.param.BindingParam) RestBindingParam(com.alipay.sofa.rpc.boot.runtime.param.RestBindingParam) ServiceParam(com.alipay.sofa.runtime.api.client.param.ServiceParam)

Example 10 with RestBindingParam

use of com.alipay.sofa.rpc.boot.runtime.param.RestBindingParam in project sofa-boot by sofastack.

the class SwaggerServiceApplicationListener method onApplicationEvent.

@Override
public void onApplicationEvent(ApplicationStartedEvent event) {
    List<BindingParam> bindingParams = new ArrayList<>();
    bindingParams.add(new RestBindingParam());
    ServiceParam serviceParam = new ServiceParam();
    serviceParam.setInterfaceType(SwaggerService.class);
    serviceParam.setInstance(new SwaggerServiceImpl());
    serviceParam.setBindingParams(bindingParams);
    ServiceClient serviceClient = clientFactory.getClient(ServiceClient.class);
    serviceClient.service(serviceParam);
}
Also used : RestBindingParam(com.alipay.sofa.rpc.boot.runtime.param.RestBindingParam) ServiceClient(com.alipay.sofa.runtime.api.client.ServiceClient) ArrayList(java.util.ArrayList) BindingParam(com.alipay.sofa.runtime.api.client.param.BindingParam) RestBindingParam(com.alipay.sofa.rpc.boot.runtime.param.RestBindingParam) ServiceParam(com.alipay.sofa.runtime.api.client.param.ServiceParam)

Aggregations

RestBindingParam (com.alipay.sofa.rpc.boot.runtime.param.RestBindingParam)10 ServiceClient (com.alipay.sofa.runtime.api.client.ServiceClient)6 BindingParam (com.alipay.sofa.runtime.api.client.param.BindingParam)6 ServiceParam (com.alipay.sofa.runtime.api.client.param.ServiceParam)6 ArrayList (java.util.ArrayList)6 RestBinding (com.alipay.sofa.rpc.boot.runtime.binding.RestBinding)4 RpcBindingParam (com.alipay.sofa.rpc.boot.runtime.param.RpcBindingParam)4 SwaggerRestServiceImpl (com.alipay.sofa.rpc.doc.swagger.rest.SwaggerRestServiceImpl)2 HttpResponse (org.apache.http.HttpResponse)2 HttpClient (org.apache.http.client.HttpClient)2 HttpGet (org.apache.http.client.methods.HttpGet)2 HttpUriRequest (org.apache.http.client.methods.HttpUriRequest)2 Test (org.junit.Test)2 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)2