模拟站点的自动登录发帖回复
2009-09-21 00:00:00 来源:WEB开发网Java代码
/**
* 站点发帖新帖
*/
public class SitePost extends CommonSitePost
{
public SitePost(BrowserContext context) {
super();
this.context=context;
}
public String post(Postinfos postinfo,Siteboards siteboard) throws IOException
{
if (postinfo != null && siteboard != null) {
if (StringUtils.isNotEmpty(siteboard.getPostUrl())) {
PostMethod post = new PostMethod(siteboard.getPostUrl());
if(this.hasRequestParameters()){
post.setRequestBody(this.getRequestParams());
}
if(this.hasExtraRequestHeaders()){
this.addExtraRequestHeaders(post,this.getExtraRequestHeaders());
}
context.setCommonMethodRequestHeaders(post);
this.context.doPost(post);
}else{
System.out.println("版面的新帖提交地址不能为空!");
}
}else{
System.out.println("帖子或者版面信息输入都不能为空");
}
return null;
}
}
更多精彩
赞助商链接