cookiejoo opened a new issue, #13503:
URL: https://github.com/apache/dubbo/issues/13503

   如题:
   由于某些原因没有ZK部署只能把之前的dubbo接口全部改成http方式调用,客户端使用dubbo的Reference bean指定了http地址
   ` @Bean(name = "testFacade")
       public SensitiveDataSecretKeyFacade sensitiveDataSecretKeyFacade() {
           ReferenceConfig<TestFacade> reference = new ReferenceConfig<>();
           reference.setApplication(applicationConfig);
           reference.setRegistry(defaultRegistryConfig);
           reference.setProtocol(HTTP_PROTOCOL);
           reference.setUrl("http://localhost:8080/";);
           reference.setInterface(TestFacade.class);
           reference.setTimeout(3000);
           reference.setCheck(false);
           return reference.get();
       }
   `
   
   
   服务端无dubbo依赖,纯SpringBoot web模块,用什么方式返回数据,客户端才能收到?
   `
   @Controller
   @RequestMapping
   public class DubboController {
   
       // 
{"id":"-1653306013559333894","jsonrpc":"2.0","method":"getAllSecretKeys"}
       @RequestMapping(value = 
"/com.qihoo.finance.com.modules.crypto.facade.SensitiveDataSecretKeyFacade")
       public Response<List<TestDomain>> 
sensitiveDataSecretKeyFacade(HttpServletRequest request,
                                                                
HttpServletResponse response) throws IOException {
           System.out.println(request);
           try {
               ServletInputStream inputStream = request.getInputStream();
               if (inputStream != null) {
                   String[] list = IOUtils.readLines(inputStream);
                   StringBuffer stringBuffer = new StringBuffer();
                   for (String s : list) {
                       stringBuffer.append(s);
                   }
   
                   String objString = stringBuffer.toString();
                   System.out.println(objString);
               }
           } catch (IOException e) {
               log.error("agent info error:", e);
           }
           Response<List<TestDomain>> r = new Response<>();
           List<TestDomain> l = Lists.newArrayList();
           TestDomain d = new TestDomain();
           d.setVersion(1);
           l.add(d);
           r.success(l);
           String json = new Gson().toJson(r);
           
response.getOutputStream().write(json.getBytes(StandardCharsets.UTF_8));
           response.flushBuffer();
           return r;
       }
   `
   我尝试了四种方式
   1:直接返回Response<List<TestDomain>> 无效
   2:用ResponseEntity<Response<List<TestDomain>>>  包装返回也无效
   3:用response.getOutputStream().write(json) 也无效
   4:用@ResponseBody 也无效
   
   
   求助各位大能,帮帮我。
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to