Package api.http

Examples of api.http.HttpRequest.addHeader()


    this.googleapi = googleapi;
    URL url = new URL("https://picasaweb.google.com/data/feed/api/user/" + user);
    HttpRequest httpRequest = new HttpRequest(url);
    if (googleapi != null){
      KeyValuePair pair = googleapi.toAuthHeader();
      httpRequest.addHeader(pair.key, pair.value);
    }
    String response = httpRequest.send();
    Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(new StringReader(response)));
    this.initial(document.getDocumentElement());
  }
View Full Code Here


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

   */
  public PicasaAlbum[] listAlbums() throws IOException, ParserConfigurationException, SAXException{
    HttpRequest httpRequest = new HttpRequest(this.feedUrl);
    if (this.googleapi != null){
      KeyValuePair pair = this.googleapi.toAuthHeader();
      httpRequest.addHeader(pair.key, pair.value);
    }
    String response = httpRequest.send();
    Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(new StringReader(response)));
    List<PicasaAlbum> picasaAlbums = new ArrayList<PicasaAlbum>();
    NodeList entries = document.getElementsByTagName("entry");
View Full Code Here

   */
  public PicasaAlbum createAlbum(String title, String description, String access, Date lastModified, Boolean canComment, String position, String location, URL cover) throws IOException, ParserConfigurationException, SAXException{
    HttpRequest httpRequest = new HttpRequest(this.feedUrl);
    if (this.googleapi != null){
      KeyValuePair pair = this.googleapi.toAuthHeader();
      httpRequest.addHeader(pair.key, pair.value);
    }
    String data = PicasaAlbum.createAlbumXML(title, description, access, lastModified, canComment, position, location, cover, null);
    httpRequest.setData(data);
    httpRequest.setMethod("POST");
    httpRequest.setContentType("application/atom+xml");
View Full Code Here

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

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

  private PicasaComment getComment(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 PicasaComment(this, document.getDocumentElement());
  }
View Full Code Here

   */
  public PicasaComment[] listComments() 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 response = httpRequest.send();
    Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(new StringReader(response)));
    List<PicasaComment> picasaComments = new ArrayList<PicasaComment>();
    NodeList entries = document.getElementsByTagName("entry");
View Full Code Here

   */
  public PicasaComment addComment(String comment) 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 = PicasaComment.createCommentXML(comment);
    httpRequest.setData(data);
    httpRequest.setMethod(HttpRequest.METHOD_POST);
    httpRequest.setContentType("application/atom+xml");
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();
    this.tag = null;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.