Home
JavaEE
Java GUI
Framework
DHtml
Android
插画
教程下载

ATOM 2.0   RSS 2.0
Add to iGoogle Add to Live.com
  • DeZender对用Zend Encoder加密过的PHP文件反编译
  • 写一个用于微博同步的Google Desktop Gadget
  • 在同学的QZone中看到的BB用药大全
  • 今天终于收到金山快盘的邀请码
  • 利用最短ie判断在不同浏览器上播放背景音乐
  • 对插画方面的一点感受与回忆
  • 网上看到的两个死里逃生的图片,记录一下
  • 今天开通了糖果社区,附几个激活码
  • 终于可以实现我的多个微博实时同步了
  • 备案和现场拍照就是对站长们的瞎折腾
  • 今天开通了糖果社区,附几个激活码
  • 终于可以实现我的多个微博实时同步了
  • 备案和现场拍照就是对站长们的瞎折腾
  • 昨天借用飞姐的佳作做的一个浪漫爱情网页
  • 有几个腾讯微博的邀请码(实时更新)
  • BB的网站移到了GAE-JAVA上了
  • 一个基于GAE Python Web.py和JQuery的留言本程序
  • 类许愿墙的一个告白网站和一个电子书网站
  • Android中用Bitmap获取图片中某个区域的图象
  • 对暴力破解带密码的QQ相册的可行性分析
  • 对淘宝web旺旺版一些通讯接口的研究

Blogger Api 的简单应用(3)

posted by David Chen at July 16, 2007, 1:46 AM    

blogger api blogger客户端 blogger开发
发贴的函数和上传图片的函数

// 返回post成功后的httpUrl
String createPost(String title, String content, String authorName,
boolean isDraft, String[] cats) throws ServiceException, IOException {

// Create the entry to insert
Entry myEntry = new Entry();
myEntry.setTitle(new PlainTextConstruct(title)); // 标题
myEntry.setContent(new PlainTextConstruct(content)); // 内容
Person author = new Person(authorName, null, username); // 发贴人
myEntry.getAuthors().add(author);
myEntry.setDraft(isDraft); // 是否保存到发贴箱

// 添加labels,分类
for(int c=0; cats != null && c<cats.length; c++) {
Category category = new Category();
category.setScheme(ATOM_NS);
category.setTerm(cats[c]);
myEntry.getCategories().add(category);
}

Entry e = bloggerService.insert(postUrl, myEntry);
//System.out.println(e.getHtmlLink().getHref());
return e.getHtmlLink().getHref(); // 返回成功后的http链接
}

// 返回上传达室上成功后的图片的httpUrl
GGImage createPhoto(File image, String albumId) throws IOException,
ServiceException {

if (picasaService == null) {
picasaLogin();
}

photoUrl = new URL(PICASA_API.concat(this.username).concat("/albumid/")
.concat(albumId).concat("?kind=photo"));

BaseEntry myPhoto = new PhotoEntry();
myPhoto.setTitle(new PlainTextConstruct(image.getName()));
((PhotoEntry) myPhoto).setDescription(new PlainTextConstruct(image.getName()));
((PhotoEntry) myPhoto).setClient(SOURCE);
((PhotoEntry) myPhoto).setTimestamp(new Date());
((PhotoEntry) myPhoto).setAlbumId(albumId);

MediaFileSource myMedia = new MediaFileSource(image, "image/gif");
myPhoto.setMediaSource(myMedia);

PhotoEntry returnedPhoto = (PhotoEntry) picasaService.insert(photoUrl,
myPhoto);
PhotoFeed gfeed = picasaService.getFeed(new URL(returnedPhoto
.getFeedLink().getHref()), PhotoFeed.class);

return new GGImage(gfeed.getIcon(), gfeed.getWidth().intValue(), gfeed.getHeight().intValue());
}

public String getUsername() {
return username;
}

public void setUsername(String username) {
this.username = username;
}

}

class GGImage {
String httpUrl; // 存放实际的http图片地址
int width;
int height;

public GGImage(String httpUrl, int width, int height) {
super();
this.httpUrl = httpUrl;
this.width = width;
this.height = height;
}
public int getHeight() {
return height;
}
public void setHeight(int height) {
this.height = height;
}
public String getHttpUrl() {
return httpUrl;
}
public void setHttpUrl(String httpUrl) {
this.httpUrl = httpUrl;
}
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
}

相关文章:
Blogger Api 的简单应用(1)
Blogger Api 的简单应用(2)
Blogger Api 的简单应用(4)
测试我写的blogger客户端的发贴
Blogger客户端myblogger下载
Labels:
Trackback:   http://cwq.iou1314.com/_a151
微博最近更新
[2010-09-06 16:08]    明天有市领导来,后天又有省领导来,今天一个下午就拉了5条大横幅,累死我了,上周星期6,7办公室都要上班,这种生活什么时候可以摆脱?
[2010-09-04 04:43]    又是要加班的双休日,昨晚和领导去县城做资料做到11:30,确定这两天都要加班,刚准备回家,跟着领导接 电话说有村民想自杀不成,已带到卫生院,又跟领导回乡镇处理劝说一下。搞完到了1:30。回来凉都冲就睡 觉了。
本站内的任何文章,只代表个人意见或学习所用,如有版权声明,请尊重作者的劳动成果,在转载时请保留原始链接并注明出处。
Power by David's PhpCms, © 2007 - 2010 CWQ.IOU1314.COM All Rights Reserved.