9 changed files with 122 additions and 111 deletions
@ -1,33 +0,0 @@ |
|||
package com.epmet.commons.tools.utils; |
|||
|
|||
import org.apache.http.HttpEntity; |
|||
import org.apache.http.HttpResponse; |
|||
import org.apache.http.StatusLine; |
|||
import org.apache.http.client.HttpResponseException; |
|||
import org.apache.http.client.ResponseHandler; |
|||
import org.apache.http.util.EntityUtils; |
|||
|
|||
import java.io.IOException; |
|||
import java.io.InputStream; |
|||
|
|||
/** |
|||
* 输入流响应处理器. |
|||
* |
|||
* @author Daniel Qian |
|||
*/ |
|||
public class InputStreamResponseHandler implements ResponseHandler<InputStream> { |
|||
public static final ResponseHandler<InputStream> INSTANCE = new InputStreamResponseHandler(); |
|||
private static final int STATUS_CODE_300 = 300; |
|||
|
|||
@Override |
|||
public InputStream handleResponse(final HttpResponse response) throws IOException { |
|||
final StatusLine statusLine = response.getStatusLine(); |
|||
final HttpEntity entity = response.getEntity(); |
|||
if (statusLine.getStatusCode() >= STATUS_CODE_300) { |
|||
EntityUtils.consume(entity); |
|||
throw new HttpResponseException(statusLine.getStatusCode(), statusLine.getReasonPhrase()); |
|||
} |
|||
return entity == null ? null : entity.getContent(); |
|||
} |
|||
|
|||
} |
@ -1,33 +0,0 @@ |
|||
package com.epmet.commons.tools.utils; |
|||
|
|||
import org.apache.http.Consts; |
|||
import org.apache.http.HttpEntity; |
|||
import org.apache.http.HttpResponse; |
|||
import org.apache.http.StatusLine; |
|||
import org.apache.http.client.HttpResponseException; |
|||
import org.apache.http.client.ResponseHandler; |
|||
import org.apache.http.util.EntityUtils; |
|||
|
|||
import java.io.IOException; |
|||
|
|||
/** |
|||
* copy from {@link org.apache.http.impl.client.BasicResponseHandler} |
|||
* |
|||
* @author Daniel Qian |
|||
*/ |
|||
public class Utf8ResponseHandler implements ResponseHandler<String> { |
|||
|
|||
public static final ResponseHandler<String> INSTANCE = new Utf8ResponseHandler(); |
|||
|
|||
@Override |
|||
public String handleResponse(final HttpResponse response) throws IOException { |
|||
final StatusLine statusLine = response.getStatusLine(); |
|||
final HttpEntity entity = response.getEntity(); |
|||
if (statusLine.getStatusCode() >= 300) { |
|||
EntityUtils.consume(entity); |
|||
throw new HttpResponseException(statusLine.getStatusCode(), statusLine.toString()); |
|||
} |
|||
return entity == null ? null : EntityUtils.toString(entity, Consts.UTF_8); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,66 @@ |
|||
package com.epmet.wxapi.param; |
|||
|
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2020/7/27 9:19 |
|||
*/ |
|||
@NoArgsConstructor |
|||
@Data |
|||
public class WxExtJson implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -559311391779774945L; |
|||
|
|||
private boolean extEnable; |
|||
private String extAppid; |
|||
private boolean directCommit; |
|||
private ExtBean ext; |
|||
|
|||
@NoArgsConstructor |
|||
@Data |
|||
private static class ExtBean { |
|||
private String extAppid; |
|||
private FootbarBean footbar; |
|||
@NoArgsConstructor |
|||
@Data |
|||
private static class FootbarBean { |
|||
private WorkBean work; |
|||
private OrgBean org; |
|||
private DataBean data; |
|||
private FindBean find; |
|||
|
|||
@NoArgsConstructor |
|||
@Data |
|||
private static class WorkBean { |
|||
private String name; |
|||
private String pageTile; |
|||
} |
|||
|
|||
@NoArgsConstructor |
|||
@Data |
|||
private static class OrgBean { |
|||
private String name; |
|||
private String pageTile; |
|||
} |
|||
|
|||
@NoArgsConstructor |
|||
@Data |
|||
private static class DataBean { |
|||
private String name; |
|||
private String pageTile; |
|||
} |
|||
|
|||
@NoArgsConstructor |
|||
@Data |
|||
private static class FindBean { |
|||
private String name; |
|||
private String pageTile; |
|||
} |
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue