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

com.gitee.apanlh.util.net.http.handler.body.HttpBodyJsonParseStrategy Maven / Gradle / Ivy

There is a newer version: 2.0.0.2
Show newest version
package com.gitee.apanlh.util.net.http.handler.body;

import com.gitee.apanlh.exp.HttpBodyParseException;
import com.gitee.apanlh.util.dataformat.JsonUtils;
import com.gitee.apanlh.util.net.http.HttpBody;
import com.gitee.apanlh.util.net.http.HttpClient;
import com.gitee.apanlh.util.net.http.HttpRequest;

/**
 * 	HTTPBody请求体解析
 * 	
JSON格式请求 * * @author Pan */ public class HttpBodyJsonParseStrategy implements HttpBodyParseStrategy { @Override public HttpRequest parse(HttpRequest httpRequest, HttpClient httpClient) throws HttpBodyParseException { HttpBody httpBody = httpRequest.getBody(); // 忽略解析 if (!httpBody.hasParameterParse()) { httpBody.setRequestBody(JsonUtils.toJson(httpBody.getRequestBody())); } httpRequest.setBody(httpBody); return httpRequest; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy