request.getPath()和获取ip地址、端口号
project为项目名,访问路径如下: ------------http://localhost:8088/project/uploadFile ------------/project request.getContextPath() ------------/uploadFile request.getServletPath() ------------/project/uploadFile request.getRequestURI() ------------http://localhost:8888/me/uploadFile request.getRequestURL() 获取服务端ip地址 request.getLocalAddr() 获取客户端ip地址 request.getRemoteAddr() 获取端口号 request.getServerPort() HttpServletRequest httpRequest = getHttpServletRequest(); String requestBody = getRequestBody(httpRequest); HttpServletRequest request = ((ServletRequestAttributes) (RequestContextHolder.currentRequestAttributes())).getRequest();