-
- @SuppressWarnings("rawtypes")
- private void printHeader(HttpServletRequest request) {
- Enumeration names = request.getHeaderNames();
- StringBuilder sb = new StringBuilder("headerInfo---");
- while(names.hasMoreElements()) {
- String name = names.nextElement().toString();
- Enumeration headers = request.getHeaders(name);
- sb.append(name).append(":");
- while(headers.hasMoreElements()) {
- sb.append(headers.nextElement()).append(" ");
- }
- sb.append("\n");
- }
- System.out.println(sb.toString());
- }
-
-
-
- private void printRequest(HttpServletRequest request) {
- StringBuilder sb = new StringBuilder("request----");
- sb.append("servletPath:").append(request.getServletPath()).append(" ");
- sb.append("servletPort:").append(request.getServerPort()).append(" ");
- sb.append("serverName:").append(request.getServerName()).append(" ");
- sb.append("scheme:").append(request.getScheme()).append(" ");
- sb.append("requestUrl:").append(request.getRequestURL().toString()).append("\n");
- sb.append("requestUri:").append(request.getRequestURI()).append(" ");
- sb.append("RequestedSessionId:").append(request.getRequestedSessionId()).append(" ");
- sb.append("remoteUser:").append(request.getRemoteUser()).append(" ");
- sb.append("authType:").append(request.getAuthType()).append(" ");
- sb.append("characterEncoding:").append(request.getCharacterEncoding()).append(" ");
- sb.append("contentLength:").append(request.getContentLength()).append(" ");
- sb.append("contentType:").append(request.getContentType()).append(" ");
- sb.append("contextPath:").append(request.getContextPath()).append(" ");
- sb.append("localAddr:").append(request.getLocalAddr()).append("\n");
- sb.append("localName:").append(request.getLocalName()).append(" ");
- sb.append("method:").append(request.getMethod()).append(" ");
- sb.append("pathInfo:").append(request.getPathInfo()).append(" ");
- sb.append("pathTranslated:").append(request.getPathTranslated()).append(" ");
- sb.append("protocol:").append(request.getProtocol()).append(" ");
- sb.append("queryString:").append(request.getQueryString()).append(" ");
- sb.append("remoteAddr:").append(request.getRemoteAddr()).append(" ");
- sb.append("remotePort:").append(request.getRemotePort()).append(" ");
- System.out.println(sb.toString());
- }