Process a multi data set request into a descriptive title string.
@param request  the multi data set request
@return the title string
164963
public String processMultiDataSetRequest(final MultiDataSetRequest request) {
    StringBuilder sb = new StringBuilder();
    sb.append("Quandl codes ");
    final Iterator<QuandlCodeRequest> iter = request.getQuandlCodeRequests().iterator();
    while (iter.hasNext()) {
      QuandlCodeRequest req = iter.next();
      sb.append(req.getQuandlCode());
      if (req.isSingleColumnRequest()) {
        sb.append("[");
        sb.append(req.getColumnNumber());
        sb.append("]");
      }
      if (iter.hasNext()) {
        sb.append(",");
      }
    }
    if (request.getStartDate() != null) {
      sb.append(" from ");
      sb.append(request.getStartDate());
    }
    if (request.getEndDate() != null) {
      sb.append(" until ");
      sb.append(request.getEndDate());
    }
    if (request.getFrequency() != null) {
      sb.append(" sampled ");
      sb.append(request.getFrequency());
    }
    if (request.getSortOrder() != null) {
      sb.append(" sorted into ");
      sb.append(request.getSortOrder());
      sb.append(" order");
    }
    if (request.getTransform() != null) {
      sb.append(" transformed by ");
      sb.append(request.getTransform());
    }
    if (request.getMaxRows() != null) {
      sb.append(" with at most ");
      sb.append(request.getMaxRows());
      sb.append(" rows");
    }
    return sb.toString();
  }
236065
public static String repositoryUrl(Request request) {
        String requestURL = request.uri();
        int delimiterSegmentIdx = requestURL.length();
        for (String methodName : ALL_METHODS) {
            if (requestURL.indexOf(methodName) != -1) {
                delimiterSegmentIdx = requestURL.indexOf(methodName);
                break;
            }
        }
        return requestURL.substring(0, delimiterSegmentIdx);
    }
872995
protected String determineEncoding(ResourceRequest request) {
        String encoding = request.getCharacterEncoding();
        if (encoding == null) {
            encoding = getDefaultEncoding();
        }
        return encoding;
    }
801806
@Override
	protected void preparePaintComponent(final Request request) {
		super.preparePaintComponent(request);

		if (content != null) {
			switch (getMode()) {
				case EAGER: {
					// Always visible
					content.setVisible(true);
					AjaxHelper.registerContainer(getId(), getId() + "-content", content.getId());
					break;
				}
				case LAZY:
					content.setVisible(!isCollapsed());

					if (isCollapsed()) {
						AjaxHelper.registerContainer(getId(), getId() + "-content", content.getId());
					}

					break;

				case DYNAMIC: {
					content.setVisible(!isCollapsed());
					AjaxHelper.registerContainer(getId(), getId() + "-content", content.getId());
					break;
				}
				case SERVER: {
					content.setVisible(!isCollapsed());
					break;
				}
				case CLIENT: {
					// Will always be visible
					content.setVisible(true);
					break;
				}
				default: {
					throw new SystemException("Unknown mode: " + getMode());
				}
			}
		}
	}
160874
public static String getParameter(ServletRequest request, String name) {
    String s = request.getParameter(name);
    if (s == null) {
      return null;
    }
    s = s.trim();
    return s.length() == 0? null: s;
  }
573110
public byte[] getObjectContent(GetObjectRequest request) {
        BosObjectInputStream content = this.getObject(request).getObjectContent();
        try {
            return IOUtils.toByteArray(content);
        } catch (IOException e) {
            try {
                content.close();
            } catch (IOException e1) {
                // ignore, throw e not e1.
            }
            throw new BceClientException("Fail read object content", e);
        } finally {
            try {
                content.close();
            } catch (IOException e) {
                // ignore
            }
        }
    }
973204
public static Map<String, Object> getParametersMap(ContainerRequestContext requestContext,HttpServletRequest request)
			throws IOException {
		
		if(isMultipartContent(request)){
			return buildQueryParamsMap(request);
		}
		
		Map<String, Object> parameters = buildQueryParamsMap(request);
		
		if (RestConst.GET_METHOD.equals(request.getMethod())) {
			return parameters;
		}else if (RestConst.POST_METHOD.equals(request.getMethod())) {
			
			byte[] byteArray = IOUtils.toByteArray(requestContext.getEntityStream());
			//reset InputStream
			requestContext.setEntityStream(new ByteArrayInputStream(byteArray));
			
			if(byteArray == null || byteArray.length == 0)return parameters;
			String content = new String(byteArray);
			//JSON 
//			try {
//				return JsonUtils.toObject(content, Map.class);
//			} catch (Exception e) {}
			if(content.contains("{")){
				content = StringUtils.left(content, 2048).trim();
				if(!content.endsWith("}"))content = content + "...\n}";
				parameters.put("data", content);
				return parameters;
			}
			
			String[] split = content.split("\\&");
			for (String s : split) {
				String[] split2 = s.split("=");
				if (split2.length == 2 && StringUtils.isNotBlank(split2[1])) {
					parameters.put(split2[0], split2[1]);
				}
			}
			return parameters;
		
		}
		return null;
	}
723013
public static Map<String, List<StringValue>> getPageParametersMap(final Request request)
	{
		final Map<String, List<StringValue>> map = new HashMap<>();
		addToParameters(request.getRequestParameters(), map);
		addToParameters(request.getQueryParameters(), map);
		addToParameters(request.getPostParameters(), map);
		return map;
	}
