HttpClient

1. Introduction

    It is an encapsulation of Apache's HttpClient. Official website address: https://hc.apache.org/httpcomponents-client-4.5.x/ .

2. Design ideas

  •  Action
    HttpClient is mainly encapsulated into an action model.
      
  • Event
    HttpClient can be called synchronously or asynchronously. If it is asynchronous, the result is usually processed through events.

3.Example

<?xml version='1.0' encoding='utf-8'?>

<HttpGet descriptors="xworker.httpclient.HttpGet" uri="https://www.baidu.com">
     <actions>
         <EntityUtils name="OnSuccess" descriptors="xworker.httpclient.EntityUtils" method="printlog"/>
         <GroovyAction name="OnException" descriptors="xworker.groovy.GroovyAction" code="exception.printStackTrace();"/>
     </actions>
</HttpGet>

    

Copyright ©  2007-2019 XWorker.org  版权所有  沪ICP备08000575号