Example usage for org.springframework.web.servlet.support RequestContext getRequestUri

List of usage examples for org.springframework.web.servlet.support RequestContext getRequestUri

Introduction

In this page you can find the example usage for org.springframework.web.servlet.support RequestContext getRequestUri.

Prototype

public String getRequestUri() 

Source Link

Document

Return the request URI of the original request, that is, the invoked URL without parameters.

Usage

From source file:org.parancoe.web.tag.MarkPositionTag.java

@Override
protected final int doStartTagInternal() throws JspException, IOException {
    final HttpSession session = pageContext.getSession();
    ServletRequest request = pageContext.getRequest();
    final RequestContext requestContext = this.getRequestContext();
    final String uri = requestContext.getRequestUri();
    String contextPath = requestContext.getContextPath();
    final String queryString = requestContext.getQueryString();
    String url = "";
    if (uri.startsWith(contextPath)) {
        url = uri.substring(contextPath.length());
    } else {//from w  w w.j a  va 2 s  . c om
        url = uri;
    }
    if (!StringUtils.isBlank(queryString)) {
        url = url + "?" + queryString;
    }
    if (useFullUri) {
        String port = "";
        if (request.getServerPort() != 80) {
            port = ":" + request.getServerPort();
        }
        url = request.getScheme() + "://" + request.getServerName() + port + requestContext.getContextPath()
                + url;
    }
    MarkPositionHelper.markPosition(session, pathId, url);
    return SKIP_BODY;
}