将 mod_pagespeed 移植到另一个系统
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
是否要将 mod_pagespeed 移植到其他服务器或将其集成到其他系统中?太好了!我们已将 mod_pagespeed 开发为模块化并且几乎完全独立于 Apache。唯一的 Apache 专用代码位于 net/instaweb/apache
目录中。
如需查看我们的源代码,我们的主要代码位于 net/instaweb/ 中:
- util/ 和 http/ 包含许多基本工具,包括
MessageHandler
、Timer
和 UrlFetcher
等抽象基类。有一些实现示例,但您必须自行实现其中的许多实现。
- htmlparse/ 包含核心 HTML 解析器。您根本无需处理这个问题。
- rewriter/ 具有重写过滤器和框架。中央集成点是此处的部分抽象类,即
RewriteDriverFactory
。首先,您需要进行子类化并实现其纯虚拟方法。
您可能需要为以下类实现端口(请参阅 Apache/ 目录中的实现示例):
然后,要实际调用代码,您需要创建一个 FooRewriteDriverFactory
来创建您的所有对象,然后在服务器每次刷新之间执行 StartParseWithType(url, content_type)、ParseText(text) 和针对每个请求调用 FinishParse()。
如果您调查此问题或遇到任何问题,请写信给我们开发邮寄名单。我们无法保证任何内部接口都保持不变,因此,如果您不知道您的端口是否在被使用,就很容易对其进行破坏。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-09-05。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2024-09-05。"],[[["`mod_pagespeed` is designed to be modular and largely independent from Apache, making it portable to other servers and systems."],["To integrate `mod_pagespeed`, developers primarily need to work with the `net/instaweb/rewriter` directory and implement a subclass of `RewriteDriverFactory`."],["Porting requires implementing specific classes like `MessageHandler`, `FileSystem`, and `UrlFetcher` for the target environment, with examples provided in the `apache/` directory."],["The integration process involves using methods like `StartParseWithType`, `ParseText`, and `FinishParse` to handle content rewriting."],["Developers are encouraged to communicate with the `mod_pagespeed` development mailing list for support and to avoid potential integration issues due to internal interface changes."]]],["Mod_pagespeed's modular design allows porting or integration into other systems, with most code residing outside the Apache-specific directory. Key actions involve implementing ports for classes like `MessageHandler`, `FileSystem`, `Timer`, `UrlFetcher`, and more. The `RewriteDriverFactory` class serves as a central integration point, requiring subclassing. Integration also requires using `FooRewriteDriverFactory` and methods such as `StartParseWithType`, `ParseText`, and `FinishParse` for each request. The core HTML parser is in htmlparse, but doesn't need interaction.\n"]]