@Override public QueryParamsMap queryMap() { return delegate.queryMap(); }
@Override public QueryParamsMap queryMap(String key) { return delegate.queryMap(key); }
/** * @param key the key * @return the query map */ public QueryParamsMap queryMap(String key) { return queryMap().get(key); }
/** * 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; } }
@Override public QueryParamsMap queryMap() { return delegate.queryMap(); }
QueryParamsMap tagFiltersQueryMap = webRequest.queryMap("osm_tag"); if (!new CheckIfFilteredRequest().execute(tagFiltersQueryMap)) { return (R) new PhotonRequest(query, limit, locationForBias, scale, language);
@Override public QueryParamsMap queryMap(String key) { return delegate.queryMap(key); }
@Override public QueryParamsMap queryMap() { return delegate.queryMap(); }
@Override public QueryParamsMap queryMap(String key) { return delegate.queryMap(key); }
/** * @param key the key * @return the query map */ public QueryParamsMap queryMap(String key) { return queryMap().get(key); }
public QueryParamsMap queryMap(String key) { return queryMap().get(key); }
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); } } }
/** * 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); } }
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; }
Map<String, String[]> params = req.queryMap().toMap(); params.put("class", new String[]{plugin.getClass().getCanonicalName()}); saveModuleWithSettings(params, page);
private Object handleGetTransportOrders(Request request, Response response) { response.type(HttpConstants.CONTENT_TYPE_APPLICATION_JSON_UTF8); return toJson( statusInformationProvider.getTransportOrdersState( valueIfKeyPresent(request.queryMap(), "intendedVehicle") ) ); }
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")) ); }
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 ""; }
/** * 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(); }
/** * 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(); }