List of usage examples for java.util HashMap keySet
public Set<K> keySet()
From source file:biz.taoconsulting.dominodav.resource.DAVResourceMETA.java
/** * List all Repositories// w w w . j a v a2 s . c om */ private void fetchChildren() { DAVRepositoryMETA rep = (DAVRepositoryMETA) this.getOwner(); this.setMembers(new Vector<IDAVResource>()); HashMap<String, DAVRepositoryListing> allrep = rep.getRepositoryList(); String repHref = rep.getPublicHref(); for (String key : allrep.keySet()) { try { String curURI = repHref + key; if (!key.endsWith(DAVRepositoryMETA.INTERNAL_REPOSITORY_NAME)) { DAVAbstractResource res = rep.getResource(curURI, true); this.getMembers().add(res); } } catch (DAVNotFoundException exc) { LOGGER.error(exc); } } }
From source file:com.vina.hlexchang.ClientRequestHelper.java
public String sendPost(String url, HashMap<String, String> hmHeader, HashMap<String, String> hmData) { String response = ""; try {// w w w . j a v a 2 s .c o m HttpPost post = new HttpPost(url); Set<String> setKey = hmHeader.keySet(); //Add request Header for (String key : setKey) { String value = hmHeader.get(key); if (value != null) { post.addHeader(key, value); } } // List<NameValuePair> urlParameters = new ArrayList<NameValuePair>(); Set<String> setKeyData = hmData.keySet(); for (String key : setKeyData) { String value = hmData.get(key); if (value != null) { urlParameters.add(new BasicNameValuePair(key, value)); } } post.setEntity(new UrlEncodedFormEntity(urlParameters)); HttpResponse httpResponse = mClient.execute(post); BufferedReader rd = new BufferedReader(new InputStreamReader(httpResponse.getEntity().getContent())); System.out.println("Status Code:" + httpResponse.getStatusLine().getStatusCode()); StringBuffer result = new StringBuffer(); String line = ""; while ((line = rd.readLine()) != null) { result.append(line); } response = result.toString(); } catch (Exception ex) { Logger.getLogger(ClientRequestHelper.class.getName()).log(Level.SEVERE, null, ex); } return response; }
From source file:com.httpandjson_middle.SimpleMultipartEntity.java
public void setMultiFiles(HashMap<String, String> files) { Set<String> keySet = files.keySet(); for (String key : keySet) { String value = files.get(key); this.addPart(key, new File(value)); }// w w w.j av a2 s. c o m }
From source file:com.httpandjson_middle.SimpleMultipartEntity.java
public void setMultiValues(HashMap<String, String> values) { Set<String> keySet2 = values.keySet(); for (String key : keySet2) { String value = values.get(key); this.addPart(key, value); }//w ww. j a v a 2 s . com }
From source file:com.aspire.mandou.framework.http.HttpPut.java
HttpPut(AbstractHttpClient httpClient, String url, HttpEntity payload, HashMap<String, String> defaultHeaders) { super(httpClient); this.request = new org.apache.http.client.methods.HttpPut(url); ((HttpEntityEnclosingRequest) request).setEntity(payload); request.setHeader(HTTP_CONTENT_TYPE_HEADER, payload.getContentType().getValue()); for (String header : defaultHeaders.keySet()) { request.setHeader(header, defaultHeaders.get(header)); }/*from ww w .ja v a2s. c o m*/ }
From source file:com.github.ignition.support.http.HttpPut.java
HttpPut(IgnitedHttp ignitedHttp, String url, HttpEntity payload, HashMap<String, String> defaultHeaders) { super(ignitedHttp); this.request = new org.apache.http.client.methods.HttpPut(url); ((HttpEntityEnclosingRequest) request).setEntity(payload); request.setHeader(HTTP_CONTENT_TYPE_HEADER, payload.getContentType().getValue()); for (String header : defaultHeaders.keySet()) { request.setHeader(header, defaultHeaders.get(header)); }/*from w w w . j a v a 2 s . co m*/ }
From source file:com.github.ignition.support.http.HttpPost.java
HttpPost(IgnitedHttp ignitedHttp, String url, HttpEntity payload, HashMap<String, String> defaultHeaders) { super(ignitedHttp); this.request = new org.apache.http.client.methods.HttpPost(url); ((HttpEntityEnclosingRequest) request).setEntity(payload); request.setHeader(HTTP_CONTENT_TYPE_HEADER, payload.getContentType().getValue()); for (String header : defaultHeaders.keySet()) { request.setHeader(header, defaultHeaders.get(header)); }//w ww . jav a 2 s .c o m }
From source file:com.github.ignition.support.http.IgnitedHttpPut.java
IgnitedHttpPut(IgnitedHttpClient ignitedHttp, String url, HttpEntity payload, HashMap<String, String> defaultHeaders) { super(ignitedHttp); this.request = new org.apache.http.client.methods.HttpPut(url); ((HttpEntityEnclosingRequest) request).setEntity(payload); request.setHeader(HTTP_CONTENT_TYPE_HEADER, payload.getContentType().getValue()); for (String header : defaultHeaders.keySet()) { request.setHeader(header, defaultHeaders.get(header)); }/*from w ww. j av a2 s . c o m*/ }
From source file:com.dubture.symfony.core.builder.AbstractSymfonyVisitor.java
@SuppressWarnings({ "rawtypes" }) protected void indexServices(HashMap<String, Service> services) { indexer.enterServices(path.toString()); Iterator it = services.keySet().iterator(); JSONArray synths = getSynthetics();/*ww w .j a va 2 s .co m*/ while (it.hasNext()) { String id = (String) it.next(); Service service = services.get(id); if (service == null) { Logger.log(Logger.WARNING, "error parsing service " + id); continue; } if (service.phpClass != null && Service.SYNTHETIC.equals(service.phpClass)) { for (Object o : synths) { JSONObject _s = (JSONObject) o; if (_s.get(Service.NAME).equals(id)) { service.phpClass = (String) _s.get(Service.CLASS); break; } } } String _pub = service.isPublic() ? "true" : "false"; indexer.addService(id, service.phpClass, _pub, service.getTags(), path.toString(), timestamp); } indexer.exitServices(); }