Example usage for com.liferay.portal.kernel.servlet ServletContextUtil getResourcePath

List of usage examples for com.liferay.portal.kernel.servlet ServletContextUtil getResourcePath

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.servlet ServletContextUtil getResourcePath.

Prototype

public static String getResourcePath(URL url) throws URISyntaxException 

Source Link

Usage

From source file:com.liferay.rtl.servlet.filters.ComboServletFilter.java

License:Open Source License

protected URL getResourceURL(ServletContext servletContext, String rootPath, String path) throws Exception {

    URL url = servletContext.getResource(path);

    if (url == null) {
        return null;
    }/*w w  w  .j av a 2s  .com*/

    String filePath = ServletContextUtil.getResourcePath(url);

    int pos = filePath.indexOf(rootPath.concat(StringPool.SLASH).concat(_JAVASCRIPT_DIR));

    if (pos == 0) {
        return url;
    }

    return null;
}