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

#include "url_multipart_encoder.h"

Inheritance diagram for net_instaweb::UrlMultipartEncoder:

Public Member Functions

virtual void Encode (const StringVector &urls, const ResourceContext *data, GoogleString *encoding) const
virtual bool Decode (const StringPiece &url_segment, StringVector *urls, ResourceContext *data, MessageHandler *handler) const

Detailed Description

Encodes a multiple strings into a single string so that it can be decoded. This is not restricted to URLs but is optimized for them in its choice of escape characters. '+' is used to separate the parts, and any parts that include '+' are prefixed by a '='. '=' is converted to '==' – it's a pretty lightweight encoding, and any other character restrictions will have to be applied to the output of this class.


TODO(jmarantz): One possibly improvement is to bake this functionality into UrlEscaper, changing its interface to accept arbitrary numbers of pieces in & out. However, that would change an interface that's used in multiple places, so this is left as a


Member Function Documentation

virtual bool net_instaweb::UrlMultipartEncoder::Decode ( const StringPiece &  url_segment,
StringVector *  urls,
ResourceContext *  out_data,
MessageHandler handler 
) const

Decode URLs from "url_segment". Note that there may be other meta-data encoded in url_segment, which this function will write into out_data, if present.

Reimplemented from net_instaweb::UrlSegmentEncoder.

virtual void net_instaweb::UrlMultipartEncoder::Encode ( const StringVector &  urls,
const ResourceContext *  data,
GoogleString url_segment 
) const

Encodes arbitrary text so it can be used in a url segment. A url segment must contain only characters that are legal in URLs, and exclude "/" and "." which are used for a higher level encoding scheme into which this must fit.

'data' is optional – it can be NULL and it is up to the encoder to decide what to do.

Reimplemented from net_instaweb::UrlSegmentEncoder.

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