Example usage for org.springframework.web.util UrlPathHelper getOriginatingContextPath

List of usage examples for org.springframework.web.util UrlPathHelper getOriginatingContextPath

Introduction

In this page you can find the example usage for org.springframework.web.util UrlPathHelper getOriginatingContextPath.

Prototype

public String getOriginatingContextPath(HttpServletRequest request) 

Source Link

Document

Return the context path for the given request, detecting an include request URL if called within a RequestDispatcher include.

Usage

From source file:com.pcms.core.util.UrlUtil.java

public static String getURI(HttpServletRequest request) {
    UrlPathHelper helper = new UrlPathHelper();
    String uri = helper.getOriginatingRequestUri(request);
    String ctx = helper.getOriginatingContextPath(request);
    if (!StringUtils.isBlank(ctx)) {
        return uri.substring(ctx.length());
    } else {/*from   w ww . j  ava2 s . c  o  m*/
        return uri;
    }
}