您的位置:首页 > 其它

绝对路径,URL获得方法

2008-12-12 19:03 218 查看
获取绝对路径

String path = request.getSession().getServletContext().getRealPath( "/" );
path = path + "WEB-INF//Config//WapConfig.xml";

获取绝对URL

public static String URL_PATH(HttpServletRequest request)
{
if(8443 == request.getServerPort())
return "https://" + request.getHeader("Host") + request.getContextPath() + "/";
else
return "http://" + request.getHeader("Host") + request.getContextPath() + "/";
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: