/** * Returns the first value of the query parameter given its name if * existing, or null. * * @param name * The query parameter name. * @return The first value of the query parameter. */ public static String getQueryValue(String name) { String result = null; Map<String, ArrayList<String>> query = getQuery(); if (query != null) { result = query.get(name).get(0); } return result; }
/** * Returns the first value of the query parameter given its name if * existing, or null. * * @param name * The query parameter name. * @return The first value of the query parameter. */ public String getQueryValue(String name) { String result = null; Form query = getQuery(); if (query != null) { result = query.getFirstValue(name); } return result; }
/** * Sets the query value for the named parameter. If no query is defined, it * creates one. If the same parameter exists, it replaces it altogether. * * @param name * The query parameter name. * @param value * The query parameter value. */ public void setQueryValue(String name, String value) { Form query = getQuery(); if (query == null) { query = new Form(); } query.set(name, value); try { getReference().setQuery(query.encode()); } catch (IOException e) { getLogger().fine("Unable to set the query value"); } }