Skip to content

Instantly share code, notes, and snippets.

@LuciusChen
LuciusChen / HttpHelper.java
Created Nov 5, 2018
用于将字节数组转换为字符串
View HttpHelper.java
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import javax.servlet.ServletRequest;
/**
@LuciusChen
LuciusChen / PrettyFacesWrappedRequest.java
Created Nov 5, 2018
对 request 重新封装,使得 request 可以从此从 Servlet 中取值。
View PrettyFacesWrappedRequest.java
import java.util.Collections;
import java.util.Enumeration;
import java.util.Map;
import java.util.TreeMap;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
public class PrettyFacesWrappedRequest extends HttpServletRequestWrapper
@LuciusChen
LuciusChen / WrappedRequest.java
Last active Nov 5, 2018
对 request 重新封装,使得 request 可以从此从 InputStream 中取值。和 HttpHelper.java 一起使用。
View WrappedRequest.java
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.util.Enumeration;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;