Package api

Examples of api.KeyValuePair


  }

  private PicasaTag getTag(URL url) throws IOException, ParserConfigurationException, SAXException{
    HttpRequest httpRequest = new HttpRequest(url);
    if (this.picasaAlbum.getPicasaWeb().getGoogleapi() != null){
      KeyValuePair pair = this.picasaAlbum.getPicasaWeb().getGoogleapi().toAuthHeader();
      httpRequest.addHeader(pair.key, pair.value);
    }
    String response = httpRequest.send();
    Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(new StringReader(response)));
    return new PicasaTag(this, document.getDocumentElement());
View Full Code Here


  public PicasaTag[] listTags() throws IOException, ParserConfigurationException, SAXException{
    String path = this.feedUrl.getQuery();
    path = this.feedUrl.toString() + ((path == null || path.length() == 0) ? "?" : "&") + "kind=tag";
    HttpRequest httpRequest = new HttpRequest(new URL(path));
    if (this.picasaAlbum.getPicasaWeb().getGoogleapi() != null){
      KeyValuePair pair = this.picasaAlbum.getPicasaWeb().getGoogleapi().toAuthHeader();
      httpRequest.addHeader(pair.key, pair.value);
    }
    String response = httpRequest.send();
    Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(new StringReader(response)));
    List<PicasaTag> picasaTags = new ArrayList<PicasaTag>();
View Full Code Here

   * @throws SAXException the response is not a parsable XML.
   */
  public PicasaTag addTag(String tag) throws IOException, ParserConfigurationException, SAXException{
    HttpRequest httpRequest = new HttpRequest(this.feedUrl);
    if (this.picasaAlbum.getPicasaWeb().getGoogleapi() != null){
      KeyValuePair pair = this.picasaAlbum.getPicasaWeb().getGoogleapi().toAuthHeader();
      httpRequest.addHeader(pair.key, pair.value);
    }
    String data = PicasaTag.createTagXML(tag);
    httpRequest.setData(data);
    httpRequest.setMethod(HttpRequest.METHOD_POST);
View Full Code Here

   *
   * @param key the key of KeyValuePair object.
   * @param value the value of KeyValuePair object.
   */
  public void add(String key, String value){
    this.pairs.add(new KeyValuePair(key, value));
  }
View Full Code Here

   */
  @Override
  public String toString(){
    StringBuilder sbr = new StringBuilder();
    for (int i = 0; i < this.pairs.size(); i++){
      KeyValuePair pair = this.pairs.get(i);
      if (i > 0){
        sbr.append("&");
      }
      try{
        sbr.append(URLEncoder.encode(pair.key, "UTF-8"));
View Full Code Here

   *
   * @param key the header of key.
   * @param value the header of value.
   */
  public void addHeader(String key, String value){
    this.headers.add(new KeyValuePair(key, value));
  }
View Full Code Here

    connection.setDoInput(true);
    connection.setDoOutput(true);
    connection.setRequestMethod(this.method);
    connection.addRequestProperty("Content-Type", this.contentType);
    for (int i = 0; i < this.headers.size(); i++){
      KeyValuePair header = this.headers.get(i);
      connection.addRequestProperty(header.key, header.value);
    }
    if (this.data != null && this.data.length() > 0){
      OutputStream os = connection.getOutputStream();
      os.write(this.data.getBytes());
View Full Code Here

  }

  public void delete() throws IOException{
    HttpRequest httpRequest = new HttpRequest(this.editUrl);
    if (this.picasaPhoto.getPicasaAlbum().getPicasaWeb().getGoogleapi() != null){
      KeyValuePair pair = this.picasaPhoto.getPicasaAlbum().getPicasaWeb().getGoogleapi().toAuthHeader();
      httpRequest.addHeader(pair.key, pair.value);
    }
    httpRequest.setMethod(HttpRequest.METHOD_DELETE);
    httpRequest.setContentType("application/atom+xml");
    String response = httpRequest.send();
View Full Code Here

   * of target url.
   */
  public void update(String title, String description, String access, Date lastModified, Boolean canComment, String position, String location, URL cover) throws IOException{
    HttpRequest httpRequest = new HttpRequest(this.editUrl);
    if (this.getPicasaWeb().getGoogleapi() != null){
      KeyValuePair pair = this.getPicasaWeb().getGoogleapi().toAuthHeader();
      httpRequest.addHeader(pair.key, pair.value);
    }
    if (title != null){
      this.title = title;
    }
View Full Code Here

   * of target url.
   */
  public void delete() throws IOException{
    HttpRequest httpRequest = new HttpRequest(this.editUrl);
    if (this.getPicasaWeb().getGoogleapi() != null){
      KeyValuePair pair = this.getPicasaWeb().getGoogleapi().toAuthHeader();
      httpRequest.addHeader(pair.key, pair.value);
    }
    httpRequest.setMethod(HttpRequest.METHOD_DELETE);
    httpRequest.setContentType("application/atom+xml");
    String response = httpRequest.send();
View Full Code Here

TOP

Related Classes of api.KeyValuePair

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.