您的位置:首页 > 产品设计 > UI/UE

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

2014-02-24 23:13 309 查看
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
[b]**************************************

[/b]



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

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: