Example usage for javax.servlet.http HttpServletRequest getQueryString

List of usage examples for javax.servlet.http HttpServletRequest getQueryString

Introduction

In this page you can find the example usage for javax.servlet.http HttpServletRequest getQueryString.

Prototype

public String getQueryString();

Source Link

Document

Returns the query string that is contained in the request URL after the path.

Usage

From source file:net.jadler.stubbing.server.jetty.RequestUtils.java

private static String getQueryString(HttpServletRequest source) {
    return isNotBlank(source.getQueryString()) ? ("?" + source.getQueryString()) : "";
}

From source file:nu.yona.server.rest.GlobalExceptionMapping.java

public static String buildRequestInfo(HttpServletRequest request) {
    String queryString = request.getQueryString();
    String url = StringUtils.isBlank(queryString) ? request.getRequestURI()
            : request.getRequestURI() + "?" + queryString;
    return MessageFormat.format("{0} on URL {1}", request.getMethod(), url);
}

From source file:com.comcast.cdn.traffic_control.traffic_router.api.util.APIAccessRecord.java

private static String getUrl(final HttpServletRequest request) {
    final StringBuffer buf = request.getRequestURL();
    if (request.getQueryString() != null) {
        buf.append('?');
        buf.append(request.getQueryString());
    }//  w  ww  .j  av  a  2s.  com
    return buf.toString();
}

From source file:com.netflix.spinnaker.gate.interceptors.RequestLoggingInterceptor.java

private static String getRequestEndpoint(HttpServletRequest request) {
    String endpoint = request.getRequestURI();
    if (request.getQueryString() != null) {
        return endpoint + "?" + request.getQueryString();
    }//www.j  ava  2 s . c  om
    return endpoint;
}

From source file:org.apache.hadoop.security.token.delegation.web.ServletUtils.java

/**
 * Extract a query string parameter without triggering http parameters
 * processing by the servlet container.//from www .  ja  v a 2  s  .c o m
 *
 * @param request the request
 * @param name the parameter to get the value.
 * @return the parameter value, or <code>NULL</code> if the parameter is not
 * defined.
 * @throws IOException thrown if there was an error parsing the query string.
 */
public static String getParameter(HttpServletRequest request, String name) throws IOException {
    List<NameValuePair> list = URLEncodedUtils.parse(request.getQueryString(), UTF8_CHARSET);
    if (list != null) {
        for (NameValuePair nv : list) {
            if (name.equals(nv.getName())) {
                return nv.getValue();
            }
        }
    }
    return null;
}

From source file:org.apache.hadoop.security.AuthenticationWithProxyUserFilter.java

/**
 * Get proxy user from query string.//from  w ww .ja  v  a  2  s . c o  m
 * @param request the request object
 * @return proxy user
 */
public static String getDoAs(HttpServletRequest request) {
    String queryString = request.getQueryString();
    if (queryString == null) {
        return null;
    }
    List<NameValuePair> list = URLEncodedUtils.parse(queryString, UTF8_CHARSET);
    if (list != null) {
        for (NameValuePair nv : list) {
            if (DO_AS.equalsIgnoreCase(nv.getName())) {
                return nv.getValue();
            }
        }
    }
    return null;
}

From source file:com.liferay.util.Xss.java

/**
 * Checks into the request query string for possible XSS hacks and return true if any possible XSS fragment is found
 *
 * @param request// w ww.j a va2 s. co  m
 * @return true if any possible XSS fragment is found
 */
@SuppressWarnings("unchecked")
public static boolean ParamsHaveXSS(HttpServletRequest request) {
    return ParamsHaveXSS(request.getQueryString());
}

From source file:com.google.step2.Step2.java

/**
 * Returns the URL of an incoming HTTP request, including query parameters.
 * @param req the incoming HTTP request//  w ww .  j  a va 2s.co  m
 * @return the URL that is represented by this HTTP request
 */
public static String getUrlWithQueryString(HttpServletRequest req) {
    StringBuffer receivingUrl = req.getRequestURL();
    String queryString = req.getQueryString();
    if (queryString != null && queryString.length() > 0) {
        receivingUrl.append("?").append(req.getQueryString());
    }
    log.info(receivingUrl.toString());
    return receivingUrl.toString();
}

From source file:org.carewebframework.ui.spring.AppContextFinder.java

/**
 * Creates an application context as a child of the root application context and associates it
 * with the specified desktop. In this way, any objects managed by the root application context
 * are available to the framework context.
 * //  w w  w .j av  a 2  s .co m
 * @param desktop Desktop for which application context is being created.
 * @return New application context
 */
public static ApplicationContext createAppContext(final Desktop desktop) {
    final HttpServletRequest httpRequest = FrameworkWebSupport.getHttpServletRequest();
    final String qs = httpRequest.getQueryString();
    final FrameworkAppContext appContext = new FrameworkAppContext(desktop);
    appContext.refresh();
    FrameworkWebSupport.setRequestParams(qs);
    FrameworkWebSupport.setRequestUrl(desktop.getRequestPath());
    return appContext;
}

From source file:com.app.framework.web.mvc.ActionMap.java

public static String getFullURL(HttpServletRequest request) {
    StringBuffer requestURL = request.getRequestURL();
    String queryString = request.getQueryString();

    if (queryString == null) {
        return requestURL.toString();
    } else {/*from   www.j  av a  2s  .  c o m*/
        return requestURL.append('?').append(queryString).toString();
    }
}