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

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

Introduction

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

Prototype

public String getOriginatingRequestUri(HttpServletRequest request) 

Source Link

Document

Return the request URI for the given request.

Usage

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

/**
 * ?//from www.  j  a v a2 s.c om
 *
 * @param request
 * @return
 */
public static PageInfo getPageInfo(HttpServletRequest request) {
    UrlPathHelper helper = new UrlPathHelper();
    String uri = helper.getOriginatingRequestUri(request);
    String queryString = helper.getOriginatingQueryString(request);
    return getPageInfo(uri, queryString);
}

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 {// w  w  w .  ja  va2  s  . co  m
        return uri;
    }
}

From source file:com.ai.smart.common.helper.util.RequestUtils.java

/**
 * /* ww w  . j a v  a2  s  . co  m*/
 * <p>
 * HttpServletRequest.getRequestURL+"?"+HttpServletRequest.getQueryString
 *
 * @param request
 * @return
 */
public static String getLocation(HttpServletRequest request) {
    UrlPathHelper helper = new UrlPathHelper();
    StringBuffer buff = request.getRequestURL();
    String uri = request.getRequestURI();
    String origUri = helper.getOriginatingRequestUri(request);
    buff.replace(buff.length() - uri.length(), buff.length(), origUri);
    String queryString = helper.getOriginatingQueryString(request);
    if (queryString != null) {
        buff.append("?").append(queryString);
    }
    return buff.toString();
}

From source file:org.zkoss.zkgrails.ZKGrailsPageFilter.java

/**
 * Continue in filter-chain, writing all content to buffer and parsing
 * into returned {@link com.opensymphony.module.sitemesh.Page} object. If
 * {@link com.opensymphony.module.sitemesh.Page} is not parseable, null is returned.
 *///from   w  w  w  .  j av  a  2 s  .  c om
protected Page parsePage(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
        throws IOException, ServletException {
    try {
        PageResponseWrapper pageResponse = new PageResponseWrapper(response, factory);
        UrlPathHelper urlHelper = new UrlPathHelper();
        String requestURI = urlHelper.getOriginatingRequestUri(request);
        // static content?
        if (requestURI.endsWith(HTML_EXT)) {
            String encoding = (String) ConfigurationHolder.getFlatConfig().get(CONFIG_OPTION_GSP_ENCODING);
            if (encoding == null)
                encoding = UTF_8_ENCODING;
            pageResponse.setContentType("text/html;charset=" + encoding);
        }

        chain.doFilter(request, pageResponse);
        // check if another servlet or filter put a page object to the request
        Page result = (Page) request.getAttribute(PAGE);
        if (result == null) {
            // parse the page
            result = pageResponse.getPage();
        }
        request.setAttribute(USING_STREAM, pageResponse.isUsingStream() ? Boolean.TRUE : Boolean.FALSE); // JDK 1.3 friendly
        return result;
    } catch (IllegalStateException e) {
        // weblogic throws an IllegalStateException when an error page is served.
        // it's ok to ignore this, however for all other containers it should be thrown
        // properly.
        if (Container.get() != Container.WEBLOGIC)
            throw e;
        return null;
    }
}

From source file:net.hedtech.banner.filters.ZKPageFilter2.java

private void setDefaultConfiguredEncoding(HttpServletRequest request,
        GrailsContentBufferingResponse contentBufferingResponse) {
    UrlPathHelper urlHelper = new UrlPathHelper();
    String requestURI = urlHelper.getOriginatingRequestUri(request);
    // static content?
    if (requestURI.endsWith(HTML_EXT)) {
        contentBufferingResponse.setContentType("text/html;charset=" + defaultEncoding);
    }/*from ww  w. ja  va2 s  . com*/
}

From source file:org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter.java

private void setDefaultConfiguredEncoding(HttpServletRequest request,
        GrailsContentBufferingResponse contentBufferingResponse) {
    UrlPathHelper urlHelper = new UrlPathHelper();
    String requestURI = urlHelper.getOriginatingRequestUri(request);
    // static content?
    if (requestURI.endsWith(HTML_EXT)) {
        String encoding = (String) ConfigurationHolder.getFlatConfig().get(CONFIG_OPTION_GSP_ENCODING);
        if (encoding == null)
            encoding = UTF_8_ENCODING;//from ww  w  .  ja  va  2s  .c  o m
        contentBufferingResponse.setContentType("text/html;charset=" + encoding);
    }

}