public static String getRequestURI(HttpServletRequest httpRequest) {
        final StringBuilder url = new StringBuilder(100).append(httpRequest.getRequestURI());
        if (httpRequest.getQueryString() != null) {
            url.append('?').append(httpRequest.getQueryString());
        }

        return url.toString();
    }
public static String getRequestURI ( HttpServletRequest httpRequest ) { final StringBuilder url = new StringBuilder ( 100 ) . append ( httpRequest . getRequestURI ( ) ) ; if ( httpRequest . getQueryString ( ) != null ) { url . append ( '?' ) . append ( httpRequest . getQueryString ( ) ) ; } return url . toString ( ) ; }
Returns the URI of the given request.

@param httpRequest    an HTTP servlet request
@return the URI, including the query string