Package api.http

Examples of api.http.HttpRequest.addHeader()


   */
  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;
    }
    if (description != null){
View Full Code Here


   */
  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();
    this.albumId = null;
View Full Code Here

  private PicasaPhoto getPhoto(URL url) throws IOException, ParserConfigurationException, SAXException{
    HttpRequest httpRequest = new HttpRequest(url);
    if (this.picasaWeb.getGoogleapi() != null){
      KeyValuePair pair = this.picasaWeb.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 PicasaPhoto(this, document.getDocumentElement());
  }
View Full Code Here

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

  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

    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>();
    NodeList entries = document.getElementsByTagName("entry");
View Full Code Here

   */
  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);
    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.comment = 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.