All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.feingto.cloud.kit.http.ClientRequest Maven / Gradle / Ivy

There is a newer version: 2.5.2.RELEASE
Show newest version
package com.feingto.cloud.kit.http;

import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.springframework.http.HttpMethod;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * 请求封装
 *
 * @author longfei
 */
@Getter
@Setter
@Accessors(fluent = true)
public class ClientRequest implements Serializable {
    private static final long serialVersionUID = 7771136304555035223L;

    /**
     * 服务ID
     */
    private String serviceId;

    private HttpMethod method = HttpMethod.GET;

    private String path;

    private Map paths = new HashMap<>();

    private Map headers = new HashMap<>();

    private Map queries = new HashMap<>();

    private byte[] body;

    /**
     * 请求标识,对应路由响应结果键
     */
    private String key;

    /**
     * 是否合法
     */
    private boolean successful = true;

    /**
     * 非法原因
     */
    private String error;

    /**
     * 添加地址参数键值对
     */
    public ClientRequest addPath(String key, String value) {
        this.paths.put(key, value);
        return this;
    }

    /**
     * 添加头部参数键值对
     */
    public ClientRequest addHeader(String key, String value) {
        this.headers.put(key, value);
        return this;
    }

    /**
     * 添加查询参数键值对
     */
    public ClientRequest addQuery(String key, String value) {
        this.queries.put(key, value);
        return this;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy