Page Speed Optimization Libraries
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
net_instaweb::UrlPartnership Class Reference

#include "url_partnership.h"

Public Member Functions

 UrlPartnership (const RewriteDriver *driver)
bool AddUrl (const StringPiece &resource_url, MessageHandler *handler)
GoogleString ResolvedBase () const
int num_urls () const
 Returns the number of URLs that have been successfully added.
GoogleString RelativePath (int index) const
const GoogleUrlFullPath (int index) const
 Returns the full resolved path.
void RemoveLast ()
 Removes the last URL that was added to the partnership.
virtual void Reset (const GoogleUrl &original_request)
int NumCommonComponents () const

Static Public Member Functions

static bool FindResourceDomain (const GoogleUrl &base_url, const UrlNamer *url_namer, const RewriteOptions *rewrite_options, GoogleUrl *resource, GoogleString *domain, MessageHandler *handler)

Protected Member Functions

const RewriteOptionsrewrite_options () const

Detailed Description

A URL partnership should be established in order to combine resources, such as in CSS combination, JS combination, or image spriting. This class centralizes the handling of such combinations, answering two questions:

  1. Is it legal for a new URL to enter into the partnership
  2. What is the greatest common prefix
  3. What are the unique suffices for the elements.

Member Function Documentation

bool net_instaweb::UrlPartnership::AddUrl ( const StringPiece &  resource_url,
MessageHandler handler 

Adds a URL to a combination. If it can be legally added, consulting the DomainLaywer, then true is returned.

static bool net_instaweb::UrlPartnership::FindResourceDomain ( const GoogleUrl base_url,
const UrlNamer url_namer,
const RewriteOptions rewrite_options,
GoogleUrl resource,
GoogleString domain,
MessageHandler handler 

Based on the UrlNamer and DomainLawyer, find the domain associated with a request, removing any proxy prefix that may have been added by the UrlNamer. The meaning of "associated" is defined by the UrlNamer implementation. *resource is also adjusted to the version that will be written out to the page.

int net_instaweb::UrlPartnership::NumCommonComponents ( ) const

Returns the number of common path components for all resources in this partnership.

GoogleString net_instaweb::UrlPartnership::RelativePath ( int  index) const

Returns the relative path of a particular URL that was added into the partnership. This requires that Resolve() be called first.

virtual void net_instaweb::UrlPartnership::Reset ( const GoogleUrl original_request)

Establish a new URL as the original request, which is used for domain authorization and mapping of URLs as they are added to the partnership.

GoogleString net_instaweb::UrlPartnership::ResolvedBase ( ) const

Computes the resolved base common to all URLs. This will always have a trailing slash.

The documentation for this class was generated from the following file: