private Map<String,Object> buildEnvMap(final ParameterMap params) { final Map<String,Object> result = new HashMap<String,Object>(); for (Map.Entry<String,List<String>> entry : params.entrySet()) { final List<String> values = entry.getValue(); if (values != null && values.size() > 0) { result.put(entry.getKey(), values.get(0)); } } return result; }
private Map<String,Object> buildEnvMap(final ParameterMap params) { final Map<String,Object> result = new HashMap<String,Object>(); for (Map.Entry<String,List<String>> entry : params.entrySet()) { final List<String> values = entry.getValue(); if (values != null && values.size() > 0) { result.put(entry.getKey(), values.get(0)); } } return result; }
/** * Searches for the parameter with the specified key in this parameter map. * The method returns null if the parameter is not found. * * @param params the parameter map to search in * @param key the property key * @param ignoreCase true to search the key ignoring case, * false otherwise * @return the value in this parameter map with the specified key value */ // package-private, for testing static String getParameterValue(final ParameterMap params, String key, final boolean ignoreCase) { if (ignoreCase) { for (Map.Entry<String,List<String>> entry : params.entrySet()) { final String paramName = entry.getKey(); if (paramName.equalsIgnoreCase(key)) { key = paramName; break; } } } return params.getOne(key); }
/** * Searches for the parameter with the specified key in this parameter map. * The method returns null if the parameter is not found. * * @param params the parameter map to search in * @param key the property key * @param ignoreCase true to search the key ignoring case, * false otherwise * @return the value in this parameter map with the specified key value */ // package-private, for testing static String getParameterValue(final ParameterMap params, String key, final boolean ignoreCase) { if (ignoreCase) { for (Map.Entry<String,List<String>> entry : params.entrySet()) { final String paramName = entry.getKey(); if (paramName.equalsIgnoreCase(key)) { key = paramName; break; } } } return params.getOne(key); }
/** * Searches for the parameter with the specified key in this parameter map. * The method returns null if the parameter is not found. * * @param params the parameter map to search in * @param key the property key * @param ignoreCase true to search the key ignoring case, * false otherwise * @return the value in this parameter map with the specified key value */ // package-private, for testing static String getParameterValue(final ParameterMap params, String key, final boolean ignoreCase) { if (ignoreCase) { for (Map.Entry<String,List<String>> entry : params.entrySet()) { final String paramName = entry.getKey(); if (paramName.equalsIgnoreCase(key)) { key = paramName; break; } } } return params.getOne(key); }
@Override public void writeTo(Object entity, HttpURLConnection urlConnection) throws IOException { ParameterMap pm; if (entity instanceof ParameterMap) { pm = (ParameterMap) entity; } else if (entity instanceof ParamsWithPayload) { pm = ((ParamsWithPayload) entity).getParameters(); } else { pm = new ParameterMap(); } urlConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); final StringBuilder sb = new StringBuilder(); for (Map.Entry<String, List<String>> entry : pm.entrySet()) { for (String value : entry.getValue()) { if (sb.length() > 0) { sb.append('&'); } sb.append(URLEncoder.encode(entry.getKey(), "UTF-8")); if (value != null) { sb.append('='); sb.append(URLEncoder.encode(value, "UTF-8")); } } } urlConnection.getOutputStream().write(sb.toString().getBytes("UTF-8")); }
for (Map.Entry<String, List<String>> entry : parameters.entrySet()) { for (String v : entry.getValue()) aalogger.log(Level.FINER, "Key {0} = {1}", new Object[]{entry.getKey(), v});
for (Map.Entry<String, List<String>> entry : parameters.entrySet()) { String key = entry.getKey();
for (Map.Entry<String, List<String>> entry : parameters.entrySet()) { String key = entry.getKey();
for (Map.Entry<String, List<String>> entry : parameters.entrySet()) { for (String value : entry.getValue()) { writeParam(writer, os, boundary, entry.getKey(), value);
/** * Update the program options based on the specified * options from the command line. */ public void updateOptions(ParameterMap newOptions) throws CommandException { if (options == null) options = newOptions; else { // merge in the new options for (Map.Entry<String, List<String>> e : newOptions.entrySet()) options.set(e.getKey(), e.getValue()); } optionsSet = true; // have to verify port value now String sport = options.getOne(PORT); if (ok(sport)) { String badPortMsg = strings.get("InvalidPortNumber", sport); try { int port = Integer.parseInt(sport); if (port < 1 || port > 65535) throw new CommandException(badPortMsg); } catch (NumberFormatException e) { throw new CommandException(badPortMsg); } } }
/** * Update the program options based on the specified * options from the command line. */ public final void updateOptions(ParameterMap newOptions) throws CommandException { if (options == null) options = newOptions; else { // merge in the new options for (Map.Entry<String, List<String>> e : newOptions.entrySet()) options.set(e.getKey(), e.getValue()); } optionsSet = true; // have to verify port value now String sport = options.getOne(PORT); if (ok(sport)) { String badPortMsg = strings.get("InvalidPortNumber", sport); try { int port = Integer.parseInt(sport); if (port < 1 || port > 65535) throw new CommandException(badPortMsg); } catch (NumberFormatException e) { throw new CommandException(badPortMsg); } } }
StringBuilder sb = new StringBuilder(); sb.append("asadmin"); for (Map.Entry<String,List<String>> p : params.entrySet()) {
boolean sawPassword = false; for (Map.Entry<String, List<String>> param : options.entrySet()) { String paramName = param.getKey(); if (paramName.equals("DEFAULT")) // operands handled below for (Map.Entry<String, List<String>> e : options.entrySet()) { if (!e.getKey().equals("upload")) noptions.set(e.getKey(), e.getValue());
StringBuilder sb = new StringBuilder(); sb.append(programOpts.getCommandName()); for (Map.Entry<String,List<String>> p : params.entrySet()) {
for (Map.Entry<String, List<String>> o : opts.entrySet()) { String key = o.getKey(); List<String> value = o.getValue();
for(Map.Entry<String, List<String>> o : opts.entrySet()) { String key = o.getKey(); List<String> value = o.getValue();
for (Map.Entry<String, List<String>> o : opts.entrySet()) { String key = o.getKey(); List<String> value = o.getValue();