java 获取登录前的页面,java 获取登录前的页面请求
String fromUrl=getRequest().getHeader("referer"); System.out.println("fromUrl = "+fromUrl); String fromUrlName=fromUrl.substring(fromUrl.lastIndexOf("/") + 1); System.out.println("fromUrlName = "+fromUrlName); --------------------------------打印信息-------------------------------- fromUrl = http://localhost:8080/duona/cashCouponIntroduceUI_54.htm fromUrlName = cashCouponIntroduceUI_54.htm --------------------------------完整方法-------------------------------- public String loginUI() { String fromUrl=getRequest().getHeader("referer"); System.out.println("fromUrl = "+fromUrl); String fromUrlName=fromUrl.substring(fromUrl.lastIndexOf("/") + 1); System.out.println("fromUrlName = "+fromUrlName); getSession().setAttribute("myUrl", fromUrl); setRequestAttribute(Conf.REQUEST_QR, q); return "loginUI"; }
更多请求信息
System.out.println("rotocol: " + getRequest().getProtocol()); System.out.println("Scheme: " + getRequest().getScheme()); System.out.println("Server Name: " + getRequest().getServerName() ); System.out.println("Server Port: " + getRequest().getServerPort()); System.out.println("rotocol: " + getRequest().getProtocol()); System.out.println("Remote Addr: " + getRequest().getRemoteAddr()); System.out.println("Remote Host: " + getRequest().getRemoteHost()); System.out.println("Character Encoding: " + getRequest().getCharacterEncoding()); System.out.println("Content Length: " + getRequest().getContentLength()); System.out.println("Content Type: "+ getRequest().getContentType()); System.out.println("Auth Type: " + getRequest().getAuthType()); System.out.println("HTTP Method: " + getRequest().getMethod()); System.out.println("ath Info: " + getRequest().getPathInfo()); System.out.println("ath Trans: " + getRequest().getPathTranslated()); System.out.println("Query String: " + getRequest().getQueryString()); System.out.println("Remote User: " + getRequest().getRemoteUser()); System.out.println("Session Id: " + getRequest().getRequestedSessionId()); System.out.println("Request URI: " + getRequest().getRequestURI()); System.out.println("Servlet Path: " + getRequest().getServletPath()); System.out.println("Accept: " + getRequest().getHeader("Accept")); System.out.println("Host: " + getRequest().getHeader("Host")); System.out.println("Referer : " + getRequest().getHeader("Referer")); System.out.println("Accept-Language : " + getRequest().getHeader("Accept-Language")); System.out.println("Accept-Encoding : " + getRequest().getHeader("Accept-Encoding")); System.out.println("User-Agent : " + getRequest().getHeader("User-Agent")); System.out.println("Connection : " + getRequest().getHeader("Connection")); System.out.println("Cookie : " + getRequest().getHeader("Cookie")); ------------------------打印信息---------------------------- rotocol: HTTP/1.1 Scheme: http Server Name: localhost Server Port: 8080 rotocol: HTTP/1.1 Remote Addr: 127.0.0.1 Remote Host: 127.0.0.1 Character Encoding: UTF-8 Content Length: -1 Content Type: null Auth Type: null HTTP Method: GET ath Info: null ath Trans: null Query String: q=0 Remote User: null Session Id: 74333DD1D3803A69B9B494EF4FDEE315 Request URI: /duona/loginUI.action Servlet Path: /loginUI.action Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Host: localhost:8080 Referer : http://localhost:8080/duona/cashCouponIntroduceUI_54.htm Accept-Language : zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3 Accept-Encoding : gzip, deflate User-Agent : Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20100101 Firefox/17.0 Connection : keep-alive Cookie : JSESSIONID=74333DD1D3803A69B9B494EF4FDEE315; Hm_lvt_cd6626481f1b4484f55efcd830b79566=1357607838,1357626598,1357694769,1357696520; Hm_lpvt_cd6626481f1b4484f55efcd830b79566=1357703643
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
蕃薯耀 2013年1月9日 11:44:35 星期三