154 lines
4.4 KiB
Java
154 lines
4.4 KiB
Java
/* */ package kong.unirest.cosmetics;
|
|
/* */
|
|
/* */ import java.net.http.WebSocket;
|
|
/* */ import java.time.Instant;
|
|
/* */ import java.util.Collection;
|
|
/* */ import java.util.Map;
|
|
/* */ import java.util.Optional;
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */ public class WebSocketRequestImpl
|
|
/* */ implements WebSocketRequest
|
|
/* */ {
|
|
/* 35 */ private Instant creation = Util.now();
|
|
/* 36 */ private Optional<ObjectMapper> objectMapper = Optional.empty();
|
|
/* */ private String responseEncoding;
|
|
/* 38 */ protected Headers headers = new Headers();
|
|
/* */ protected final Config config;
|
|
/* */ protected HttpMethod method;
|
|
/* */ protected Path url;
|
|
/* */ private Integer connectTimeout;
|
|
/* */
|
|
/* */ public WebSocketRequestImpl(Config config, String url) {
|
|
/* 45 */ this.config = config;
|
|
/* 46 */ this.url = new Path(url, config.getDefaultBaseUrl());
|
|
/* 47 */ this.headers.putAll(config.getDefaultHeaders());
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */ public WebSocketRequest routeParam(String name, String value) {
|
|
/* 52 */ this.url.param(name, value);
|
|
/* 53 */ return this;
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */ public WebSocketRequest routeParam(Map<String, Object> params) {
|
|
/* 58 */ this.url.param(params);
|
|
/* 59 */ return this;
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */ public WebSocketRequest basicAuth(String username, String password) {
|
|
/* 64 */ this.headers.setBasicAuth(username, password);
|
|
/* 65 */ return this;
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */ public WebSocketRequest accept(String value) {
|
|
/* 70 */ this.headers.accepts(value);
|
|
/* 71 */ return this;
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */ public WebSocketRequest responseEncoding(String encoding) {
|
|
/* 76 */ this.responseEncoding = encoding;
|
|
/* 77 */ return this;
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */ public WebSocketRequest header(String name, String value) {
|
|
/* 82 */ this.headers.add(name, value);
|
|
/* 83 */ return this;
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */ public WebSocketRequest headerReplace(String name, String value) {
|
|
/* 88 */ this.headers.replace(name, value);
|
|
/* 89 */ return this;
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */ public WebSocketRequest headers(Map<String, String> headerMap) {
|
|
/* 94 */ this.headers.add(headerMap);
|
|
/* 95 */ return this;
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */ public WebSocketRequest cookie(String name, String value) {
|
|
/* 100 */ this.headers.cookie(new Cookie(name, value));
|
|
/* 101 */ return this;
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */ public WebSocketRequest cookie(Cookie cookie) {
|
|
/* 106 */ this.headers.cookie(cookie);
|
|
/* 107 */ return this;
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */ public WebSocketRequest cookie(Collection<Cookie> cookies) {
|
|
/* 112 */ this.headers.cookie(cookies);
|
|
/* 113 */ return this;
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */ public WebSocketRequest queryString(String name, Object value) {
|
|
/* 118 */ this.url.queryString(name, value);
|
|
/* 119 */ return this;
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */ public WebSocketRequest queryString(String name, Collection<?> value) {
|
|
/* 124 */ this.url.queryString(name, value);
|
|
/* 125 */ return this;
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */ public WebSocketRequest queryString(Map<String, Object> parameters) {
|
|
/* 130 */ this.url.queryString(parameters);
|
|
/* 131 */ return this;
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */ public WebSocketResponse connect(WebSocket.Listener listener) {
|
|
/* 136 */ return this.config.getClient().websocket(this, listener);
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */ public Headers getHeaders() {
|
|
/* 141 */ return this.headers;
|
|
/* */ }
|
|
/* */
|
|
/* */
|
|
/* */ public String getUrl() {
|
|
/* 146 */ return this.url.toString();
|
|
/* */ }
|
|
/* */ }
|
|
|
|
|
|
/* Location: C:\Users\Xiao\Downloads\MinehutCosmetics.jar!\kon\\unirest\cosmetics\WebSocketRequestImpl.class
|
|
* Java compiler version: 11 (55.0)
|
|
* JD-Core Version: 1.1.3
|
|
*/ |