1 package com.netease.nimlib.sdk.v2.passthrough.model;
3 import android.text.TextUtils;
7 import java.io.Serializable;
14 private static final String TAG =
"V2NIMProxyRequest";
25 private final String path;
35 private String header;
69 this(null, path, method, header, body);
89 this(path, null, null);
130 if (method == null) {
142 this.method = method;
160 this.header = header;
187 if (TextUtils.isEmpty(path)) {
188 NimLog.e(TAG,
"path is empty");
192 NimLog.e(TAG,
"body is not empty when method is GET");
196 NimLog.e(TAG,
"body is empty when method is POST");
200 NimLog.e(TAG,
"body is empty when method is PUT");
203 if (!TextUtils.isEmpty(header) && !StringUtil.isJson(header)) {
204 NimLog.e(TAG,
"header is not json");
213 public static class Builder {
222 public Builder(String path) {
231 public Builder withZone(String zone) {
251 public Builder withHeader(String header) {
261 public Builder withBody(String body) {
V2NIMProxyRequest(String path)
构造函数
void setMethod(V2NIMProxyRequestMethod method)
设置method
V2NIM_PROXY_REQUEST_METHOD_GET
GET请求
V2NIMProxyRequestMethod getMethod()
获取method
V2NIM_PROXY_REQUEST_METHOD_POST
POST请求
V2NIMProxyRequest(String zone, String path, V2NIMProxyRequestMethod method, String header, String body)
构造函数
V2NIM_PROXY_REQUEST_METHOD_PUT
PUT请求
void setHeader(String header)
设置header
void setZone(String zone)
设置zone
String getHeader()
获取header
V2NIMProxyRequest(String path, V2NIMProxyRequestMethod method, String header, String body)
构造函数
V2NIMProxyRequest(String path, String header, String body)
构造函数
void setBody(String body)
设置body