先看代码:

+ (void)_registerDefaultHandlers
{
[self registerHandler:[WXResourceRequestHandlerDefaultImpl new] withProtocol:@protocol(WXResourceRequestHandler)];
[self registerHandler:[WXNavigationDefaultImpl new] withProtocol:@protocol(WXNavigationProtocol)];
[self registerHandler:[WXURLRewriteDefaultImpl new] withProtocol:@protocol(WXURLRewriteProtocol)]; }

WXSDKEngine中默认注册了3个Handler。

+ (void)registerHandler:(id)handler withProtocol:(Protocol *)protocol
{
WXAssert(handler && protocol, @"Fail to register the handler, please check if the parameters are correct !"); [WXHandlerFactory registerHandler:handler withProtocol:protocol];
}

WXSDKEngine会继续调用WXHandlerFactory的registerHandler:withProtocol:方法。

@interface WXHandlerFactory : NSObject

@property (nonatomic, strong) WXThreadSafeMutableDictionary *handlers;

+ (void)registerHandler:(id)handler withProtocol:(Protocol *)protocol;

+ (id)handlerForProtocol:(Protocol *)protocol;

+ (NSDictionary *)handlerConfigs;

@end

WXHandlerFactory也是一个单例,里面有一个线程安全的字典handlers,用来保存实例和Protocol名的映射表。

WeexSDK之注册Handlers的更多相关文章

  1. WeexSDK之注册Components

    先来看一下注册Components的源码: + (void)_registerDefaultComponents { [self registerComponent:@"container& ...

  2. WeexSDK之注册Modules

    注册Modules的流程和注册Components非常类似. + (void)_registerDefaultModules { [self registerModule:@"dom&quo ...

  3. WeexSDK源码分析(iOS)

    0.从工作原理谈起 Weex 表面上是一个客户端技术,但实际上它串联起了从本地开发.云端部署到分发的整个链路.开发者首先可在本地像编写 web 页面一样编写一个 app 的界面,然后通过命令行工具将之 ...

  4. Python urllib2 模块学习笔记

    2015.3.6  urllib2的使用方法大致如下 # 定制Handler处理函数 opener = urllib2.build_opener(ProxyHandler, HTTPHandler) ...

  5. LWP::UserAgent - Web user agent class Web 用户agent 类:

    LWPUserAgent: LWP::UserAgent - Web user agent class Web 用户agent 类: 概述: require LWP::UserAgent; my $u ...

  6. Iris框架源码阅读和分析

    iris包结构简介 iris包含了很多包,下面这些是分析过程中接触到的东西. 能力有限,多多包涵,欢迎联系QQ:2922530320 一起交流 context包包含: Context (接口) con ...

  7. SpringCloud解析之Zuul(一)

    本文基于Spring Cloud Edgware.SR6,Zuul版本1.3.1,解析Zuul的请求拦截机制,让大家对Zuul的原理有个大概的认识和了解.如有不对的地方,欢迎指正. spring bo ...

  8. Node.js Express连接mysql完整的登陆注册系统(windows)

    windows学习环境: node 版本: v0.10.35 express版本:4.10.0 mysql版本:5.6.21-log 第一部分:安装node .Express(win8系统 需要&qu ...

  9. Java Web之网上购物系统(注册、登录、浏览商品、添加购物车)

    眼看就要期末了,我的专业课也迎来了第二次的期末作业---------<网上购物系统>.虽然老师的意图是在锻炼我们后台的能力,但是想着还是不利用网上的模板,准备自己写,以来别人写的静态页看不 ...

随机推荐

  1. Unable to complete the scan for annotations for web application [/wrs] due to a StackOverflowError. Possible root causes include a too low setting for -Xss and illegal cyclic inheritance dependencies.

    tomcat启动报错:Jul 20, 2018 11:48:37 AM org.apache.catalina.core.ContainerBase addChildInternalSEVERE: C ...

  2. js跳转新窗口

    语法:window.open(url,[target]); eg: window.open("index.html"); window.open("index.html& ...

  3. leetcode152

    class Solution { public: int maxProduct(vector<int>& nums) { if(nums.empty()) ; ) ]; ]; // ...

  4. 1 CRM

    一.crm介绍 CRM,客户关系管理系统(Customer Relationship Management).企业用CRM技术来管理与客户之间的关系,以求提升企业成功的管理方式,其目的是协助企业管理销 ...

  5. css:元素水平垂直居中的多种方式

    CSS元素(文本.图片)水平垂直居中方法   1.text-align:center; 2.margin:0 auto; 3.display:inline-block; + text-align:ce ...

  6. mac下用命令行解压文件

    在Mac上的归档工具不能够解压rar文件,这时可以使用终端中的unrar来解决问题. 步骤如下: 1.使用Homebrew安装unrar(有关Homebrew的安装和使用见Homebrew) $ br ...

  7. SpringJDBC :jdbcTemplate在连接是出现 org/springframeworkbc/core/JdbcTemplate : Unsupported major.minor version 52.0 异常解决

    原因是这个在jdk9版本才能使用,需更新jdk版本. 更新jdk9之后在idear的配置: 第一步:File---->Project Structure---->Project 第二步: ...

  8. Servlet中获取Spring管理的bean

    描述: 在Servlet中调用Spring管理的接口,可以使Dao/Service/ServiceImpl. 前提是在调用的bean中有注解: @Repository("beanName&q ...

  9. Pandas分组

    GroupBy技术 分组运算的过程可以用下面的流程图表示出来 import pandas as pd from pandas import Series import numpy as np df = ...

  10. Windows Server 2012安装密钥

    Windows Server 2012 Standard 密钥:NB4WH-BBBYV-3MPPC-9RCMV-46XCB Windows Server 2012 StandardCore 密钥:NB ...