Page Speed Optimization Libraries  1.5.27.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Static Public Member Functions | Friends
net_instaweb::UrlLeftTrimFilter Class Reference

#include "url_left_trim_filter.h"

Inheritance diagram for net_instaweb::UrlLeftTrimFilter:
net_instaweb::CommonFilter net_instaweb::EmptyHtmlFilter net_instaweb::HtmlFilter

List of all members.

Public Member Functions

 UrlLeftTrimFilter (RewriteDriver *rewrite_driver, Statistics *stats)
virtual void StartDocumentImpl ()
virtual void StartElementImpl (HtmlElement *element)
virtual void EndElementImpl (HtmlElement *element)
virtual const char * Name () const
 The name of this filter -- used for logging and debugging.

Static Public Member Functions

static void InitStats (Statistics *statistics)
static bool Trim (const GoogleUrl &base_url, const StringPiece &url_to_trim, GoogleString *trimmed_url, MessageHandler *handler)

Friends

class UrlLeftTrimFilterTest

Detailed Description

Filter that trims redundant information from the left end of each url.

For example: if the page's base URL is http://www.example.com/foo/bar.html then the following URLs can be trimmed: http://www.example.com/foo/bar/other.html -> bar/other.html http://www.example.com/another.html -> /another.html http://www.example.org/index.html -> //www.example.org/index.html

Todo:
TODO(jmaessen): Do we care to introduce ../ in order to relativize more urls? For example, if base URL is http://www.example.com/foo/bar/index.html we could convert: http://www.example.com/foo/other.html -> ../other.html rather than -> /foo/other.html.

Member Function Documentation

virtual void net_instaweb::UrlLeftTrimFilter::StartDocumentImpl ( ) [inline, virtual]

Overload these implementer methods: Intentionally left abstract so that implementers don't forget to change the name from Blah to BlahImpl.

Implements net_instaweb::CommonFilter.

static bool net_instaweb::UrlLeftTrimFilter::Trim ( const GoogleUrl base_url,
const StringPiece &  url_to_trim,
GoogleString *  trimmed_url,
MessageHandler handler 
) [static]

Trim 'url_to_trim' relative to 'base_url' returning the result in 'trimmed_url'. Returns true if we succeeded at trimming the URL.

This is static and requires the base_url explicitly, so that it can be called from other places (like the CSS filter).


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines