NIMSDK-AOS  9.19.0
PassthroughProxyData.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.passthrough.model;
2 
3 import com.netease.nimlib.biz.constant.IPassThroughService;
4 import com.netease.nimlib.push.packet.marshal.Property;
5 
6 import java.io.Serializable;
7 
8 /**
9  * Created by hzsunyj on 2019-12-23.
10  */
11 public class PassthroughProxyData implements Serializable {
12 
13  public interface Method {
14 
15  int GET = 1;
16 
17  int POST = 2;
18 
19  int PUT = 3;
20 
21  int DELETE = 4;
22  }
23 
24  /**
25  * 映射一个视频云upstream host,不传用默认配置
26  */
27  private String zone;
28 
29  /**
30  * url中除了host的path
31  */
32  private String path;
33 
34  /**
35  * 选填,数字常量(1-get, 2-post, 3-put, 4-delete),默认post,
36  */
37  private int method;
38 
39  /**
40  * json格式
41  */
42  private String header;
43 
44  /**
45  * 格式自定,透传, post时,body不能为空
46  */
47  private String body;
48 
49  public PassthroughProxyData(String zone, String path, int method, String header, String body) {
50  this.zone = zone;
51  this.path = path;
52  this.method = method;
53  this.header = header;
54  this.body = body;
55  }
56 
57  public PassthroughProxyData(String path, int method, String header, String body) {
58  this(null, path, method, header, body);
59  }
60 
61  public PassthroughProxyData(String path, String header, String body) {
62  this(path, Method.POST, header, body);
63  }
64 
65  public PassthroughProxyData(String header, String body) {
66  this(null, header, body);
67  }
68 
69  public String getZone() {
70  return zone;
71  }
72 
73  public void setZone(String zone) {
74  this.zone = zone;
75  }
76 
77  public String getPath() {
78  return path;
79  }
80 
81  public void setPath(String path) {
82  this.path = path;
83  }
84 
85  public int getMethod() {
86  if (method == 0) {
87  method = Method.POST;
88  }
89  return method;
90  }
91 
92  public void setMethod(int method) {
93  this.method = method;
94  }
95 
96  public String getHeader() {
97  return header;
98  }
99 
100  public void setHeader(String header) {
101  this.header = header;
102  }
103 
104  public String getBody() {
105  return body;
106  }
107 
108  public void setBody(String body) {
109  this.body = body;
110  }
111 
112  public static PassthroughProxyData fromProperty(Property property) {
113  if (property == null) {
114  return null;
115  }
116  String header = property.get(IPassThroughService.PassThroughProxyTag.header);
117  String body = property.get(IPassThroughService.PassThroughProxyTag.body);
118  return new PassthroughProxyData(header, body);
119  }
120 }
static PassthroughProxyData fromProperty(Property property)
PassthroughProxyData(String zone, String path, int method, String header, String body)
PassthroughProxyData(String path, int method, String header, String body)