request获取地址url中各个部分的方法

来源:互联网 发布:dotamax周报怎么看数据 编辑:程序博客网 时间:2024/05/17 04:08

http://localhost:8080/coreSvn/bosn/admin/NewsInfo!add.action

***************************************

ActionContext ac = ActionContext.getContext();

   ServletContext sc = (ServletContext)ac.get(ServletActionContext.SERVLET_CONTEXT);
   String ctxDir = sc.getRealPath(File.separator);
   logger.info("ctxDir:"+ctxDir);

sc.getRealPath:E:\xx\workspace\coreSvn\WebContent\

sc.getContextPath:/coreSvn
csc.getMajorVersion:2
sc.getMinorVersion:5
sc.getServerInfo:Apache Tomcat/6.0.37

**************************************


request.getIntHeader-1
request.getLocalAddr 0.0.0.0
request.getLocalName 0.0.0.0
request.getLocalPort 8080
request.getMethod GET
request.getPathInfo null
request.getPathTranslatednull
request.getProtocol HTTP/1.1
request.getRemoteAddr 0:0:0:0:0:0:0:1
request.getRemoteHost 0:0:0:0:0:0:0:1
request.getRemotePort 52686
request.getRemoteUser null
request.getRequestURI /coreSvn/bosn/admin/NewsInfo!add.action
request.getRequestURL http://localhost:8080/coreSvn/bosn/admin/NewsInfo!add.action
request.getScheme http
request.getServerName localhost
request.getServerPort 8080
request.getServletPath/bosn/admin/NewsInfo!add.action






0 0