| 程序包 | 说明 |
|---|---|
| cn.sinlmao.commons.network.callback | |
| cn.sinlmao.commons.network.http | |
| cn.sinlmao.commons.network.soap |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
ImSessionCallback.doAuthentication(ImSession imSession,
ImRequest imRequest)
执行身份认证的业务回调
当配置会话状态需要身份认证后且未具备身份认证时,才会执行此回调
Business callback for identity authentication
This callback is executed when the configuration session state requires authentication and does not have authentication.
|
boolean |
ImSessionCallback.isAuthentication(ImSession imSession,
ImRequest imRequest)
确定是否具备身份认证的业务回调
当配置会话状态需要身份认证后,才会执行此回调
Determine if there is a business callback with authentication
This callback is only executed when the session state needs to be authenticated.
|
void |
ImHttpClientCallback.onCallRequest(ImRequest imRequest)
HTTP请求时回调
Callback on HTTP request
|
void |
ImHttpClientCallback.onComplete(ImRequest imRequest,
ImResponse imResponse)
HTTP请求完成时回调
仅在异步时才会执行
Callback when HTTP request is completed
Executed only when asynchronous
|
void |
ImHttpClientCallback.onError(ImRequest imRequest,
Throwable throwable)
HTTP请求错误时回调
仅在异步时才会执行
|
void |
ImSessionCallback.onError(ImSession imSession,
ImRequest imRequest,
Throwable throwable)
执行时发生错误的回调
仅在异步时才会执行
An error callback occurred during execution
Executed only when asynchronous
|
void |
ImHttpClientCallback.onSuccess(ImRequest imRequest,
ImResponse imResponse)
HTTP请求成功时回调
当前完成时指未发生任何错误时的完成,错误或异常的HTTP状态码(例如:404、500、401等)也会在此触发
仅在异步时才会执行
Callback when HTTP request succeeds
The current completion refers to the completion of any error, the error or abnormal HTTP status code (for example: 404, 500, 401, etc.) will also be triggered here.
|
| 限定符和类型 | 方法和说明 |
|---|---|
ImRequest |
ImRequest.addCookie(com.alibaba.fastjson.JSONObject cookies)
添加Cookie,当数据已经存在,则不再添加
Add a Cookie, when the data already exists, it will not be added
|
ImRequest |
ImRequest.addCookie(Map<String,String> cookies)
添加Cookie,当数据已经存在,则不再添加
Add a Cookie, when the data already exists, it will not be added
|
ImRequest |
ImRequest.addCookie(String name,
String value)
添加Cookie,当数据已经存在,则不再添加
Add a Cookie, when the data already exists, it will not be added
|
ImRequest |
ImRequest.addHeader(com.alibaba.fastjson.JSONObject headers)
添加Header,当数据已经存在,则不再添加
Add a Header, when the data already exists, it will not be added
|
ImRequest |
ImRequest.addHeader(Map<String,String> headers)
添加Header,当数据已经存在,则不再添加
Add a Header, when the data already exists, it will not be added
|
ImRequest |
ImRequest.addHeader(String name,
String value)
添加Header,当数据已经存在,则不再添加
Add a Header, when the data already exists, it will not be added
|
ImRequest |
ImRequest.disableProxyServer()
设置禁用通过代理服务器(抓包工具/特殊需要)访问
Setting disabled access via proxy server (capture tool/special needs)
|
ImRequest |
ImRequest.enableProxyServer(int port)
[本地代理] 设置启用通过代理服务器(抓包工具/特殊需要)访问
请注意,如果代理服务器(或抓包工具)配置不当或者无代理服务时可能导致访问异常
[Local Agent] Setting is enabled to access through a proxy server (capture tool/special needs)
Please note that if the proxy server (or the capture tool) is misconfigured or has no proxy service, it may cause an access exception.
|
ImRequest |
ImRequest.enableProxyServer(String host,
int port)
设置启用通过代理服务器(抓包工具/特殊需要)访问
请注意,如果代理服务器(或抓包工具)配置不当或者无代理服务时可能导致访问异常
Set to enable access via a proxy server (capture tool/special needs)
Please note that if the proxy server (or the capture tool) is misconfigured or has no proxy service, it may cause an access exception.
|
ImRequest |
ImRequest.setAllowNonStandard(boolean allowNonStandard)
设置是否允许非标准使用
Set whether to allow no standard
|
ImRequest |
ImRequest.setAsync(boolean async)
设置是否异步执行请求
Set whether to execute the request asynchronously
请注意,执行异步请求后,您的代码将不会在过程中同步,返回的ImResponse是一个空值,您需要实现ImHttpCallback获得相应正确的ImResponse
Note that after executing an asynchronous request, your code will not be synchronized in the process, the returned ImResponse is a null value, you need to implement ImHttpCallback to get the correct ImResponse
|
ImRequest |
ImRequest.setAutoServletSessionID(boolean autoServletSessionID)
设置是否自动传递 Java Servlet 的 SessionID,一般是Tomcat需要
Set whether to automatically transfer the SessionID of the Java Servlet, generally required by Tomcat
|
ImRequest |
ImRequest.setBytesLength(int bytesLength)
设置BytesLength长度
默认为4096
Set Request bytes length
Default is 4096
|
ImRequest |
ImRequest.setCallback(ImHttpClientCallback callback)
设置是否异步执行请求
Set whether to execute the request asynchronously
请注意,执行异步请求后,您的代码将不会在过程中同步,返回的ImResponse是一个空值,您需要实现ImHttpCallback获得相应正确的ImResponse
Note that after executing an asynchronous request, your code will not be synchronized in the process, the returned ImResponse is a null value, you need to implement ImHttpCallback to get the correct ImResponse
|
ImRequest |
ImRequest.setCharset(ImCharset imCharset)
设置Charset编码
默认为UTF-8
Set the Charset
Default is UTF-8
|
ImRequest |
ImRequest.setCharset(String charset)
设置Charset编码
默认为UTF-8
Set the Charset
Default is UTF-8
|
ImRequest |
ImRequest.setClientCertificate(byte[] bytes,
String password,
String format,
String standard)
设置客户端需要提供的证书,需要提供密码并指定证书格式和密钥算法
注意,一般此类业务应当与服务提供方协商对接,且以服务提供方实际验证为准
Set the certificate that the client needs to provide, need to provide a password and specify the certificate format and key algorithm
Note that generally such services should be negotiated and docked with the service provider, and the actual verification of the service provider shall prevail
|
ImRequest |
ImRequest.setClientCertificate(byte[] bytes,
String alias,
String password,
String format,
String standard)
设置客户端需要提供的证书,需要提供密码并指定证书格式和密钥算法
注意,一般此类业务应当与服务提供方协商对接,且以服务提供方实际验证为准
Set the certificate that the client needs to provide, need to provide a password and specify the certificate format and key algorithm
Note that generally such services should be negotiated and docked with the service provider, and the actual verification of the service provider shall prevail
|
ImRequest |
ImRequest.setClientCertificate(File file,
String password,
String format,
String standard)
设置客户端需要提供的证书,需要提供密码并指定证书格式和密钥算法
注意,一般此类业务应当与服务提供方协商对接,且以服务提供方实际验证为准
Set the certificate that the client needs to provide, need to provide a password and specify the certificate format and key algorithm
Note that generally such services should be negotiated and docked with the service provider, and the actual verification of the service provider shall prevail
|
ImRequest |
ImRequest.setClientCertificate(File file,
String alias,
String password,
String format,
String standard)
设置客户端需要提供的证书,需要提供密码并指定证书格式和密钥算法
注意,一般此类业务应当与服务提供方协商对接,且以服务提供方实际验证为准
Set the certificate that the client needs to provide, need to provide a password and specify the certificate format and key algorithm
Note that generally such services should be negotiated and docked with the service provider, and the actual verification of the service provider shall prevail
|
ImRequest |
ImRequest.setClientCertificate(InputStream inputStream,
String password,
String format,
String standard)
【完整实现】设置客户端需要提供的证书,需要提供密码并指定证书格式和密钥算法
注意,一般此类业务应当与服务提供方协商对接,且以服务提供方实际验证为准
Set the certificate that the client needs to provide, need to provide a password and specify the certificate format and key algorithm
Note that generally such services should be negotiated and docked with the service provider, and the actual verification of the service provider shall prevail
|
ImRequest |
ImRequest.setClientCertificate(InputStream inputStream,
String alias,
String password,
String format,
String standard)
设置客户端需要提供的证书,需要提供密码并指定证书格式和密钥算法
注意,一般此类业务应当与服务提供方协商对接,且以服务提供方实际验证为准
Set the certificate that the client needs to provide, need to provide a password and specify the certificate format and key algorithm
Note that generally such services should be negotiated and docked with the service provider, and the actual verification of the service provider shall prevail
|
ImRequest |
ImRequest.setClientCertificate(KeyManagerFactory keyManagerFactory)
【高级实现】设置客户端需要提供的证书,需要自行实现密钥库管理(KeyManagerFactory)
注意,一般此类业务应当与服务提供方协商对接,且以服务提供方实际验证为准
[Advanced Implementation] Set the certificate that the client needs to provide, need to provide a password and specify the certificate format and key algorithm
Note that generally such services should be negotiated and docked with the service provider, and the actual verification of the service provider shall prevail
|
ImRequest |
ImRequest.setClientCertificate(KeyStore keyStore,
String alias,
String password,
String standard)
【最终实现】设置客户端需要提供的证书,需要提供密码并指定证书格式和密钥算法
注意,一般此类业务应当与服务提供方协商对接,且以服务提供方实际验证为准
Set the certificate that the client needs to provide, need to provide a password and specify the certificate format and key algorithm
Note that generally such services should be negotiated and docked with the service provider, and the actual verification of the service provider shall prevail
|
ImRequest |
ImRequest.setContentType(ImContentType contentType)
设置内容类型(ContentType)
默认为application/x-www-form-urlencoded
Set Request content-type
Default is application/x-www-form-urlencoded
|
ImRequest |
ImRequest.setContentType(String contentType)
设置内容类型(ContentType)
Set Request some String content-type
|
ImRequest |
ImRequest.setCookie(com.alibaba.fastjson.JSONObject cookies)
添加Cookie,当数据已经存在,则以最后设置的为准
Set the Cookie.
|
ImRequest |
ImRequest.setCookie(Map<String,String> cookies)
添加Cookie,当数据已经存在,则以最后设置的为准
Set the Cookie.
|
ImRequest |
ImRequest.setCookie(String name,
String value)
添加Cookie,当数据已经存在,则以最后设置的为准
Set the Cookie.
|
ImRequest |
ImRequest.setForceInUrlSendData(boolean forceInUrlSendData)
设置是否强制使用URL发送数据
请注意,强制使用URL发送数据后将不能使用部分数据类型
Set whether to force in url send data
Please note that some data types will not be available after the data is forced to be sent using the URL.
|
ImRequest |
ImRequest.setHeader(com.alibaba.fastjson.JSONObject headers)
设置Header,当数据已经存在,则以最后设置的为准
Set the Header.
|
ImRequest |
ImRequest.setHeader(Map<String,String> headers)
设置Header,当数据已经存在,则以最后设置的为准
Set the Header.
|
ImRequest |
ImRequest.setHeader(String name,
String value)
设置Header,当数据已经存在,则以最后设置的为准
Set the Header.
|
ImRequest |
ImRequest.setHostnameVerifier(HostnameVerifier hostnameVerifier)
设置服务器主机名校验业务接口
注意,一般此类业务应当与服务提供方协商对接
注意,如果设置忽略SSL证书验证则此项设置无效
Set the server host name verification service interface
Note that generally such services should be negotiated and docked with the service provider
Note that if the setting ignores SSL certificate verification, this setting is invalid
|
ImRequest |
ImRequest.setIgnoreSSLCertVerify(boolean ignoreSSLCertVerify)
设置是否忽略SSLCertVerify
Set whether to ignore
|
ImRequest |
ImRequest.setInputData(ImBytesData inputData)
设置ImBytesData类型输入数据
Set ImBytesData/bytes type input data
|
ImRequest |
ImRequest.setInputData(ImFileData inputData)
设置ImFileData类型输入数据
Set ImFileData type input data
|
ImRequest |
ImRequest.setInputData(ImMultipartFormData inputData)
设置ImMultipartFormData类型输入数据
Set ImMultipartFormData type input data
|
ImRequest |
ImRequest.setInputData(com.alibaba.fastjson.JSONObject inputData)
设置JSONObject类型输入数据
Set JSONObject type input data
|
ImRequest |
ImRequest.setInputData(Map<String,String> inputData)
设置Map类型输入数据
Set Map type input data
|
ImRequest |
ImRequest.setInputData(String inputData)
设置String类型输入数据
Set String type input data
|
ImRequest |
ImRequest.setKeepAlive(boolean keepAlive)
设置是否为长连接
Set whether to Keep-Alive
|
ImRequest |
ImRequest.setMethod(ImMethod method)
设置Method方法
默认为GET
Set the Method
Default is GET
|
ImRequest |
ImRequest.setQueryParams(com.alibaba.fastjson.JSONObject queryParams)
设置JSONObject类型查询参数数据
Set JSONObject type query parameter data
|
ImRequest |
ImRequest.setQueryParams(Map<String,String> queryParams)
设置Map类型查询参数数据
Set Map type query parameter data
|
ImRequest |
ImRequest.setQueryParams(String queryParams)
设置String类型查询参数数据
Set String type query parameter data
|
ImRequest |
ImRequest.setRestfulMode(boolean restfulMode)
设置是否为Restful模式
Set whether to restful mode
|
ImRequest |
ImRequest.setTomcatLowVersionCompatible(boolean tomcatLowVersionCompatible)
已过时。
1.5.0
|
ImRequest |
ImRequest.setTrustCertificate(TrustManager[] trustManagers)
【高级实现】设置客户端需要信任服务端的证书信任库,需要自行实现证书信任库对象(TrustManager[])
注意,一般此类业务应当与服务提供方协商对接,且以服务提供方实际验证为准
注意,如果设置忽略SSL证书验证则此项设置无效
[Advanced Implementation] Set the client to trust the server's certificate trust store and implement the certificate trust store object (TrustManager[])
Note that generally such services should be negotiated and docked with the service provider, and the actual verification of the service provider shall prevail
Note that if the setting ignores SSL certificate verification, this setting is invalid
|
ImRequest |
ImRequest.setTrustCertificate(TrustManagerFactory trustManagerFactory)
【高级实现】设置客户端需要信任服务端的证书信任库,需要自行实现证书信任库管理(TrustManagerFactory)
注意,一般此类业务应当与服务提供方协商对接,且以服务提供方实际验证为准
注意,如果设置忽略SSL证书验证则此项设置无效
[Advanced Implementation] Set the client to trust the server's certificate trust store, and implement the certificate trust store management (TrustManagerFactory)
Note that generally such services should be negotiated and docked with the service provider, and the actual verification of the service provider shall prevail
Note that if the setting ignores SSL certificate verification, this setting is invalid
|
ImRequest |
ImRequest.setUrl(String url)
设置URL
Set the URL
|
ImRequest |
ImRequest.setUrlEncode(boolean urlEncode)
设置是否需要对参数进行URL编码
请注意,如果不在GET方法时或者不在配置强制使用URL发送数据后使用将可能导致数据传输异常
Set whether URL encoding of parameters is required
Please note that if you do not use the GET method or do not use the mandatory URL to send data, it may cause abnormal data transmission.
|
ImRequest |
ImRequest.setUseCache(boolean useCache)
设置是否使用缓存
Set whether to use cache
|
ImRequest |
ImRequest.setUserAgent(String userAgent)
设置用户代理(User-Agent)信息
Set the Use Agent (User-Agent) information
|
| 限定符和类型 | 方法和说明 |
|---|---|
static ImResponse |
ImHttpClient.send(ImRequest imRequest)
发起请求
Send Request
请注意,如果在ImRequest中指示为异步请求,那么此时返回的ImResponse将会是空值,需要在ImRequest中另行实现ImHttpCallback接口才能获得返回值
Note that if the asynchronous request is indicated in the ImRequest, then the ImResponse returned at this time will be null,
and the ImHttpCallback interface needs to be implemented separately in the ImRequest to get the return value.
|
static ImResponse |
ImHttpClient.send(ImRequest imRequest,
ImSession imSession)
发起一个带会话状态的请求
Send a request with a session state
请注意,如果在ImRequest中指示为异步请求,那么此时返回的ImResponse将会是空值,需要在ImRequest中另行实现ImHttpCallback接口才能获得返回值
Note that if the asynchronous request is indicated in the ImRequest, then the ImResponse returned at this time will be null,
and the ImHttpCallback interface needs to be implemented separately in the ImRequest to get the return value.
|
| 限定符和类型 | 方法和说明 |
|---|---|
ImRequest |
ImHttpSoapRequest.getRequest()
获取ImRequest(HTTP)对象实体
Get the ImRequest (HTTP) object entity
|
Copyright © 2021. All rights reserved.