spark.Request.queryMap()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(185)

本文整理了Java中spark.Request.queryMap方法的一些代码示例,展示了Request.queryMap的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.queryMap方法的具体详情如下:
包路径:spark.Request
类名称:Request
方法名:queryMap

Request.queryMap介绍

暂无

代码示例

代码示例来源:origin: perwendel/spark

@Override
public QueryParamsMap queryMap() {
  return delegate.queryMap();
}

代码示例来源:origin: perwendel/spark

@Override
public QueryParamsMap queryMap(String key) {
  return delegate.queryMap(key);
}

代码示例来源:origin: perwendel/spark

/**
 * @param key the key
 * @return the query map
 */
public QueryParamsMap queryMap(String key) {
  return queryMap().get(key);
}

代码示例来源:origin: gocd/gocd

/**
   * Gets query parameters from request, ignoring duplicates. This
   * is different from Spark's queryMap().toMap()
   *
   * @param request the spark request
   * @return the params as a {@link Map<String, String>}
   */
  private Map<String, String> getQueryParams(Request request) {
    final Map<String, String> queryParams = new HashMap<>();
    request.queryMap().toMap().forEach((k, v) -> {
      queryParams.put(k, v[0]);
    });
    return queryParams;
  }
}

代码示例来源:origin: cinchapi/concourse

@Override
public QueryParamsMap queryMap() {
  return delegate.queryMap();
}

代码示例来源:origin: komoot/photon

QueryParamsMap tagFiltersQueryMap = webRequest.queryMap("osm_tag");
if (!new CheckIfFilteredRequest().execute(tagFiltersQueryMap)) {
  return (R) new PhotonRequest(query, limit, locationForBias, scale, language);

代码示例来源:origin: cinchapi/concourse

@Override
public QueryParamsMap queryMap(String key) {
  return delegate.queryMap(key);
}

代码示例来源:origin: com.sparkjava/spark-core

@Override
public QueryParamsMap queryMap() {
  return delegate.queryMap();
}

代码示例来源:origin: com.sparkjava/spark-core

@Override
public QueryParamsMap queryMap(String key) {
  return delegate.queryMap(key);
}

代码示例来源:origin: com.sparkjava/spark-core

/**
 * @param key the key
 * @return the query map
 */
public QueryParamsMap queryMap(String key) {
  return queryMap().get(key);
}

代码示例来源:origin: cinchapi/concourse

public QueryParamsMap queryMap(String key) {
  return queryMap().get(key);
}

代码示例来源:origin: ikidou/Retrofit2Demo

private void addQueryParams(Request request, Map<String, Object> result) {
  Map<String, String[]> queryParamsMap = request.queryMap().toMap();
  Set<Map.Entry<String, String[]>> entries = queryParamsMap.entrySet();
  for (Map.Entry<String, String[]> entry : entries) {
    String[] values = entry.getValue();
    if (values == null) {
      continue;
    }
    if (values.length == 1) {
      result.put(entry.getKey(), values[0]);
    } else {
      result.put(entry.getKey(), values);
    }
  }
}

代码示例来源:origin: cinchapi/concourse

/**
 * Return the list of values mapped from a parameter associated with the
 * request being processed. This method is only appropriate for query
 * params and will not work for route variables (because those cannot
 * contain multiple values).
 * <p>
 * <strong>NOTE:</strong> If there are no values for {@code param}, then an
 * empty list is returned.
 * </p>
 * 
 * @param param
 * @return the (possibly empty) list of values
 */
public final List<String> getParamValues(String param) {
  try {
    List<String> list = Lists.newArrayList(queryMap(param).values());
    list.removeAll(EMPTY_STRING_COLLECTION);
    if(list.size() == 1) {
      String elt = list.get(0);
      elt.replaceAll(", ", ",");
      String[] elts = elt.split(",");
      list = Lists.newArrayList(elts);
    }
    return list;
  }
  catch (NullPointerException e) { // the param is not in the map, so
                   // return an empty array
    return Lists.newArrayListWithCapacity(0);
  }
}

代码示例来源:origin: cuba-platform/yarg

protected Map<String, Object> parseParameters(Request req, Report report) {
  QueryParamsMap queryParams = req.queryMap("params");
  Map<String, Object> params = new HashMap<>();
  for (ReportParameter reportParameter : report.getReportParameters()) {
    java.lang.String paramValueStr = queryParams.value(reportParameter.getAlias());
    if (paramValueStr != null) {
      params.put(reportParameter.getAlias(),
          converter.convertFromString(reportParameter.getParameterClass(), paramValueStr));
    }
  }
  return params;
}

代码示例来源:origin: lamarios/Homedash2

Map<String, String[]> params = req.queryMap().toMap();
params.put("class", new String[]{plugin.getClass().getCanonicalName()});
saveModuleWithSettings(params, page);

代码示例来源:origin: org.opentcs/opentcs-kernel-extension-http-services

private Object handleGetTransportOrders(Request request, Response response) {
 response.type(HttpConstants.CONTENT_TYPE_APPLICATION_JSON_UTF8);
 return toJson(
   statusInformationProvider.getTransportOrdersState(
     valueIfKeyPresent(request.queryMap(), "intendedVehicle")
   )
 );
}

代码示例来源:origin: org.opentcs/opentcs-kernel-extension-http-services

private Object handleGetVehicles(Request request, Response response)
  throws IllegalArgumentException {
 response.type(HttpConstants.CONTENT_TYPE_APPLICATION_JSON_UTF8);
 return toJson(
   statusInformationProvider.getVehiclesState(valueIfKeyPresent(request.queryMap(),
                                  "procState"))
 );
}

代码示例来源:origin: org.opentcs/opentcs-kernel-extension-http-services

private Object handlePutVehicleIntegrationLevel(Request request, Response response)
  throws ObjectUnknownException, IllegalArgumentException {
 statusInformationProvider.putVehicleIntegrationLevel(
   request.params(":NAME"),
   valueIfKeyPresent(request.queryMap(), "newValue")
 );
 response.type(HttpConstants.CONTENT_TYPE_TEXT_PLAIN_UTF8);
 return "";
}

代码示例来源:origin: lamarios/Homedash2

/**
 * Renames a page
 *
 * @param req a Spark Request {@link Request}
 * @param res a Spark Response {@link Response}
 * @return
 * @throws SQLException
 */
private List<Page> renamePage(Request req, Response res) throws SQLException {
  int id = Integer.parseInt(req.params("id"));
  String pageName = req.queryMap("name").value();
  Page page = get(id);
  if (page != null) {
    page.setName(pageName);
    update(page);
    return getAll();
  } else {
    res.status(503);
  }
  return Collections.emptyList();
}

代码示例来源:origin: lamarios/Homedash2

/**
 * Add a new page.
 *
 * @param req a Spark Request {@link Request}
 * @param res a Spark Response {@link Response}
 * @return
 * @throws SQLException
 */
private List<Page> addPage(Request req, Response res) throws SQLException {
  String pageName = req.queryMap("name").value();
  Page page = new Page();
  page.setName(pageName);
  create(page);
  return getAll();
}

相关文章