Java examples for javax.servlet.http:HttpServletRequest
Get encoding information from HttpServletRequest
import java.io.IOException; import java.io.UnsupportedEncodingException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class Main{ public static String encoding(HttpServletRequest request) { String encoding = request.getHeader("USER-AGENT").toLowerCase(); encoding = encoding.indexOf("msie") > 0 ? "GBK" : "UTF-8"; return encoding; }/*from www . j a v a 2s . com*/ }