servlet里经常会用到一些GET方法
2009-07-03 09:26
393 查看
servlet里经常会用到一些GET方法
refer: http://hi.baidu.com/atomicface/blog/item/de62ac10c099c8cea6ef3f5b.html
2009-05-18 14:04
refer: http://hi.baidu.com/atomicface/blog/item/de62ac10c099c8cea6ef3f5b.html
2009-05-18 14:04
servlet里经常会用到一些GET方法,容易弄混,把它们记在这儿了。 servletContext.getContextPath()= servletContext.getRealPath("/")=F:/ess-branch/web/ servletContext.getRealPath("")=F:/ess-branch/web servletContext.getContextPath()= servletContext.getServerInfo()=Apache Tomcat/6.0.18 servletContext.getResource("/")=jndi:/localhost/ httpServletRequest.getContextPath()= httpServletRequest.getLocalAddr()=127.0.0.1 httpServletRequest.getLocalName()=localhost httpServletRequest.getLocalPort()=8090 httpServletRequest.getPathInfo()=null httpServletRequest.getPathTranslated()=null httpServletRequest.getProtocol()=HTTP/1.1 httpServletRequest.getQueryString()=null httpServletRequest.getRealPath("")已过时=F:/ess-branch/web httpServletRequest.getRemoteAddr()=127.0.0.1 httpServletRequest.getRemoteHost()=127.0.0.1 httpServletRequest.getRemotePort()=3288 httpServletRequest.getRemoteUser()=null httpServletRequest.getRequestURI()=/support/indexinfo/uploadPicture.htm httpServletRequest.getRequestURL()=http://localhost:8090/support/indexinfo/uploadPicture.htm httpServletRequest.getScheme()=http httpServletRequest.getServerName()=localhost httpServletRequest.getServerPort()=8090 httpServletRequest.getServletPath()=/support/indexinfo/uploadPicture.htm httpServletRequest.getUserPrincipal()=null ServletContext servletContext = ActionContext.getServletContext(); HttpServletRequest httpServletRequest = ActionContext.getRequest(); if (servletContext == null) { System.out.println("servletContext is null"); } if (httpServletRequest == null) { System.out.println("httpServletRequest is null"); } System.out.println("servletContext.getContextPath()=" + servletContext.getContextPath()); System.out.println("servletContext.getRealPath(/"//")=" + servletContext.getRealPath("/")); System.out.println("servletContext.getRealPath(/"/")=" + servletContext.getRealPath("")); System.out.println("servletContext.getContextPath()=" + servletContext.getContextPath()); System.out.println("servletContext.getServerInfo()=" + servletContext.getServerInfo()); try { System.out.println("servletContext.getResource(/"//")=" + servletContext.getResource("/")); } catch (MalformedURLException e) { e.printStackTrace(); } // httpServletRequest System.out.println("httpServletRequest.getContextPath()=" + httpServletRequest.getContextPath()); System.out.println("httpServletRequest.getLocalAddr()=" + httpServletRequest.getLocalAddr()); System.out.println("httpServletRequest.getLocalName()=" + httpServletRequest.getLocalName()); System.out.println("httpServletRequest.getLocalPort()=" + httpServletRequest.getLocalPort()); System.out.println("httpServletRequest.getPathInfo()=" + httpServletRequest.getPathInfo()); System.out.println("httpServletRequest.getPathTranslated()=" + httpServletRequest.getPathTranslated()); System.out.println("httpServletRequest.getProtocol()=" + httpServletRequest.getProtocol()); System.out.println("httpServletRequest.getQueryString()=" + httpServletRequest.getQueryString()); System.out.println("httpServletRequest.getRealPath(/"/")已过时=" + httpServletRequest.getRealPath("")); System.out.println("httpServletRequest.getRemoteAddr()=" + httpServletRequest.getRemoteAddr()); System.out.println("httpServletRequest.getRemoteHost()=" + httpServletRequest.getRemoteHost()); System.out.println("httpServletRequest.getRemotePort()=" + httpServletRequest.getRemotePort()); System.out.println("httpServletRequest.getRemoteUser()=" + httpServletRequest.getRemoteUser()); System.out.println("httpServletRequest.getRequestURI()=" + httpServletRequest.getRequestURI()); System.out.println("httpServletRequest.getRequestURL()=" + httpServletRequest.getRequestURL()); System.out.println("httpServletRequest.getScheme()=" + httpServletRequest.getScheme()); System.out.println("httpServletRequest.getServerName()=" + httpServletRequest.getServerName()); System.out.println("httpServletRequest.getServerPort()=" + httpServletRequest.getServerPort()); System.out.println("httpServletRequest.getServletPath()=" + httpServletRequest.getServletPath()); System.out.println("httpServletRequest.getUserPrincipal()=" + httpServletRequest.getUserPrincipal()); |
相关文章推荐
- servlet里经常会用到的一些GET方法
- [docker]一些经常用到的docker容器启动方法
- 一些经常用到的Check方法(Java)
- 一些经常用到的方法
- 经常用到操作文件的时候,下面总结一些方法
- 一些经常会用到的原生JS方法
- Velocity经常要用到的一些方法
- java中一些经常用到的小方法
- 一些经常用到的Check方法(Java) validate 1
- [docker]一些经常或不经常用到的镜像启动方法
- 经常用到的一些js方法
- java中经常用到的一些使用方法
- js中用到的一些属性方法
- Makefile 中经常会用到一些内置的标准变量
- Makefile 中经常会用到一些内置的标准变量
- 关于request.getInputStream和request.getReader 方法的一些区别以及遇到的一些问题
- 经常用到的一些小病的预防的治疗
- 一些经常用到的网站列表【常更新】
- 经常用到的一些命令行
- asp.net开发中经常用到的方法