695234
public static String getRequestBody(HttpServletRequest request) {
		if(request.getMethod().equals("GET") || request.getMethod().equals("DELETE")) {
			return null;
		}
		
		StringBuilder stringBuilder = new StringBuilder();
		BufferedReader bufferedReader = null;
		try {
			InputStream inputStream = request.getInputStream();
			if (inputStream != null) {
				bufferedReader = new BufferedReader(new InputStreamReader(
						inputStream));
				char[] charBuffer = new char[128];
				int bytesRead = -1;
				while ((bytesRead = bufferedReader.read(charBuffer)) > 0) {
					stringBuilder.append(charBuffer, 0, bytesRead);
				}
			} else {
				stringBuilder.append("");
			}
		} catch (IOException ex) {
			// to nothing
		} finally {
			if (bufferedReader != null) {
				try {
					bufferedReader.close();
				} catch (IOException ex) {

				}
			}
		}

		if (!StringUtils.isEmpty(stringBuilder)) {
			return stringBuilder.toString();
		}

		if (request.getParameterMap().keySet().size() > 0) {
			return request.getParameterMap().keySet().toArray()[0].toString();
		}

        return null;
	}
417368
private void handleSortRequest(final Request request) {
		String sortColStr = request.getParameter(getId() + ".sort");
		String sortDescStr = request.getParameter(getId() + ".sortDesc");

		if (sortColStr != null) {
			if ("".equals(sortColStr)) {
				// Reset sort
				setSort(-1, false);
				getOrCreateComponentModel().rowIndexMapping = null;
			} else {
				try {
					int sortCol = Integer.parseInt(sortColStr);
					// Allow for column order
					int[] cols = getColumnOrder();
					if (cols != null) {
						sortCol = cols[sortCol];
					}
					boolean sortAsc = !"true".equalsIgnoreCase(sortDescStr);

					// Only process the sort request if it differs from the current sort order
					if (sortCol != getSortColumnIndex() || sortAsc != isSortAscending()) {
						sort(sortCol, sortAsc);
						setFocussed();
					}
				} catch (NumberFormatException e) {
					LOG.warn("Invalid sort column: " + sortColStr);
				}
			}
		}
	}
35149
@Override
	protected void preparePaintComponent(final Request request) {
		super.preparePaintComponent(request);

		if (!this.isInitialised()) {
			List recent = loadRecentList();

			if (recent != null && !recent.isEmpty()) {
				String selection = (String) recent.get(0);
				displaySelection(selection);
			}

			this.setInitialised(true);
		}

		updateTitle();
	}
696352
public static Map<String, String> getParamMap(ServletRequest request) {
		Map<String, String> params = new HashMap<String, String>();
		for (Map.Entry<String, String[]> entry : getParams(request).entrySet()) {
			params.put(entry.getKey(), ArrayUtil.join(entry.getValue(), StrUtil.COMMA));
		}
		return params;
	}
1298078
private String parseLayerId(HttpServletRequest request) {
		StringTokenizer tokenizer = new StringTokenizer(request.getRequestURI(), "/");
		String token = "";
		while (tokenizer.hasMoreTokens()) {
			token = tokenizer.nextToken();
		}
		return token;
	}
1189457
protected String resolveSpanName(HttpRequest<?> request) {
        Optional<String> route = request.getAttribute(HttpAttributes.URI_TEMPLATE, String.class);
        return route.map(s -> request.getMethod() + " " + s).orElse(request.getMethod() + " " + request.getPath());
    }
1161608
@RequestMapping(
            path = "/api",
            method = RequestMethod.GET,
            produces = {"application/hal+json", "application/json"}
    )
    public HalRepresentation getHomeDocument(final HttpServletRequest request) {
        final String homeUrl = request.getRequestURL().toString();
        return new HalRepresentation(
                linkingTo()
                        .self(homeUrl)
                        .single(linkBuilder("search", "/api/products{?q,embedded}")
                                .withTitle("Search Products")
                                .withType("application/hal+json")
                                .build())
                        .build()
        );
    }
1057735
@Override
	protected void preparePaintComponent(final Request request) {
		super.preparePaintComponent(request);

		String targetId = getContent().getId();
		String contentId = getId() + "-content";

		switch (getComponentModel().mode) {
			case LAZY: {
				getContent().setVisible(isOpen());
				AjaxHelper.registerContainer(getId(), contentId, targetId);
				break;
			}
			case DYNAMIC: {
				AjaxHelper.registerContainer(getId(), contentId, targetId);
				getContent().setVisible(isOpen());
				break;
			}
			case EAGER: {
				AjaxHelper.registerContainer(getId(), contentId, targetId);
				// Will always be visible
				break;
			}
			case SERVER: {
				// same as DYNAMIC
				AjaxHelper.registerContainer(getId(), contentId, targetId);
				getContent().setVisible(isOpen());
				break;
			}
			case CLIENT: {
				// Will always be visible
				break;
			}

			default:
				// do nothing.
				break;
		}
	}
103766
public static String getParameter(final HttpServletRequest request, final String name) {
		String value = request.getParameter(name);
		if (value == null) {
			return "";
		}
		return value;
	}