Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
file_input_resource.h
Go to the documentation of this file.
1 /*
2  * Copyright 2010 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 
20 
21 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_FILE_INPUT_RESOURCE_H_
22 #define NET_INSTAWEB_REWRITER_PUBLIC_FILE_INPUT_RESOURCE_H_
23 
24 #include "net/instaweb/http/public/request_context.h"
29 
30 namespace net_instaweb {
31 
32 struct ContentType;
33 class InputInfo;
34 class MessageHandler;
35 class ResponseHeaders;
36 class RewriteDriver;
37 
38 class FileInputResource : public Resource {
39  public:
40  FileInputResource(const RewriteDriver* driver,
41  const ContentType* type,
42  StringPiece url,
43  StringPiece filename);
44  virtual ~FileInputResource();
45 
48 
49  virtual bool IsValidAndCacheable() const;
50 
52  virtual void FillInPartitionInputInfo(HashHint include_content_hash,
53  InputInfo* input);
54 
55  virtual GoogleString url() const { return url_; }
56 
57  virtual bool UseHttpCache() const { return false; }
58 
59  protected:
60  void SetDefaultHeaders(const ContentType* content_type,
61  ResponseHeaders* header, MessageHandler* handler);
62 
63  virtual void LoadAndCallback(NotCacheablePolicy not_cacheable_policy,
64  const RequestContextPtr& request_context,
65  AsyncCallback* callback);
66 
67  private:
68  GoogleString url_;
69  GoogleString filename_;
70  int64 last_modified_time_sec_;
71  int64 max_file_size_;
72  int64 load_from_file_cache_ttl_ms_;
73  bool load_from_file_ttl_set_;
74 
75 
76 };
77 
78 }
79 
80 #endif
virtual void LoadAndCallback(NotCacheablePolicy not_cacheable_policy, const RequestContextPtr &request_context, AsyncCallback *callback)
virtual GoogleString url() const
Gets the absolute URL of the resource.
Definition: file_input_resource.h:55
Read/write API for HTTP response headers.
Definition: response_headers.h:37
Definition: resource.h:57
NotCacheablePolicy
Definition: resource.h:68
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
Definition: rewrite_driver.h:100
Definition: content_type.h:31
Definition: file_input_resource.h:38
virtual void FillInPartitionInputInfo(HashHint include_content_hash, InputInfo *input)
Set OutputPartition's input info used for expiration validation.
Definition: message_handler.h:39
virtual bool IsValidAndCacheable() const
virtual bool UseHttpCache() const
Definition: file_input_resource.h:57