Latke 标签

Latke Code View - Latke.java

大致的代码结构: java b3log cache,cron,event,image,intercept,ioc logging,mail,model,plugin,remote,repository service,servlet,taskqueue,thread,urlfetch,user,util Latkes.java Keys.java,Runtimetabase.java,RuntimeEnv.java,RuntimeMode.java json weborganic resources beans.xml Latkes.java 下面那一行涉及的代码基本没有逻辑,全是枚举或者常量值的定义,想来无可研究。 开始的字段定义继续忽略,首先是静态代码块(删去了 LOGGER): static { try { final InputStream resourceAsStream = Latkes.class.getResourceAsStream("/latke.properties"); if (null != resourceAsStream) { LATKEPROPS.l....

阅读全文 »

Latke Code View - Cache 有更新!

未注明的引用均为Java内部包 所有setter、getter、logger等逻辑无关代码均忽略不计 忽略了一些常见注解 org.b3log.latke.cache.local.memory.AbstractMemoryCache import org.b3log.latke.cache.Cache; public abstract class AbstractMemoryCache<K extends Serializable, V extends Serializable> implements Cache<K, V> { private long maxCount = Long.MAX_VALUE; private long hitCount; private long missCount; private long putCount; private long cachedCount; protected final void hitCountInc() { hitCount++; } protected final void missCountInc....

阅读全文 »

Latke Code View - Cron

org.b3log.latke.cron.Cron import org.b3log.latke.servlet.HTTPRequestMethod; import org.b3log.latke.urlfetch.HTTPRequest; import org.b3log.latke.urlfetch.URLFetchService; import org.b3log.latke.urlfetch.URLFetchServiceFactory; public final class Cron extends TimerTask { public static final int TEN = 10; public static final int SIXTY = 60; public static final int THOUSAND = 1000; private String url; private String description; private String schedule; private long period; public Cron(final String ....

阅读全文 »

Latke Code View - IOC.annotated

org.b3log.latke.ioc.annotated.AbstractAnnotatedCallableImpl org.b3log.latke.ioc.annotated.AnnotatedConstructorImpl org.b3log.latke.ioc.annotated.AnnotatedFieldImpl org.b3log.latke.ioc.annotated.AnnotatedMethodImpl org.b3log.latke.ioc.annotated.AnnotatedParameterImpl org.b3log.latke.ioc.annotated.AnnotatedTypeImpl

阅读全文 »

通过Latke-Demo对Latke工作流程的初步分析 有更新!

Latke代码看到IOC包后就彻底懵逼了,从已看过的几段代码来看,都是各种set、get,变量名称含义抽象,不知所云。由此感到单纯的读代码恐怕无法理解IOC包的实现逻辑了。于是决定运行一下demo,来跟踪一下代码。以下是latke-demo项目从请求发起到响应结束时经过的代码段(层级关系可能不太正确,但是大致流程就是如此) 虽然还没有完全明白,但是跟踪下来感觉颇有收获,待慢慢补充细节 1. DispatcherServlet.service //以此作为起点。此处是最原始的servlet,配置在web.xml中,再细节的方面,暂时可以当做黑盒了。 //不得不说,jsp+servlet作为基础,当年没有好好学是个错误。(垃圾讲师误人啊……) protected void service(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { //HTTPRequestContext,Latke封装,没有定义构造器 final HTTPRequ....

阅读全文 »