Page Speed Optimization Libraries  1.11.33.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
url_namer.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http:///www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
18 
19 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_URL_NAMER_H_
20 #define NET_INSTAWEB_REWRITER_PUBLIC_URL_NAMER_H_
21 
22 #include "pagespeed/kernel/base/basictypes.h"
23 #include "pagespeed/kernel/base/string.h"
24 
25 namespace net_instaweb {
26 
27 class AsyncFetch;
28 class GoogleUrl;
29 class OutputResource;
30 class RequestHeaders;
31 class RewriteOptions;
32 
38 class UrlNamer {
39  public:
40  enum EncodeOption {
41  kSharded,
42  kUnsharded
43  };
44 
45  UrlNamer();
46  virtual ~UrlNamer();
47 
55  virtual GoogleString Encode(const RewriteOptions* rewrite_options,
56  const OutputResource& output_resource,
57  EncodeOption encode_option) const;
58 
65  virtual bool Decode(const GoogleUrl& request_url,
66  const RewriteOptions* rewrite_options,
67  GoogleString* decoded) const;
68 
73  virtual bool IsAuthorized(const GoogleUrl& request_url,
74  const RewriteOptions& options) const;
75 
77  virtual void ConfigureCustomOptions(const RequestHeaders& request_headers,
78  RewriteOptions* options) const {}
79 
82  virtual bool ProxyMode() const { return false; }
83 
86  virtual bool IsProxyEncoded(const GoogleUrl& url) const { return false; }
87 
89  virtual void PrepForCrossDomain(AsyncFetch*) const { }
90 
91  const GoogleString& proxy_domain() const { return proxy_domain_; }
92 
93  void set_proxy_domain(const GoogleString& proxy_domain) {
94  proxy_domain_ = proxy_domain;
95  }
96 
97  private:
98  GoogleString proxy_domain_;
99 
100 
101 };
102 
103 }
104 
105 #endif
Definition: url_namer.h:38
virtual void PrepForCrossDomain(AsyncFetch *) const
Prepare Fetch for cross-domain request.
Definition: url_namer.h:89
virtual void ConfigureCustomOptions(const RequestHeaders &request_headers, RewriteOptions *options) const
Configure custom options. Note that options may be NULL.
Definition: url_namer.h:77
virtual GoogleString Encode(const RewriteOptions *rewrite_options, const OutputResource &output_resource, EncodeOption encode_option) const
virtual bool IsAuthorized(const GoogleUrl &request_url, const RewriteOptions &options) const
Definition: async_fetch.h:53
virtual bool IsProxyEncoded(const GoogleUrl &url) const
Definition: url_namer.h:86
virtual bool ProxyMode() const
Definition: url_namer.h:82
Definition: output_resource.h:44
virtual bool Decode(const GoogleUrl &request_url, const RewriteOptions *rewrite_options, GoogleString *decoded) const
Definition: rewrite_options.h:84