Example usage for org.springframework.web.util WebUtils DEFAULT_WEB_APP_ROOT_KEY

List of usage examples for org.springframework.web.util WebUtils DEFAULT_WEB_APP_ROOT_KEY

Introduction

In this page you can find the example usage for org.springframework.web.util WebUtils DEFAULT_WEB_APP_ROOT_KEY.

Prototype

String DEFAULT_WEB_APP_ROOT_KEY

To view the source code for org.springframework.web.util WebUtils DEFAULT_WEB_APP_ROOT_KEY.

Click Source Link

Document

Default web app root key: "webapp.root".

Usage

From source file:com.ineunet.knife.upload.WebPaths.java

/**
 * @return e.g. /Workspace/iNeunet/ioo/src/main/webapp
 *//*from   w w  w .  ja v  a2  s. c om*/
public static String getRootPath() {
    if (rootPath == null) {
        WebApplicationContext webApplicationContext = ContextLoader.getCurrentWebApplicationContext();
        if (webApplicationContext == null) {
            rootPath = System.getProperty(WebUtils.DEFAULT_WEB_APP_ROOT_KEY);
        } else {
            ServletContext servletContext = webApplicationContext.getServletContext();
            rootPath = servletContext.getRealPath("/");
        }
    }
    return rootPath;
}