1. 程式人生 > >Java 獲取Web項目相對webapp地址

Java 獲取Web項目相對webapp地址

etc ebp att web con https real 獲取 logs

ServletRequestAttributes aRequestAttributes=(ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
            HttpServletRequest request =aRequestAttributes==null?null:aRequestAttributes.getRequest();
            String webpath=request.getServletContext().getRealPath("/");

Java 獲取Web項目相對webapp地址