|
EmbeddingPageSpeed
Explains how to embed Page Speed in other applications.
IntroductionPage Speed is a cross-platform embeddable web performance diagnostics library written in C++. The Page Speed library encapsulates the Page Speed Web Performance Best Practices. ... OverviewPage Speed takes a set of HTTP resources as inputs, and produces either a set of structured result objects, or a human-readable summary, as outputs. The inputs include a set of Resource objects, each of which provides access to the attributes of an HTTP resource, such as request and response headers, request and response body, status code, etc. In addition, some Page Speed rules require access to a subset of the DOM API. The DOM API is optional; if an implementation of the DOM API is not provided then the rules that depend on DOM will not run. The human-readable summary output can be plain text, HTML, JSON, a protocol buffer, or any other format using the pluggable Page Speed formatter API. Example Use // First instantiate a !PagespeedInput instance. !PagespeedInput owns all of the
// resources as well as a pointer to the DOM API if available.
pagespeed::!PagespeedInput input;
pagespeed::Resource *r = new pagespeed::Resource();
r->!SetRequestUrl("http://www.example.com/");
r->!SetRequestMethod("GET");
r->!AddRequestHeader("Cookie", "foo");
r->!AddRequestHeader("Accept-Encoding", "gzip, deflate");
r->!SetResponseStatusCode(200);
r->!AddRequestHeader("Content-Type", "text/html; charset=UTF8");
r->!AddRequestHeader("Content-Encoding", "gzip");
// add other headers as appropriate
r->!SetResponseBody(...);
input.!AddResource(r);
Getting the code... coming soon ... Please don't ask questions in the comments. Use the mailing list instead. |
You must also call input.Freeze() after setting up the input and before computing results
Hi, can someone explaine that
Have someone ran a demo success ?
Is a Java SDK somewhere on the roadmap or should I roll my own?
oh, i don't understand about API because i don't know to copy this code that where i paste.