Skip to content

Instantly share code, notes, and snippets.

@LuciusChen
LuciusChen / HttpHelper.java
Created November 5, 2018 06:03
用于将字节数组转换为字符串
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 November 5, 2018 06:02
对 request 重新封装,使得 request 可以从此从 Servlet 中取值。
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 November 5, 2018 06:04
对 request 重新封装,使得 request 可以从此从 InputStream 中取值。和 HttpHelper.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;