List of usage examples for javax.servlet.http HttpServletRequest getQueryString
public String getQueryString();
From source file:azkaban.webapp.servlet.ExternalAnalyzerUtils.java
private static String buildExternalAnalyzerURL(HttpServletRequest req, String url, String pattern) { StringBuilder builder = new StringBuilder(); builder.append(req.getRequestURL()); builder.append("?"); builder.append(req.getQueryString()); String flowExecutionURL = builder.toString(); String encodedFlowExecUrl = ""; try {//from w w w . j a v a 2 s .com encodedFlowExecUrl = URLEncoder.encode(flowExecutionURL, "UTF-8"); } catch (UnsupportedEncodingException e) { LOGGER.error("Specified encoding is not supported", e); } return url.replaceFirst(pattern, encodedFlowExecUrl); }
From source file:edu.cornell.mannlib.vitro.webapp.controller.VitroHttpServlet.java
private static String assembleUrlToReturnHere(HttpServletRequest request) { String queryString = request.getQueryString(); if ((queryString == null) || queryString.isEmpty()) { return request.getRequestURI(); } else {/*from ww w . j a va 2 s. com*/ return request.getRequestURI() + "?" + UrlBuilder.urlEncode(queryString); } }
From source file:info.magnolia.cms.util.RequestFormUtil.java
/** * The url is not always properly decoded. This method does the job. * @param request/*from w w w . j a va 2s . c o m*/ * @param charset * @return decoded map of all values */ public static Map getURLParametersDecoded(HttpServletRequest request, String charset) { Map map = new HashMap(); String queryString = request.getQueryString(); if (queryString != null) { String[] params = request.getQueryString().split("&"); for (int i = 0; i < params.length; i++) { String name = StringUtils.substringBefore(params[i], "="); String value = StringUtils.substringAfter(params[i], "="); try { value = URLDecoder.decode(value, charset); } catch (UnsupportedEncodingException e) { // nothing: return value as is } map.put(name, value); } } return map; }
From source file:com.charity.core.controller.Servlets.java
public static String reqUrl(HttpServletRequest request) { String url = request.getRequestURL().toString(); if (!Strings.isNullOrEmpty(request.getQueryString())) { url += "?" + request.getQueryString(); }// ww w. j a v a2 s . com return url; }
From source file:io.lavagna.web.security.PathConfiguration.java
private static String extractRequestedUrl(HttpServletRequest req) { String queryString = req.getQueryString(); return removeStart(req.getRequestURI(), req.getContextPath()) + (queryString != null ? ("?" + queryString) : ""); }
From source file:com.gtwm.pb.servlets.ServletUtilMethods.java
/** * Like HttpServlet#getRequestQuery(request) but works for POST as well as * GET: In the case of POST requests, constructs a query string from * parameter names & values/*from ww w . j a v a 2s .c o m*/ * * @see HttpServletRequest#getQueryString() */ public static String getRequestQuery(HttpServletRequest request) { String requestQuery = request.getQueryString(); if (requestQuery != null) { return "GET: " + requestQuery; } if (FileUpload.isMultipartContent(new ServletRequestContext(request))) { return "POST: file upload"; } requestQuery = "POST: "; Map<String, String[]> parameterMap = request.getParameterMap(); for (Map.Entry<String, String[]> parameterEntry : parameterMap.entrySet()) { requestQuery += "&" + parameterEntry.getKey() + "=" + parameterEntry.getValue()[0]; } return requestQuery; }
From source file:org.apache.atlas.web.util.Servlets.java
/** * Returns the URI of the given request. * * @param httpRequest an HTTP servlet request * @return the URI, including the query string *///from www .j a va 2s .c o m 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(); }
From source file:org.apache.atlas.web.util.Servlets.java
/** * Returns the full URL of the given request. * * @param httpRequest an HTTP servlet request * @return the full URL, including the query string *//*w w w .j av a 2 s .co m*/ public static String getRequestURL(HttpServletRequest httpRequest) { final StringBuilder url = new StringBuilder(100).append(httpRequest.getRequestURL()); if (httpRequest.getQueryString() != null) { url.append('?').append(httpRequest.getQueryString()); } return url.toString(); }
From source file:com.streamsets.pipeline.lib.http.HttpReceiverServlet.java
@VisibleForTesting protected static Map<String, String[]> getQueryParameters(HttpServletRequest request) { Map<String, String[]> queryParameters = new HashMap<>(); String queryString = request.getQueryString(); if (StringUtils.isEmpty(queryString)) { return queryParameters; }//from w w w . ja v a 2s .com String[] parameters = queryString.split("&"); for (String parameter : parameters) { String[] keyValuePair = parameter.split("="); String[] values = queryParameters.get(keyValuePair[0]); values = ArrayUtils.add(values, keyValuePair.length == 1 ? "" : keyValuePair[1]); //length is one if no value is available. queryParameters.put(keyValuePair[0], values); } return queryParameters; }
From source file:com.yiji.openapi.sdk.util.Servlets.java
public static String getRequestFullPath(HttpServletRequest request) { return getRequestPath(request) + "?" + request.getQueryString(); }