b3log的ArticleSender不是往本地数据库存文章的

如果是通过启动tomcat运行程序,那么,blogHost中会含有localhost字符串,这样,看这句:

ArticleSender.java

final String blogHost = Latkes.getServePath();
            System.out.println("inside articel sender,the blogHost is "+blogHost);

            if (blogHost.contains("localhost")) {
                LOGGER.log(Level.INFO, "Blog Solo runs on local server, so should not send this article[id={0}, title={1}] to Rhythm",
                    new Object[] {originalArticle.getString(Keys.OBJECT_ID), originalArticle.getString(Article.ARTICLE_TITLE)});
                return;
            }     
直接就从action()方法中退出了!

下面程序仅仅演示如何调用action()方法,因为缺少有关变量,所以也发送不了文章。

import org.b3log.latke.Latkes;
import org.b3log.latke.event.Event;
import org.b3log.latke.event.EventException;
import org.b3log.solo.event.rhythm.ArticleSender;
import org.json.JSONException;
import org.json.JSONObject;
public class testArticleSender {

	/**
	 * @param args
	 * @throws JSONException 
	 * @throws EventException 
	 */
	public static void main(String[] args) throws JSONException, EventException {
		// TODO Auto-generated method stub
		Latkes.initRuntimeEnv();
		String blogHost = Latkes.getServePath();
		System.out.println(blogHost);
		String s="{\"pupu\":\"kuku\",\"dudu\":\"tutu\"}";
		JSONObject pata=new JSONObject(s);
		System.out.println(pata);
		Event shiJian=new Event("haha",pata);
		ArticleSender faSong=new ArticleSender();
	    faSong.action(shiJian);

	}

}



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值