22 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_OUTPUT_RESOURCE_H_
23 #define NET_INSTAWEB_REWRITER_PUBLIC_OUTPUT_RESOURCE_H_
25 #include "base/logging.h"
31 #include "net/instaweb/util/public/ref_counted_ptr.h"
35 namespace net_instaweb {
56 StringPiece unmapped_base,
57 StringPiece original_base,
62 const RequestContextPtr& request_context,
70 virtual GoogleString
url()
const;
99 virtual GoogleString
name_key()
const;
114 const GoogleString& unmapped_base()
const {
return unmapped_base_; }
115 const GoogleString& original_base()
const {
return original_base_; }
116 const ResourceNamer& full_name()
const {
return full_name_; }
117 ResourceNamer* mutable_full_name() {
return &full_name_; }
118 StringPiece name()
const {
return full_name_.name(); }
119 StringPiece experiment()
const {
return full_name_.experiment(); }
120 StringPiece suffix()
const;
121 StringPiece filter_prefix()
const {
return full_name_.
id(); }
122 StringPiece hash()
const {
return full_name_.hash(); }
123 StringPiece signature()
const {
return full_name_.signature(); }
124 bool has_hash()
const {
return !hash().empty(); }
127 computed_url_.clear();
151 virtual void SetType(
const ContentType* type);
176 void clear_cached_result();
181 clear_cached_result();
191 return rewrite_options_;
197 Writer*
BeginWrite(MessageHandler* message_handler);
198 void EndWrite(MessageHandler* message_handler);
206 return cache_control_suffix_;
208 void set_cache_control_suffix(
const GoogleString& x) {
209 DCHECK(cache_control_suffix_.empty());
210 cache_control_suffix_ = x;
218 friend class RewriteDriver;
219 friend class ServerContext;
220 friend class ServerContextTest;
222 void SetHash(StringPiece hash);
223 StringPiece extension()
const {
return full_name_.ext(); }
224 GoogleString ComputeSignature();
225 bool CheckSignature();
228 GoogleString DumpFileName()
const;
230 bool writing_complete_;
238 bool cached_result_owned_;
239 CachedResult* cached_result_;
259 GoogleString resolved_base_;
260 GoogleString unmapped_base_;
261 GoogleString original_base_;
263 GoogleString cache_control_suffix_;
265 ResourceNamer full_name_;
268 mutable GoogleString computed_url_;
270 const RewriteOptions* rewrite_options_;
const GoogleString & resolved_base() const
output-specific
Definition: output_resource.h:113
virtual GoogleString name_key() const
Writer * BeginWrite(MessageHandler *message_handler)
void UpdateCachedResultPreservingInputInfo(CachedResult *to_update) const
CachedResult * EnsureCachedResultCreated()
void SetWritten(bool written)
This is called by CacheCallback::Done in rewrite_driver.cc.
Definition: output_resource.h:188
StringPiece id() const
Simple getters.
Definition: resource_namer.h:72
void set_cached_result(CachedResult *cached_result)
Definition: output_resource.h:180
Definition: resource.h:202
GoogleString UrlEvenIfHashNotSet()
virtual bool UseHttpCache() const
Definition: output_resource.h:200
Definition: resource.h:56
NotCacheablePolicy
Definition: resource.h:67
GoogleString decoded_base() const
virtual void SetType(const ContentType *type)
Sets the type of the output resource, and thus also its suffix.
virtual GoogleString url() const
OutputResource(const RewriteDriver *driver, StringPiece resolved_base, StringPiece unmapped_base, StringPiece original_base, const ResourceNamer &resource_id, OutputResourceKind kind)
GoogleString HttpCacheKey() const
Definition: rewrite_driver.h:98
void ClearHash()
Other setter-like operations.
Definition: resource_namer.h:98
void DumpToDisk(MessageHandler *handler)
const GoogleString & cache_control_suffix() const
Definition: output_resource.h:205
Definition: output_resource.h:44
const CachedResult * cached_result() const
Definition: output_resource.h:165
bool IsWritten() const
Definition: output_resource.h:148
Definition: rewrite_options.h:81
virtual void LoadAndCallback(NotCacheablePolicy not_cacheable_policy, const RequestContextPtr &request_context, AsyncCallback *callback)
Definition: resource_namer.h:32
OutputResourceKind
Definition: output_resource_kind.h:26